Home forums Using CanvasJS Major and Minor Ticks / Gridlines

This topic contains 5 replies, has 2 voices, and was last updated by  Duivleo 3 weeks, 6 days ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #27109

    Is it possible to make major and/or minor Ticks and / Gridlines. (Similar to Excel)?

    Regards,
    Leo

    #27113

    Leo,

    You can add stripLines to achieve minor grids as shown in this JSFiddle.


    Vishwas R

    #27121

    Thank you Vishwas,

    Your solution did work. I have applied to the Y-axis of my chart and it works fine.
    (My Y-axis is numeric.)
    I have tried it on the X=axis as well, but that did’t work.
    X-axis is a dateTime=scale. (intervalType = “hour” and interval is 24.)
    I want to get a minorgridline every 6th hour.

    Is that possible?

    Regards,
    Leo

    #27122

    Addition to previous message:
    I found part of the solution: The minorGridInterval should be set at 21600000, which is 3600 x 6 x 1000.

    Now I still have find a way how to let the minorGrid fall over the majorgrid. This is due to the fact that I calculate the start (minimum) as being “new Date() – 86400000 x 14” (14 is for last 14 days.)

    Regards,
    Leo

    • This reply was modified 1 month ago by  Duivleo.
    #27132

    Leo,

    You can add minor-grids to axisX, when axisX is of date-time type, as shown in this JSFiddle.


    Vishwas R
    Team CanvasJS

    #27160

    Thanks Vishwas,

    Your method is much more elegant than what I had.

    Regards,
    Leo

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

You must be logged in to reply to this topic.