Home forums Using CanvasJS Losing my xAxis labels


This topic contains 2 replies, has 2 voices, and was last updated by  Kathy 2 years ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #15935


    We had (with your help) dateTimeFormatter() working with rangeChanging to modify the format of xAxis labels based on zoom level.

    Client then insisted on setting interval and intervalType during initial load of chart based on the number of years.

    axisXOption{} is set at highest scope. Then when chart is drawn by drawchart() I have now added

    if (years == 0) {
    	axisXOption.intervalType = 'year';
    	axisXOption.interval = 3;
    } else if (years == 1 || years == 2) {
    	axisXOption.intervalType = 'month';
    	axisXOption.interval = 1;
    } else if (years == 3) {
    	axisXOption.intervalType = "month";
    	axisXOption.interval = 3;
    } else if (years == 5) {
    	axisXOption.intervalType = "month";
    	axisXOption.interval = 6;

    That does set up the initial labels as required. However now when zoom occurs the xAxis labels and gridlines are removed.

    The issue can be seen here in this JSFiddle.

    Can you help me see why that occurs?

    Thank you!!



    On calling the rangeChanging event handler mention the intervalType and interval in each of the individual conditions.

    Please take a look at this solution.

    Indranil Deo,
    Team CanvasJS


    Thank you! I had tried that but I guess I must have done it incorrectly. Very much appreciate your help!!

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

You must be logged in to reply to this topic.