where we are trying to draw 4 bars, labelled with the branch names, and whose heights are respectively 50,70,32,82.
dimple.plot.bar will, by default, re-order these in descending order of value, drawing the bars from left- to right as: Derby, Bootle, Solihull, Wolverhampton.
Or, I can add an explicit:
x.addOrderRule("Branch name");
and dimple.plot.bar will then order the bars alphabetically as Bootle, Derby, Solihull, Wolverhampton.
But I already generated the order that I wanted in Postgres, and emitted the JSON array in the desired order, which happens to be "Solihull, Bootle, Wolverhampton, Derby".
How can I tell Dimple: "Don't sort, it's already in the right order"?
Perhaps the "obvious" way to do it might be to pass in an explicit "null" to addOrderRule()?
Workaround: it is possible to force this, by creating a list of keys, by iterating over the data.
Then:
x.addOrderRule(["Solihull", "Bootle", "Wolverhampton", "Derby"]);
Consider the case of a basic bar chart, driven by a simple key-value json array:
[ {"Branch name":"Solihull","KPI value":"50"}, {"Branch name":"Bootle","KPI value":"70"}, {"Branch name":"Wolverhampton","KPI value":"32"}, {"Branch name":"Derby","KPI value":"82"}, ]
where we are trying to draw 4 bars, labelled with the branch names, and whose heights are respectively 50,70,32,82.
dimple.plot.bar will, by default, re-order these in descending order of value, drawing the bars from left- to right as: Derby, Bootle, Solihull, Wolverhampton.
Or, I can add an explicit: x.addOrderRule("Branch name");
and dimple.plot.bar will then order the bars alphabetically as Bootle, Derby, Solihull, Wolverhampton.
But I already generated the order that I wanted in Postgres, and emitted the JSON array in the desired order, which happens to be "Solihull, Bootle, Wolverhampton, Derby".
How can I tell Dimple: "Don't sort, it's already in the right order"? Perhaps the "obvious" way to do it might be to pass in an explicit "null" to addOrderRule()?
Thanks very much.