PMSI-AlignAlytics / dimple

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

Documentation: clarify how to use multiple independent variables #283

Open RichardNeill opened 7 years ago

RichardNeill commented 7 years ago

It's not really clear from the docs how Dimple expects to receive its data. May I suggest it's worth clarifying a couple of points:

  1. Dimple by default assumes that there are multiple X-categories combining to form a single Y-value. However, this model doesn't work especially well when there are multiple independent Y axes, all driven from a single X variable.

  2. In particular, data of the format: { X:0, Y1:1, Y2:2 } { X:1, Y1:3, Y2:4 } { X:2, Y1:5, Y2:6 }

is not easy to plot as 2 separate line charts, Y1 against X, and Y2 against X.

  1. Dimple's model prefers the JSON to be formatted as: { X:0, type:Y1, val:1 } { X:0, type:Y2, val:2 } { X:1, type:Y1, val:3 } { X:1, type:Y2, val:4 } { X:2, type:Y1, val:5 } { X:2, type:Y2, val:6 }

  2. If the source data is in the first form, it's often necessary to reshape the array into the second.

  3. There seems to be no way to make dimple accept data in the form: X = [ 0,1,2] Y1 = [1,3,5] Y2 = [2,4,6]

I discovered that it's possible to do what I need by explicitly overriding the chart data, but this isn't obvious, and none of the examples work this way. Thanks very much.