Home forums Using CanvasJS Define the pitch/step of the chart

This topic contains 4 replies, has 2 voices, and was last updated by  Bivek Singh 3 weeks, 2 days ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #15673

    Emeric
    Member

    Hello,

    I would like to know; is it possible to define/modify the pitch/step between all points of my chart (axisX) ?
    Example:
    My chart is defined with a 800px width. We’ll see the data from 0px to 800px (all over the chart): the step is defined automatically in order to see all the chart. Is there a way to change that in order to control this step between points ?

    Thank you in advance !

    Regards.

    #15674

    Emeric
    Member

    Second question:
    The width of the chart is the width of all the chart, is there a way to control the width of the chart with data (from the first point to the last point) only (without titles…) ?

    • This reply was modified 3 weeks, 6 days ago by  Emeric.
    #15692

    Bivek Singh
    Moderator

    @emeric,

    For your first query, you can set interval.

    Regarding the second query, can you kindly provide a pictorial representation so that we can understand your requirements better and help you out?

    —-
    Bivek Singh,
    Team CanvasJS

    #15693

    Emeric
    Member

    Hello,

    Interval isn’t what I need.
    Here a representation about step/pitch/interval between points:

    Is it possible to change this value ? At this moment this value is defined automatically based on the number of data: more you have points, less this value is important.
    In my example we can consider the step is 50px (for example), if I add data, this step will change and will be less than 50px. I would like to control this step in order to say to the chart “whatever the number of data the step will be the same”. Is it possible ?
    I know maximum exists (https://canvasjs.com/docs/charts/chart-options/axisx/maximum/) it will fix the step by locking the axis, but it’s not exactly what I’m looking for !

    Second question:
    When you define the width of the chart like that:
    <div id="chartContainer" style="height: 400px; width: 800px;"></div>
    800px will be the width of everything and not only the points.
    Representation:

    Thank you for your help !

    • This reply was modified 3 weeks, 5 days ago by  Emeric.
    #15713

    Bivek Singh
    Moderator

    @emeric,

    You can achieve the desired width between dataPoint by setting viewportMinimum and viewportMaximum.

    For your second query, you can find the pixel co-ordinates of first and last dataPoint using convertValueToPixel. Please, take a look at this jsFiddle.

    —-
    Bivek Singh,
    Team CanvasJS

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

You must be logged in to reply to this topic.