Page MenuHomePhabricator

If the values on Y axis are all less than 7, then the generated graph shows each value on Y axis twice
Open, Needs TriagePublic

Description

It may not necessarily be true that all numbers need to be less than 7, but I could reproduce the bug only that way.

Steps to reproduce one such graph:

  • Go here https://www.mediawiki.org/wiki/Special:GraphSandbox
  • Copy and paste the following template in the sandbox {{GraphChart|width=400|height=100|xAxisTitle=X|yAxisTitle=Y|type=rect|x=1,2,3,4,5,6,7,8,9,10,11|y=6,5,2,4,3,1,6,1,2,1,1}} and notice the double values on the Y-axis.

Event Timeline

I wonder if this has to do with rounding somewhere™. As the "raw" version (not using Template:Graph:Chart) displays "0.0", "0.5", "1.0", "1.5" etc instead:

<graph>
{
  "version": 2, "width": 400, "height": 100,
  "data": [
    { "name": "table", "values": [ {"x": 1,  "y": 6}, {"x": 2,  "y": 5}, {"x": 3,  "y": 2}, {"x": 4,  "y": 4}, {"x": 5,  "y": 3}, {"x": 6,  "y": 1}, {"x": 7,  "y": 6}, {"x": 8,  "y": 1}, {"x": 9,  "y": 2}, {"x": 10, "y": 1}, {"x": 11, "y": 1} ] }
  ],
  "scales": [
    { "name": "x", "type": "ordinal", "range": "width", "domain": {"data": "table", "field": "x"} },
    { "name": "y", "range": "height", "domain": {"data": "table", "field": "y"} }
  ],
  "axes": [ {"type": "x", "scale": "x"}, {"type": "y", "scale": "y"} ],
  "marks": [ { "type": "rect", "from": {"data": "table"}, "properties": { "enter": { "x": {"scale": "x", "field": "x"}, "width": {"scale": "x", "band": true, "offset": -1}, "y": {"scale": "y", "field": "y"}, "y2": {"scale": "y", "value": 0} }, "update": { "fill": {"value": "steelblue"} } } } ]
}
</graph>
TheDJ added a subscriber: TheDJ.

The ticks are automatic. This is all configurable in later versions of Vega