This page does the calculations required to create SVG assessment graphs for WP:USRD and for WP:CRWP.

Refresh this page

Coordinate data

edit

The coordinate plane is typically 120 pixels high. The B–FA graph is calculated for 240px, but on 120px graph, the result is a 2x magnification.

WP:USRD assessment graphs
Class Count Pie wedge x y Area graph Stat graph B–FA graph Cumulative Relative
  ??? 1 0.01%  0×10−16  −1.0000 0.01 119.99      
  Stub 1318 10.64%  61.9631  −78.4893 12.77 106.82
  Start 4450 35.91%  21.5312  97.6545 55.87 75.50
  C 3755 30.30%  −99.3267  −11.5850 92.23 82.45
  B 1579 12.74%  −60.8426  −79.3610 107.52 104.21 −37.9
  GA 1184 9.55%  −5.3720  −99.8556 118.98 108.16 1.60
  A 21 0.17%  −4.3085  −99.9071 119.19 119.79 117.90
  FA 84 0.68%  −0.0507  −100.0000 120.00 119.16 111.60
Total 12392  
  15.39 71.17
edit
WP:CRWP assessment graphs
Class Count Pie wedge x y Area graph
  ??? 13 0.80%  0×10−16  −1.0000 0.96
  Stub 923 56.70%  −40.8381  91.2811 68.99
  Start 375 23.03%  −95.6167  −29.2823 96.63
  C 63 3.87%  −85.7543  −51.4413 101.28
  B 125 7.68%  −52.1017  −85.3546 110.49
  GA 116 7.13%  −10.0177  −99.4970 119.04
  A 4 0.25%  −8.4806  −99.6397 119.34
  FA 9 0.55%  −5.0152  −99.8742 120.00
Total 1628  
edit

Tutorial

edit

While SVG may look like a strange language, it is actually pretty easy to update the graphs. The files are all text-editable, which means you can simply download the SVG files and open them in your favorite text editor. Plotting points in SVG is very similar to plotting points on a Cartesian plane. In SVG, however, the origin is the top left corner of the viewing area of your browser and the Y-axis goes down the page. It is possible to translate the origin to another part of the graph.

Pie chart

edit

The pie charts are the easiest to edit, so we'll start there. When I created the pie chart, I translated the origin of the circle to (110,110) which made it a lot easier to do the math required to create the wedges. The coordinates listed in the charts above account for this.

There are seven wedges in the graph – one for each assessment class – and the corresponding lines look similar to this:

<!-- stub-class articles -->
<path fill="#f66" d="M0,0 L0,-100 A100,100 0, 0,1 99.7949,-6.4021 Z"/>

This is fancy SVG code telling the renderer that it's part of a circle. We're only really interested in L0,-100 and 99.7949,-6.4021. The L0,-100 is our starting point on the circle and 99.7949,-6.4021 is the ending point. Both coordinates are located on the circle. The L value is always the same as the previous wedge, since the stubs always start the graph, it's starting at the top, which is 0,-100. The other value, 99.7949,-6.4021 can be replaced with the values from the table 99.6374,-8.5083. Remember, the L value on the Start-Class wedge will be L99.6374,-8.5083. Repeat for each wedge.

When you're done with the wedges, don't forget to update the percentages:

<text x="255" y="63">Stub (23.98%)</text>

Preview the graph in your browser before you upload it. My most common mistakes were either forgetting the comma in the ordered pairs or replacing a decimal point with a comma.

Other graphs

edit

The other graphs are little trickier, but are nonetheless easy to edit. All of the graphs are a rolling window of the last 5 years. If we were to continue showing every month, the text you see would eventually be narrowed to the point of not being legible. To accomplish this, the line part of the graph is contained within a second SVG document within the main document. To get the graph to "roll", you must change the position of the second SVG's viewBox.

For this part of the tutorial, I'll be looking at the stat graph.

<svg width="360" height="136" x="40" y="0" viewBox="60 0 360 136">

The only number that needs to be changed is the first number, in this case 60. Simply advance that number by 5 (65). Any code that is not within the 360-pixel viewBox will not be visible.

Lengthening the lines is simple. They use polylines, which allow you to define points long which the lines will be drawn. This is in contrast to a line, which only allows you to define the beginning and ending points.

<polyline class="Total"
	points="40,119.98 45,95.30 50,87.51 55,83.65 60,79.99 65,69.49 70,59.64 75,53.75
		...omitted for brevity...
		360,16.04"/>

In this example we would the next point would be at 365,<Y COORDINATE>, which is determined from the table above. Do this for all lines.


The area graph is slightly different. It uses the same polyline to create a polygon, so the line must be closed to render correctly.

<polyline fill="#f66" stroke="#000" stroke-width="0.25"
	points="40,120 40,0 45,44.79 50,50.3 55,47.08 60,40.58 65,23.95 70,0 75,4.33 80,0.02 
		...omitted for brevity...
		270,0 275,0.01 280,0.01 290,0 360,0 360,120"/>

As you can see, the last two coordinates have the same X value. The Y-value of the last ordered pair <X COORDINATE>,120 does not need to be changed.