PMSI-AlignAlytics / dimple

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

In 2.1.4 and up, series order isn't preserved after data update. #203

Open extantpedant opened 8 years ago

extantpedant commented 8 years ago

I was following the Time Bubble Lines example http://dimplejs.org/advanced_examples_viewer.html?id=advanced_time_axis and came across what seems to be a bug. I thought it was something I was doing wrong, but in troubleshooting, I found that it only occurs in version 2.1.4 and up. 2.1.2 works as expected.

The problem is: On initial load, the multiple series are arranged back-to-front in order of declaration as expected. But, when changing the data on myChart.data, then calling myChart.draw(), the series arrangement is reversed on new data. In this case, the bubbles are now in front of the lines.

This jsbin demonstrates the effect. http://jsbin.com/nanoci/edit?html,output Change the version of Dimple to version 2.1.2 in the Jsbin and the problem goes away.

jjimenez commented 8 years ago

I've got the same problem. My example is here: http://jsfiddle.net/jose_jimenez/1fvjvyvh/3/.

One suggestion is to separate the two series into separate g elements... Maybe it's time for me to download the code...

jjimenez commented 8 years ago

I have a patch that I'll work into a pull request. It adds a series._group similar to the chart._group and changes the plots to use that to append shapes to. I'll test tomorrow and see about the pull request.

Update: spoke too soon. Some of the functionality breaks when the shapes in separate series are not siblings.

jjimenez commented 8 years ago

see pull request #207 :)

extantpedant commented 8 years ago

screen shot 2016-02-02 at 2 11 53 pm

With your patch now, the grid lines are in front of the series.

jjimenez commented 8 years ago

shoot, I didn't even notice that. I'm sure it is because of the order the gridlines are added. I'll have to update my pull request.

jjimenez commented 8 years ago

I've updated my pull request to move gridlines and axes into their own groups so they don't overlap with series elements. image from the scatter pie example.