score:2

Accepted answer

so, per the chart.js documentation, http://www.chartjs.org/docs/#doughnut-pie-chart-data-structure

for a pie chart, you must pass in an array of objects with a value and an optional color property

it turns out the color property is not so optional after all. sure, the chart will render fine (as in all black pie slices, divided by white segment stroke color, pretty bad looking by default) with no javascript errors. but, when you mousemove and mouseout of the pie, the colors magically change to white (with the same white segment stroke color), rendering the whole pie chart invisible against a white background, with only the tooltips showing on mousemove, mouseout.

the documentation of chart.js should either make a note of this behavior, or make color a mandatory property or add good default colors, that don't change magically with mouse events.

but till then, users should assume the color property is mandatory to prevent headaches.

this is significant, as many developers will want to massage the data json returned from server to add ui related info, to keep the server side free of any ui logic.


Related Query