Template:STV election graph/testcases
![]() | This is the template test cases page for the sandbox of Template:STV election graph. to update the examples. If there are many examples of a complicated template, later ones may break due to limits in MediaWiki; see the HTML comment "NewPP limit report" in the rendered page. You can also use Special:ExpandTemplates to examine the results of template uses. You can test how this page looks in the different skins and parsers with these links: |
__EXPECTUNUSEDTEMPLATE__
Test1
{{STV election graph|1Colour=#E4003B |1Count1=8000 |1Count2=7000 |1Count3=6000 |1Party=Labour |2Colour=#0087DC |2Count1=3500 |2Count2=4500 |2Count3=5500 |2Party=Conservative |3Colour=#FAA61A |3Count1=2500 |3Count2=2300 |3Count3=2100 |3Party=Liberal Democrats |Candidates=3 |Counts=3}}
<graph> {
"legends":[ { "properties":{ "title":{ "fill":{ "value":"#54595d" } }, "labels":{ "fill":{ "value":"#54595d" } } }, "stroke":"color", "title":"Party", "fill":"color" } ], "scales":[ { "type":"ordinal", "name":"x", "zero":false, "domain":{ "data":"chart", "field":"x" }, "range":"width", "nice":true }, { "type":"linear", "name":"y", "domain":{ "data":"stats", "field":"sum_y" }, "zero":true, "range":"height", "nice":true }, { "domain":{ "data":"chart", "field":"series" }, "type":"ordinal", "name":"color", "range":[ "#E4003B","#0087DC","#FAA61A","#000000" ] } ], "version":2, "marks":[ { "type":"group", "marks":[ { "properties":{ "hover":{ "fill":{ "value":"#54595d" } }, "update":{ "fill":{ "scale":"color", "field":"series" } }, "enter":{ "y":{ "scale":"y", "field":"layout_start" }, "x":{ "scale":"x", "field":"x" }, "y2":{ "scale":"y", "field":"layout_end" }, "width":{ "scale":"x", "offset":-1, "band":true }, "fill":{ "scale":"color", "field":"series" } } }, "type":"rect" } ], "from":{ "data":"chart", "transform":[ { "field":"y", "type":"stack", "sortby":[ "-_id" ], "groupby":[ "x" ] }, { "groupby":[ "series" ], "type":"facet" } ] } } ], "height":300, "axes":[ { "type":"x", "title":"Count", "scale":"x", "properties":{ "title":{ "fill":{ "value":"#54595d" } }, "grid":{ "stroke":{ "value":"#54595d" } }, "ticks":{ "stroke":{ "value":"#54595d" } }, "axis":{ "strokeWidth":{ "value":2 }, "stroke":{ "value":"#54595d" } }, "labels":{ "fill":{ "value":"#54595d" } } }, "grid":false }, { "type":"y", "title":"Votes", "scale":"y", "format":"d", "properties":{ "title":{ "fill":{ "value":"#54595d" } }, "grid":{ "stroke":{ "value":"#54595d" } }, "ticks":{ "stroke":{ "value":"#54595d" } }, "axis":{ "strokeWidth":{ "value":2 }, "stroke":{ "value":"#54595d" } }, "labels":{ "fill":{ "value":"#54595d" } } }, "grid":false } ], "data":[ { "format":{ "parse":{ "y":"integer", "x":"string" }, "type":"json" }, "name":"chart", "values":[ { "y":8000, "series":"Labour", "x":"1" } ,{ "y":7000, "series":"Labour", "x":"2" } ,{ "y":6000, "series":"Labour", "x":"3" } ,{ "y":3500, "series":"Conservative", "x":"1" } ,{ "y":4500, "series":"Conservative", "x":"2" } ,{ "y":5500, "series":"Conservative", "x":"3" } ,{ "y":2500, "series":"Liberal Democrats", "x":"1" } ,{ "y":2300, "series":"Liberal Democrats", "x":"2" } ,{ "y":2100, "series":"Liberal Democrats", "x":"3" } ,{ "y":200, "series":"Non-transferable", "x":"2" } ,{ "y":400, "series":"Non-transferable", "x":"3" } ] }, { "transform":[ { "type":"aggregate", "summarize":{ "y":"sum" }, "groupby":[ "x" ] } ], "name":"stats", "source":"chart" } ], "width":150
} </graph>
{{STV election graph/sandbox}}
<graph> {
"legends":[ { "properties":{ "title":{ "fill":{ "value":"#54595d" } }, "labels":{ "fill":{ "value":"#54595d" } } }, "stroke":"color", "title":"Party", "fill":"color" } ], "scales":[ { "type":"ordinal", "name":"x", "zero":false, "domain":{ "data":"chart", "field":"x" }, "range":"width", "nice":true }, { "type":"linear", "name":"y", "domain":{ "data":"stats", "field":"sum_y" }, "zero":true, "range":"height", "nice":true }, { "domain":{ "data":"chart", "field":"series" }, "type":"ordinal", "name":"color", "range":[ "#E4003B","#0087DC","#FAA61A","#000000" ] } ], "version":2, "marks":[ { "type":"group", "marks":[ { "properties":{ "hover":{ "fill":{ "value":"#54595d" } }, "update":{ "fill":{ "scale":"color", "field":"series" } }, "enter":{ "y":{ "scale":"y", "field":"layout_start" }, "x":{ "scale":"x", "field":"x" }, "y2":{ "scale":"y", "field":"layout_end" }, "width":{ "scale":"x", "offset":-1, "band":true }, "fill":{ "scale":"color", "field":"series" } } }, "type":"rect" } ], "from":{ "data":"chart", "transform":[ { "field":"y", "type":"stack", "sortby":[ "-_id" ], "groupby":[ "x" ] }, { "groupby":[ "series" ], "type":"facet" } ] } } ], "height":300, "axes":[ { "type":"x", "title":"Count", "scale":"x", "properties":{ "title":{ "fill":{ "value":"#54595d" } }, "grid":{ "stroke":{ "value":"#54595d" } }, "ticks":{ "stroke":{ "value":"#54595d" } }, "axis":{ "strokeWidth":{ "value":2 }, "stroke":{ "value":"#54595d" } }, "labels":{ "fill":{ "value":"#54595d" } } }, "grid":false }, { "type":"y", "title":"Votes", "scale":"y", "format":"d", "properties":{ "title":{ "fill":{ "value":"#54595d" } }, "grid":{ "stroke":{ "value":"#54595d" } }, "ticks":{ "stroke":{ "value":"#54595d" } }, "axis":{ "strokeWidth":{ "value":2 }, "stroke":{ "value":"#54595d" } }, "labels":{ "fill":{ "value":"#54595d" } } }, "grid":false } ], "data":[ { "format":{ "parse":{ "y":"integer", "x":"string" }, "type":"json" }, "name":"chart", "values":[ { "y":8000, "series":"Labour", "x":"1" } ,{ "y":7000, "series":"Labour", "x":"2" } ,{ "y":6000, "series":"Labour", "x":"3" } ,{ "y":3500, "series":"Conservative", "x":"1" } ,{ "y":4500, "series":"Conservative", "x":"2" } ,{ "y":5500, "series":"Conservative", "x":"3" } ,{ "y":2500, "series":"Liberal Democrats", "x":"1" } ,{ "y":2300, "series":"Liberal Democrats", "x":"2" } ,{ "y":2100, "series":"Liberal Democrats", "x":"3" } ,{ "y":200, "series":"Non-transferable", "x":"2" } ,{ "y":400, "series":"Non-transferable", "x":"3" } ] }, { "transform":[ { "type":"aggregate", "summarize":{ "y":"sum" }, "groupby":[ "x" ] } ], "name":"stats", "source":"chart" } ], "width":150
} </graph>
Test2
{{STV election graph|param1|param2|...|name3=value3}}
<graph> {
"legends":[ { "properties":{ "title":{ "fill":{ "value":"#54595d" } }, "labels":{ "fill":{ "value":"#54595d" } } }, "stroke":"color", "title":"Party", "fill":"color" } ], "scales":[ { "type":"ordinal", "name":"x", "zero":false, "domain":{ "data":"chart", "field":"x" }, "range":"width", "nice":true }, { "type":"linear", "name":"y", "domain":{ "data":"stats", "field":"sum_y" }, "zero":true, "range":"height", "nice":true }, { "domain":{ "data":"chart", "field":"series" }, "type":"ordinal", "name":"color", "range":[ "" ] } ], "version":2, "marks":[ { "type":"group", "marks":[ { "properties":{ "hover":{ "fill":{ "value":"#54595d" } }, "update":{ "fill":{ "scale":"color", "field":"series" } }, "enter":{ "y":{ "scale":"y", "field":"layout_start" }, "x":{ "scale":"x", "field":"x" }, "y2":{ "scale":"y", "field":"layout_end" }, "width":{ "scale":"x", "offset":-1, "band":true }, "fill":{ "scale":"color", "field":"series" } } }, "type":"rect" } ], "from":{ "data":"chart", "transform":[ { "field":"y", "type":"stack", "sortby":[ "-_id" ], "groupby":[ "x" ] }, { "groupby":[ "series" ], "type":"facet" } ] } } ], "height":300, "axes":[ { "type":"x", "title":"Count", "scale":"x", "properties":{ "title":{ "fill":{ "value":"#54595d" } }, "grid":{ "stroke":{ "value":"#54595d" } }, "ticks":{ "stroke":{ "value":"#54595d" } }, "axis":{ "strokeWidth":{ "value":2 }, "stroke":{ "value":"#54595d" } }, "labels":{ "fill":{ "value":"#54595d" } } }, "grid":false }, { "type":"y", "title":"Votes", "scale":"y", "format":"d", "properties":{ "title":{ "fill":{ "value":"#54595d" } }, "grid":{ "stroke":{ "value":"#54595d" } }, "ticks":{ "stroke":{ "value":"#54595d" } }, "axis":{ "strokeWidth":{ "value":2 }, "stroke":{ "value":"#54595d" } }, "labels":{ "fill":{ "value":"#54595d" } } }, "grid":false } ], "data":[ { "format":{ "parse":{ "y":"integer", "x":"string" }, "type":"json" }, "name":"chart", "values":[ ] }, { "transform":[ { "type":"aggregate", "summarize":{ "y":"sum" }, "groupby":[ "x" ] } ], "name":"stats", "source":"chart" } ], "width":300
} </graph>
{{STV election graph/sandbox}}
<graph> {
"legends":[ { "properties":{ "title":{ "fill":{ "value":"#54595d" } }, "labels":{ "fill":{ "value":"#54595d" } } }, "stroke":"color", "title":"Party", "fill":"color" } ], "scales":[ { "type":"ordinal", "name":"x", "zero":false, "domain":{ "data":"chart", "field":"x" }, "range":"width", "nice":true }, { "type":"linear", "name":"y", "domain":{ "data":"stats", "field":"sum_y" }, "zero":true, "range":"height", "nice":true }, { "domain":{ "data":"chart", "field":"series" }, "type":"ordinal", "name":"color", "range":[ "" ] } ], "version":2, "marks":[ { "type":"group", "marks":[ { "properties":{ "hover":{ "fill":{ "value":"#54595d" } }, "update":{ "fill":{ "scale":"color", "field":"series" } }, "enter":{ "y":{ "scale":"y", "field":"layout_start" }, "x":{ "scale":"x", "field":"x" }, "y2":{ "scale":"y", "field":"layout_end" }, "width":{ "scale":"x", "offset":-1, "band":true }, "fill":{ "scale":"color", "field":"series" } } }, "type":"rect" } ], "from":{ "data":"chart", "transform":[ { "field":"y", "type":"stack", "sortby":[ "-_id" ], "groupby":[ "x" ] }, { "groupby":[ "series" ], "type":"facet" } ] } } ], "height":300, "axes":[ { "type":"x", "title":"Count", "scale":"x", "properties":{ "title":{ "fill":{ "value":"#54595d" } }, "grid":{ "stroke":{ "value":"#54595d" } }, "ticks":{ "stroke":{ "value":"#54595d" } }, "axis":{ "strokeWidth":{ "value":2 }, "stroke":{ "value":"#54595d" } }, "labels":{ "fill":{ "value":"#54595d" } } }, "grid":false }, { "type":"y", "title":"Votes", "scale":"y", "format":"d", "properties":{ "title":{ "fill":{ "value":"#54595d" } }, "grid":{ "stroke":{ "value":"#54595d" } }, "ticks":{ "stroke":{ "value":"#54595d" } }, "axis":{ "strokeWidth":{ "value":2 }, "stroke":{ "value":"#54595d" } }, "labels":{ "fill":{ "value":"#54595d" } } }, "grid":false } ], "data":[ { "format":{ "parse":{ "y":"integer", "x":"string" }, "type":"json" }, "name":"chart", "values":[ ] }, { "transform":[ { "type":"aggregate", "summarize":{ "y":"sum" }, "groupby":[ "x" ] } ], "name":"stats", "source":"chart" } ], "width":300
} </graph>