Home Forums Chart Support XAsis shows dates not in the datapoints

XAsis shows dates not in the datapoints

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

    I created a chart with data points of June 1 -3, and June 7-8. But when the chart renders, it also shows dates of June 4, 5, and 6. I don’t want those dates to show, the chart should plot from June 3 and the next datapoint should show for June 7. Instead, it shows a long line from June 4 spanning the next 3 days until the 7th. How do I get it to not show dates in the X axis that aren’t in the data?

    Example at




    When the x-values passed are date-time, labels will be rendered at every interval based on the value of intervalType.

    For example: if interval is 1 and intervalType is ‘month’ – labels will be shown at every 1 month. Since the axis behaves linearly across the date range it won’t skip months for which there are no dataPoints.

    In your case, since you are trying to display axis label for only dataPoint you can use label instead of x.

    Alternatively, you can use scaleBreaks to remove the unnecessary region on x-axis as shown in the code snippet below –

    axisX: {
       scaleBreaks: {
         autoCalculate: true,
         collapsibleThreshold: "15%", 
         lineThickness: 0,
         spacing: 0

    Please take a look at this updated JSFiddle for an example on removing unnecessary region on x-axis using scaleBreak.

    Chart with scaleBreak

    Indranil Deo
    Team CanvasJS

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

You must be logged in to reply to this topic.