dataPointMaxWidth sets the maximum width of dataPoints in column / bar, ohlc and candlestick, charts. This allows you to limit the width of dataPoints when there are very few of them in the chart. At the same time, when the number of dataPoints increase, chart reduces their width so that they don’t overlap.
Default : Automatically calculated based on the chart size.var chart = new CanvasJS.Chart("container", { . . dataPointMaxWidth: 20, . . }); chart.render();
Also See:
9 Comments
I am using Python Flask and Bootstrap. When I try to set the datapointmaxwidth property it is getting ignored (no errors thrown). Even if I copy and paste the sample script above, I cannot get the widths to change. Any advice or hints as to what is going wrong? Thanks!
Are you using the latest version of CanvasJS?? dataPointMaxWidth is supported only since v1.7 Beta.
How can I set min width to the bar??
When the data is more, It is showing very thin points
I’m using a stacked column chart with the latest CanvasJS and max width is being ignored for me as well. I add the data to the chart programmatically after the chart has been instanced. Is that the problem?
Stephen,
We are unable to reproduce your issue. Can you please create a jsfiddle with the issue so that we can help you out.
Nevermind. I figured it out. I was declaring the dataPointMaxWidth at the data series level instead of the data level. It’s working now.
One other question relates to stacked range column charts. Are they possible?
As well as dataPointMaxWidth, there should also be an option to specify the pixel-based grid width, and I don’t mean the gridLineThickness, I mean the actual grid width. Might not be important for 99.9% of the applications but consider the case that one wants to be able to set dataPointMaxWidth to 1 and the distance to 1 or even 0.
I just wanted to show different size of bars depends up on the data coming from backend. can you please suggest me on this
Jagadesan,
Sorry, as of now this feature is not available. Currently you can control dataPointWith or dataPointMaxWith/dataPointMinWidth for all the dataSeries.