Difference between revisions of "DPL Example 103"

From FollowTheScore
Jump to: navigation, search
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
{{Example|Create a bar chart based on DPL query}}
 
{{Example|Create a bar chart based on DPL query}}
  
We show the 20 most popular articles; [[Template:DPL Example 103 barchart]] contains the script; data comes from a DPL query.
+
We show the 15 most popular articles; [[Template:DPL Example 103 barchart]] contains the script; data comes from a DPL query.
  
 
<pre><nowiki>
 
<pre><nowiki>
{{DPL Example 103 barchart|data=
 
  {{#dpl:
 
    |namespace      =
 
    |addpagecounter = yes
 
    |ordermethod    = counter
 
    |order          = descending
 
    |count          = 7
 
    |format        = ,"%TITLE%" %COUNT%,\n
 
  }}
 
}}
 
 
</nowiki></pre>
 
</nowiki></pre>
  
Line 19: Line 9:
 
The above script produces the following output:
 
The above script produces the following output:
 
----
 
----
{{DPL Example 103 barchart|xrange=0 5000|data=
+
{{DPL Example 103 barchart|xrange=0 15000|yrange=0 16|stubsX=5000|data=
 
   {{#dpl:
 
   {{#dpl:
 
     |namespace      =  
 
     |namespace      =  
Line 25: Line 15:
 
     |ordermethod    = counter
 
     |ordermethod    = counter
 
     |order          = descending
 
     |order          = descending
     |count          = 20
+
     |count          = 15
 
     |format        = ,"%TITLE%" %COUNT%,\n
 
     |format        = ,"%TITLE%" %COUNT%,\n
 
   }}
 
   }}
 
}}
 
}}

Latest revision as of 12:52, 13 March 2009

back to list of examples

Create a bar chart based on DPL query

We show the 15 most popular articles; Template:DPL Example 103 barchart contains the script; data comes from a DPL query.



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% "Test 005" %COUNT% "Test 006" %COUNT% "Test 007" %COUNT% "Test 008" %COUNT% "Tmp2" %COUNT% "2008/08/23 SD test" %COUNT% "Event template zh-tw" %COUNT% "Event intro zh-tw" %COUNT%

// set up plotting area using proc areadef

  1. proc areadef
 rectangle: 1 1 5 10
 xrange: 0 15000
 yrange: 0 16
 title: 
 frame: color=0.8

// do x axis using proc xaxis

  1. proc xaxis
 stubs inc 5000
 axisline: none
 tics: none 
 label: 
 grid: color=rgb(.6,1,.6)
 stubformat: %g%

// do bars using proc bars

  1. proc bars
 axis: x
 lenfield: 2
 color: pink
 showvalues: yes
 labelfield: 1
 longwayslabel: yes
 labeldetails: size=8 
 reverseorder: yes
 outline: no

}}