You must be logged in to post your query.
Home › Forums › Chart Support › Bar chart column hover background color
Tagged: Bar
Hi…
How can I change the padding/distance between my bars in a bar chart. Right now there is almost now padding/distance. I know I can set the a fixed pixel width, but that doesn’t work dynamically.
https://canvasjs.com/docs/charts/chart-options/datapoint-width/
I would like the have a distance between bars the same with as a bar is itself. Do you have any help for me?
Thanks
@lujakob,
You can set the distance between data points same as width of the of the data points by setting dataPointWidth dynamically as shown in the code snippet below.
chart.set("dataPointWidth",Math.ceil(chart.axisX[0].bounds.width/chart.data[0].dataPoints.length / 2),true);
Please take a look at this JSFiddle for the working example on the same.
__ Sachin Bisht Team CanvasJS
You must be logged in to reply to this topic. Login/Register