Home forums Using CanvasJS Losing my xAxis labels

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  Kathy 3 weeks, 1 day ago.

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

    Kathy
    Member

    Hello,

    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!!

    #15947

    Indranil Deo
    Member

    Kathy,

    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

    • This reply was modified 3 weeks, 1 day ago by  Indranil Deo.
    • This reply was modified 3 weeks, 1 day ago by  Indranil Deo.
    #15953

    Kathy
    Member

    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.