PMSI-AlignAlytics / dimple

An object-oriented API for business analytics
Other
2.73k stars 556 forks source link

measure in x axis affects proportions in y axis - change from dimple 2.1.6 to 2.2 #255

Open simbs opened 7 years ago

simbs commented 7 years ago

I have a mekko chart that shows cost changes based on known future cost changes from 3rd party partners. I am plotting both cost increases and decreases in the same mekko, with the following rules:

v21

Data points look like this: {absCost: , cost: , crmTeam: , customer: , order: , sign: }, where:

And this axis & series definition

// set x axis, group by crmTeam and order by "order"
var x = myChart.addAxis("x", "crmTeam", "order");
x.addOrderRule("order", true);

// set y axis, remove gridlines, hide it
var y = myChart.addPctAxis("y", "absCost");
y.showGridlines = false;
y.hidden = true;

// add series, aggregate by customer/sign combinations
// colour by sign
var s = myChart.addSeries(["customer", "sign"], dimple.plot.bar);

// make negative bars always be on the bottom
s.addOrderRule(function (left, right) {
    if (left.sign === right.sign) return 0;
    if (left.sign === "negative" && right.sign === "positive") return 1;
    return -1;
});
// order by cost in descending order
s.addOrderRule("cost", true);

This was working fine until I updated to dimple 2.2, at which it starting giving every reactangle with order=0 a height of zero.

v22

Changing things in the y-axis properties did nothing to change it, but removing "order" as a measure for the x axis started displaying them again, although not in the way I want it to (the x axis is no longer sized and ordered by sum of cost increases).

Any idea what's causing this? And if this was a necessary change in v2.2, do you have suggestions on how to change the chart? I'll have to keep using 2.1 otherwise, should be fine.