Home forums Using CanvasJS How to manage graph size

This topic contains 3 replies, has 3 voices, and was last updated by  Bivek Singh 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #14872

    mujahid_102
    Member

    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.

    #14875

    Suyash Singh
    Moderator

    @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 :
    <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

    #14877

    mujahid_102
    Member

    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

    #14880

    Bivek Singh
    Moderator

    @mujahid_102

    dataPointWidth should be placed outside dataSeries object. Please check the updated jsFiddle.

    —–
    Bivek Singh

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

You must be logged in to reply to this topic.