Used this c3js - having the X axis in the middle of the chart to get the chart to start from 0. But when I click on the legend, the x grid reverts the bottom. Any ideas on how to make it start from 0?
My charts are dynamically created and assigned to a specific dom element id
Your d3 manipulation is only called once after you created the chart. When you use the legend to toggle something, the chart is generating itself again without displaying this particular selection. When this happens, you have to manipulate the chart again. You can do this using the
onclick
event from the legend. You have to call thetoggle
function here again because you override the defaultonclick
function.