You must be logged in to post your query.
Home › Forums › Chart Support › How to manage graph size
Tagged: Bar Chart, fixed width
I am new at canvasJS. I am generating graph dynamically using loop. I am generating bar charts. I want to make fixed bar width and total graph width. But now my graph comes different size based on number of bars.
Please see the link http://jsfiddle.net/mujahid_102/QwZuf/673/ . Here I have shown two sample static graphs. I want to show width of the bars and width of the graphs are equal size. label text will be breakdown if it is long.
@mujahid_102,
You can set the width of the bars using the dataPointWidth property. We observed that you are using min-width for setting the height which prevents the the height of the div getting lower than 360px in your case but it is not an absolute value. It would be better if you could follow something like :
min-width
<div id="chartContainer" style="height: 360px; width: 100%;"></div>
The label text clips only when the text is very long. If you are still facing some issue, can you please create a jsfiddle reproducing the label clipping?
Also kindly elaborate what do you mean by total graph width.
___ Suyash Singh Team CanvasJS
Dear @Suyash Singh
Please see my two graph here: http://jsfiddle.net/mujahid_102/QwZuf/677/
problem is: 1. Please see the bars width of the first graph and bars width of the second graph. They are not same because first graph contains 4 bars and second graph contains 8 bars but I set the dataPointWidth: 20. So I want that bars width of all graphs will be same. I think there dataPointWidth property do not working. Me also cant solve the problem. please help me
@mujahid_102
dataPointWidth should be placed outside dataSeries object.
{ dataPointWidth: 20, . . data: [{ . . }] . . }
Please check the updated JSFiddle.
—– Bivek Singh Team CanvasJS
You must be logged in to reply to this topic. Login/Register