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
    http://jsfiddle.net/1aqv7do2/

    Thanks
    JE

    #34557

    @jeffe,

    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: {
       "valueFormatString":null,
       "title":"Date", 
       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.