Home forums Using CanvasJS Button to zoom

This topic contains 2 replies, has 2 voices, and was last updated by  Emeric 2 weeks ago.

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

    Emeric
    Member

    Hello,

    I’m using CanvasJS since few weeks and I have a question about zoom.
    I saw we can zoom easily by drag & drop but I would like to create a button to zoom (by click).
    Example: I have a button “x2” and when i click on it it zooms x2 on my graph (no drag & drop, just a click).
    I searched a lot and i found nothing.

    Thank you in advance !
    (Sorry my english isn’t perfect !)

    #15312

    Vishwas R
    Keymaster

    Emeric,

    To zoom into certain region, you need to change viewportMinimum and viewportMaximum. If you like to set viewportMinimum and viewportMaximum to certain region after clicking the button, you can achieve as shown in this jsfiddle.

    Also take a look at this jsfiddle, where viewportMinimum and viewportMaximum are changed based on dropdown options.


    Vishwas R
    Team CanvasJS

    #15313

    Emeric
    Member

    Thank you a lot that’s it !

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

You must be logged in to reply to this topic.