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.
Notes
  • 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 Editing The Code

  Also See:    


If you have any questions, please feel free to ask in our forums.Ask Question

5 Comments

  1. Kelsey says:

    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?

    • Vishwas R says:

      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.

If you have any questions, please feel free to ask in our forums. Ask Question