வார்ப்புரு:Graph:PageViews
{{#tag:graph|
 {
   //
   // ATTENTION: This code is maintained at https://www.mediawiki.org/wiki/Template:Graph:PageViews
   //            Please do not modify it anywhere else, as it may get copied and override your changes.
   //            Suggestions can be made at https://www.mediawiki.org/wiki/Template_talk:Graph:PageViews
   //            The graph uses PageViews API https://wikitech.wikimedia.org/wiki/Analytics/PageviewAPI
   //
 
   &quot;version&quot;: 2,
   &quot;width&quot;: {{{width|800}}},
   &quot;height&quot;: {{{height|200}}},
 
   // The data for this graph comes from the PageView API.  The request is made for N days back up to now.
   &quot;data&quot;: [
     {
       &quot;name&quot;: &quot;pageviews&quot;,
       &quot;url&quot;: &quot;wikirest://wikimedia.org/api/rest_v1/metrics/pageviews/{{#ifeq: {{#iferror: {{#expr: {{{1|}}} + 1 }} | {{{1|}}} | {{{2|}}} }} | _ | aggregate | per-article }}/{{trim|{{#ifeq: {{#iferror: {{#expr: {{{1|}}} + 1 }} | {{#iferror: {{#expr: {{{2|}}} + 1 }} | {{{2|{{SERVERNAME}}}}} | {{{3|{{SERVERNAME}}}}} }} | {{{3|{{SERVERNAME}}}}} }} | www.mediawiki.org | mediawiki.org | {{#iferror: {{#expr: {{{1|}}} + 1 }} | {{#iferror: {{#expr: {{{2|}}} + 1 }} | {{{2|{{SERVERNAME}}}}} | {{{3|{{SERVERNAME}}}}} }} | {{{3|{{SERVERNAME}}}}} }} }}}}/{{{platform|all-access}}}/user/{{#ifeq: {{#iferror: {{#expr: {{{1|}}} + 1 }} | {{{1|}}} | {{{2|}}} }} | _
 | {{{granularity | monthly}}}
 | {{urlencode:{{#titleparts: {{#iferror: {{#expr: {{{1|}}} + 1 }} | {{{1|{{ARTICLEPAGENAME}}}}} | {{{2|{{ARTICLEPAGENAME}}}}} }} }}|PATH}}/daily
 }}/{{formatnum:{{#time: Ymd | -{{#iferror: {{#expr: {{{1|}}} + 1 }} | {{#iferror: {{#expr: {{{2|}}} + 1 }} | {{{3|30}}} | {{{2|30}}} }} | {{{1|30}}} }} days }}|R}}00/{{formatnum:{{#time: Ymd }}|R}}00&quot;,
       &quot;format&quot;: {
         &quot;type&quot;: &quot;json&quot;,
         &quot;property&quot;: &quot;items&quot;
       },
 
       // The response is parsed here, converting date strings of form &quot;20160223&quot; into date 2016-02-23
       &quot;transform&quot;: [
         { &quot;type&quot;: &quot;formula&quot;, &quot;field&quot;: &quot;year&quot;, &quot;expr&quot;: &quot;parseInt(substring(datum.timestamp,0,4))&quot; },
         { &quot;type&quot;: &quot;formula&quot;, &quot;field&quot;: &quot;month&quot;, &quot;expr&quot;: &quot;parseInt(substring(datum.timestamp,4,6))&quot; },
         { &quot;type&quot;: &quot;formula&quot;, &quot;field&quot;: &quot;day&quot;, &quot;expr&quot;: &quot;parseInt(substring(datum.timestamp,6,8))&quot; },
         { &quot;type&quot;: &quot;formula&quot;, &quot;field&quot;: &quot;date&quot;, &quot;expr&quot;: &quot;datetime(datum.year,datum.month-1,datum.day)&quot; }
       ]
     }
   ],
 
   &quot;scales&quot;: [
     // The dates are scaled to the &quot;x&quot; axis - the width of the graph
     {
       &quot;name&quot;: &quot;x&quot;,
       &quot;type&quot;: &quot;time&quot;,
       &quot;range&quot;: &quot;width&quot;,
       &quot;domain&quot;: {&quot;data&quot;: &quot;pageviews&quot;,&quot;field&quot;: &quot;date&quot;}
     },
     // The pageviews are scaled to the &quot;y&quot; axis - the height of the graph
     // Optional scale parameter can change &quot;linear&quot; to other scales like log
     // Optional max parameter can fix the upper bound of the graph
     {
       &quot;name&quot;: &quot;y&quot;,
       &quot;type&quot;: &quot;{{{scale|linear}}}&quot;,
       &quot;range&quot;: &quot;height&quot;,
       &quot;domain&quot;: {&quot;data&quot;: &quot;pageviews&quot;,&quot;field&quot;: &quot;views&quot;},
       &quot;clamp&quot;: true,
 {{ #if: {{{max|}}}
 | &quot;domainMax&quot;: {{{max}}},
 }}
       &quot;nice&quot;: true
     }
   ],
 
   // Simple axis with horizontal grid lines
   &quot;axes&quot;: [
     {
       &quot;type&quot;: &quot;x&quot;,
       &quot;scale&quot;: &quot;x&quot;,
       &quot;ticks&quot;: 5,
       &quot;properties&quot;: {
         &quot;ticks&quot;: {&quot;stroke&quot;: {&quot;value&quot;: &quot;#666666&quot;} },
         &quot;labels&quot;: {&quot;fill&quot;: {&quot;value&quot;: &quot;#666666&quot;} },
         &quot;axis&quot;: {&quot;stroke&quot;: {&quot;value&quot;: &quot;#666666&quot;}, &quot;strokeWidth&quot;: {&quot;value&quot;: 2} }
       }
     },
     {
       &quot;type&quot;: &quot;y&quot;,
       &quot;scale&quot;: &quot;y&quot;,
       &quot;ticks&quot;: 5,
       &quot;grid&quot;: true,
       &quot;properties&quot;: {
         &quot;ticks&quot;: {&quot;stroke&quot;: {&quot;value&quot;: &quot;#666666&quot;} },
         &quot;labels&quot;: {&quot;fill&quot;: {&quot;value&quot;: &quot;#666666&quot;} },
         &quot;grid&quot;: {&quot;stroke&quot;: {&quot;value&quot;: &quot;#666666&quot;}, &quot;strokeWidth&quot;: {&quot;value&quot;: 2} },
         &quot;axis&quot;: {&quot;stroke&quot;: {&quot;value&quot;: &quot;#666666&quot;}, &quot;strokeWidth&quot;: {&quot;value&quot;: 2} }
       }
     }
   ],
 
   // The graph is drawn with two elements a thick line at the top, and a semi-transparent area below
   &quot;marks&quot;: [
     {
       &quot;type&quot;: &quot;line&quot;,
       &quot;from&quot;: {&quot;data&quot;: &quot;pageviews&quot;},
       &quot;properties&quot;: {
         &quot;enter&quot;: {
           &quot;x&quot;: {&quot;scale&quot;: &quot;x&quot;,&quot;field&quot;: &quot;date&quot;},
           &quot;y&quot;: {&quot;scale&quot;: &quot;y&quot;,&quot;field&quot;: &quot;views&quot;},
           &quot;stroke&quot;: {&quot;value&quot;: &quot;{{{color|#00f}}}&quot;},
           &quot;strokeWidth&quot;: {&quot;value&quot;: 3},
           &quot;interpolate&quot;: {&quot;value&quot;: &quot;{{{interpolate|monotone}}}&quot;}
         }
       }
     },
     {
       &quot;type&quot;: &quot;area&quot;,
       &quot;from&quot;: {&quot;data&quot;: &quot;pageviews&quot;},
       &quot;properties&quot;: {
         &quot;enter&quot;: {
           &quot;x&quot;: {&quot;scale&quot;: &quot;x&quot;,&quot;field&quot;: &quot;date&quot;},
           &quot;y&quot;: {&quot;scale&quot;: &quot;y&quot;,&quot;value&quot;: 0},
           &quot;y2&quot;: {&quot;scale&quot;: &quot;y&quot;,&quot;field&quot;: &quot;views&quot;},
           &quot;fill&quot;: {&quot;value&quot;: &quot;{{{color|#00f}}}&quot;},
           &quot;fillOpacity&quot;: {&quot;value&quot;: 0.35},
           &quot;interpolate&quot;: {&quot;value&quot;: &quot;{{{interpolate|monotone}}}&quot;}
         }
       }
     }
   ]
 }