Home Forums Feature Requests & Feedback Ability to specify starting label on x-axis

Ability to specify starting label on x-axis

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

    Hi team,

    We would love to have the ability to specify starting label on x-axis.

    CanvasJS has the ability to calculate the min/max of the x values given a data series, and based on the range it calculates the correct interval and put the labels on axis automatically, however some times it can be a little bit misleading especially when dealing with time series data (x-values for datapoints are Date objects).

    For example, when CanvasJS decided to print the first label using date “2020-04-30T23:30:00+09:30” but my first data is “2020-05-01T00:00:00+09:30”, it would’ve been fine if both label and tooltip are showing the full timestamp, however in our situation we are displaying date data, therefore the label shows “2020-04-30” and tooltip for first data is “2020-05-01”, and because the 2 date objects only differ by 30 mins, it would appear as if the data point was placed incorrectly on the chart.

    If we have the ability to specify the date (or value) where canvasJS uses to draw the first label, problem can be solved gracefully but putting “2020-05-01T00:00:00+09:30” as the date canvasJS uses to draw its first label on x-axis.

    Hope the above scenario makes sense.

    Look forward to hearing from the team.

    Thank you Indranil for the help.

    #37037

    Charles,

    Thanks for your valuable feedback. It’s not possible to control first & last label in axis as of now. We will reconsider this behavior for future versions. Meanwhile, you can workaround this by removing all axis labels & use striplines to show labels from viewportMinimum to viewportMaximum. Please take look at this JSFiddle for an example on the same.

    Add Axis Labels using Striplines


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.