Difference between revisions of "DPL Example 102"

From FollowTheScore
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
{{Example|Create a pie chart based on DPL query}}
 
{{Example|Create a pie chart based on DPL query}}
  
We show the 10 most popular articles
+
We show the 7 most popular articles; [[Template:DPL Example 102 piechart]] contains the script; data comes from a DPL query.
  
 
<pre><nowiki>
 
<pre><nowiki>
{{#ploticus:
+
{{DPL Example 102 piechart|data=
 
+
  {{#dpl:
#proc getdata
+
    |namespace      =
  data:
+
    |addpagecounter = yes
"Alpha" 100
+
    |ordermethod    = counter
"Beta"  200
+
    |order          = descending
"Gamma" 300
+
    |count          = 7
 
+
    |format        = ,"%TITLE%" %COUNT%,\n
//  render pie graph
+
  }}
#proc pie
 
datafield: 2
 
labelfmtstring: @@1\n@@2\n@@PCT%
 
labelmode: line+label
 
outlinedetails: color=blue
 
center: 3 3
 
radius: 1.1
 
colors: dullyellow drabgreen pink powderblue lavender
 
labelfarout: 1.2
 
explode: 0 0.2 0 0
 
 
}}
 
}}
 
</nowiki></pre>
 
</nowiki></pre>
Line 31: Line 21:
 
{{DPL Example 102 piechart|data=
 
{{DPL Example 102 piechart|data=
 
   {{#dpl:
 
   {{#dpl:
     |titlematch=A%
+
     |namespace      =  
     |format=,"%TITLE%" 100,\n
+
    |addpagecounter = yes
    |count=10
+
    |ordermethod    = counter
 +
    |order          = descending
 +
    |count          = 7
 +
     |format         = ,"%TITLE%" %COUNT%,\n
 
   }}
 
   }}
 
}}
 
}}

Latest revision as of 11:27, 13 March 2009

back to list of examples

Create a pie chart based on DPL query

We show the 7 most popular articles; Template:DPL Example 102 piechart contains the script; data comes from a DPL query.

{{DPL Example 102 piechart|data=
  {{#dpl:
    |namespace      = 
    |addpagecounter = yes
    |ordermethod    = counter
    |order          = descending
    |count          = 7
    |format         = ,"%TITLE%" %COUNT%,\n
  }}
}}

The above script produces the following output:


{{#ploticus:

  1. proc getdata
 data:

"Test5554" %COUNT% "2008-02-16 best time ever" %COUNT% "Nowa kategoria" %COUNT% "Test 001" %COUNT% "Test 002" %COUNT% "Test 003" %COUNT% "Test 004" %COUNT%

// render pie graph

  1. proc pie

datafield: 2 labelfmtstring: @@1 (@@2) labelmode: line+label outlinedetails: color=blue center: 4 4 radius: 1.6 colors: dullyellow drabgreen pink powderblue lavender labelfarout: 1.8 }}