Home Forums Chart Support Extra spaces in dateTime axis

Extra spaces in dateTime axis

Viewing 6 posts - 1 through 6 (of 6 total)
  • #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
    https://canvasjs.com/docs/charts/basics-of-creating-html5-chart/date-time-axis/

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

    #21367

    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

    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

    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.