dataPointWidth : Number

dataPointWidth sets the width of dataPoints in column / bar, ohlc and candlestick, charts. This allows you to fix the width of dataPoints such that their width doesn’t change when the total number of dataPoints varies. At the same time, when the number of dataPoints increase, it can lead to overlap if dataPointWidth is not set properly.


Default : Automatically calculated based on the chart size.
Example : 10, 20, 30, etc.

Note
  • Supported in all types of column / bar charts, ohlc and candlestick charts.
  • dataPointWidth should be higher than dataPointMinWidth and lesser than dataPointMaxWidth

var  chart =  new  CanvasJS.Chart("container",
{
 .
 .
 dataPointWidth: 20,
 .
 .
});
chart.render();


Try it Yourself by Editing the Code below.

  Also See:    



In order to provide better support,we have closed the comments and switched completely to our Forums.
If you have any questions, please feel free to ask in our forums.

Comments 5

  1. This doesn’t seem to work for the rangeBar chart. Any ideas on how to change the width of the bars in the rangeBar chart type?

    • Kelsey,

      You can use dataPointWidth to set the width of rangeBar chart aswell. We checked and it seems to be working fine. If you are still facing the issue, kindly reproduce the same in a jsfiddle, so that we can check and resolve it.

In order to provide better support,we have closed the comments and switched completely to our Forums.
If you have any questions, please feel free to ask in our forums.