Home Forums Chart Support Bar chart column hover background color

Bar chart column hover background color

Viewing 2 posts - 1 through 2 (of 2 total)
  • #44161

    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

    #44173

    @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

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.