Home forums Using CanvasJS Extra spaces in dateTime axis

This topic contains 5 replies, has 2 voices, and was last updated by  Priyanka M S 2 months, 2 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #21366

    Why is there extra spacing on the left and right of the chart in the fiddle below (30 min on left and right)
    https://jsfiddle.net/QwZuf/1499/
    but not in the chart in this link

    Date & Time Axis

    I have just replaced new Date(2012, 01, 1) with time stamp new Date(1529260200000)

    #21367

    Priyanka M S
    Member

    Himanshu,

    In the fiddle you have provided, the spacing on left and right of chart is because of the x values you provide to axisX. By setting appropriate minimum and maximum values, you can reduce the spacing. Please take a look at this updated jsfiddle.

    __
    Priyanka M S
    Team CanvasJS

    #21376

    The left x value given is that of 12 am, but the chart always starts from 11:30 no matter what the width of the chart is.
    In the date time example on your site there is no minimum and maximum value given and still there is no extra space.

    #21383

    Priyanka M S
    Member

    Himanshu,

    Axis minimum and maximum depends on the first data point value, last data point value and the interval. Hence, spacing to the left and right of chart will be calculated based on the axis minimum, maximum and interval.

    The left x value given is that of 12 am, but the chart always starts from 11:30 no matter what the width of the chart is.

    Axis X is a time scale and dataPoints are placed on the scale based on it’s values.

    __
    Priyanka M S
    Team CanvasJS

    #21387

    In both the cases I sent (fiddle and your website code example), there is no set interval. Both only contain the data entries, then why does the spacing change. If it is because of the interval, then shouldn’t the interval be shown within the data range and not outside it?

    #21398

    Priyanka M S
    Member

    himanshu,

    If interval is not set, it gets automatically calculated based on the values of dataPoints. The spacing is different because the dataPoint x-values in both the examples(your fiddle and CanvasJS website) are different. The minimum, maximum and interval is calculated based on the dataPoints you provide and spacing is calculated accordingly.

    __
    Priyanka M S
    Team CanvasJS

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

You must be logged in to reply to this topic.