Home Forums Chart Support Fixed width between two ticks

Fixed width between two ticks

Viewing 2 posts - 1 through 2 (of 2 total)
  • #45639

    Is it possible to fix the width in pixels or centimeters between two adjacent intervals (ticks)? That is, so that the distance between two divisions is not less than the specified size. For example, if I need to display a chart in real time, and as soon as the data has accumulated for 2 hours with an interval of 5 minutes, then I begin to increase the width of the chart due to the minimum allowed distance between two intervals in pixels.

    For example, normal width https://go.screenpal.com/watch/cZjVFUVP8qZ
    It became too crowded and the chart became wider, a horizontal scroll appeared https://go.screenpal.com/watch/cZjVFvVP8q4

    #45648

    @diano4ka,

    Passing axis interval as pixel is not possible as of now. However, you can calculate the interval in pixel based on axis bounds and axis range (viewportMinimum and viewportMaximum) as shown in the code snippet below.

    chart.axisX[0].set("interval", (chart.axisX[0].viewportMaximum-chart.axisX[0].viewportMinimum)/(chart.axisX[0].bounds.x2-chart.axisX[0].bounds.x1) * intervalInPixel)

    Please take a look at this JSFiddle for an example on the same.

    Passing axis interval as pixel in Chart

    —-
    Manoj Mohan
    Team CanvasJS

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

You must be logged in to reply to this topic.