Home forums Using CanvasJS Get coordinates of a point

This topic contains 7 replies, has 3 voices, and was last updated by  Bivek Singh 4 weeks ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #15395

    Emeric
    Member

    Hello,

    I know it’s possible to get coordinates of markers using it: chart.axisX[0].stripLines[0].get(“bounds”).x1
    But is it possible to get coordinates of points in my graph ?

    Thank you in advance !

    #15410

    Sanjoy
    Moderator

    To know pixel coordinate of a dataPoint you can use convertValueToPixel method.

    Sanjoy Debnath
    Team CanvasJS

    • This reply was modified 1 month, 3 weeks ago by  Sanjoy.
    #15429

    Emeric
    Member

    Thank you !

    And is it possible to create a stripLine dynamically ?
    For example I have a graph and when I click on a button, it will add a new StripLine.

    Same question for grid, is it possible ?

    #15430

    Emeric
    Member

    Example for the grid: When I click on a button, the grid appears/disappears

    #15433

    Bivek Singh
    Moderator

    @emeric

    You can use addTo method to dynamically set stripline. For toggling the visibility of grid lines, you can set it’s thickness value. Please, take a look at this jsFiddle.

    —-
    Bivek Singh,
    team CanvasJS

    #15441

    Emeric
    Member

    Amazing, thank you a lot !

    #15613

    Emeric
    Member

    Hello,

    I have another question about coordinates:
    Is it possible to get coordinates of axis X and Y ?

    If I understood convertValueToPixel right, I have for example this data: [[0,12],[10,66],[20,42]]
    And in order to get coordinates of [10,66], I need to write:
    chart.axisX[0].convertValueToPixel(10) and chart.axisY[0].convertValueToPixel(66) ? Is that correct ?

    Then if that’s right I just have to write chart.axisX[0].convertValueToPixel(0) and chart.axisY[0].convertValueToPixel(0) to get the coordinate of axis X?

    Thank you.

    Regards.

    #15615

    Bivek Singh
    Moderator

    Emeric,

    Yes, that’s correct.

    —-
    Bivek Singh,
    Team CanvasJS

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

You must be logged in to reply to this topic.