Home Forums Chart Support Get coordinates of a point

Get coordinates of a point

Viewing 12 posts - 1 through 12 (of 12 total)
  • #15395

    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

    @emeric,

    To know pixel coordinate of a dataPoint you can use convertValueToPixel method.
    Converting Value to Pixel Coordinate


    Sanjoy Debnath
    Team CanvasJS

    • This reply was modified 6 years, 9 months ago by Sanjoy.
    • This reply was modified 3 years ago by Vishwas R.
    #15429

    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

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

    #15433

    @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.
    Enable Disable Grids in Y Axis

    —-
    Bivek Singh,
    Team CanvasJS

    #15441

    Amazing, thank you a lot !

    #15613

    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

    Emeric,

    Yes, that’s correct.

    —-
    Bivek Singh,
    Team CanvasJS

    #17518

    Hello,
    Is there any way to get co-ordinates of intersecting lines atx and y axis in mutliline spline chart?

    • This reply was modified 6 years, 5 months ago by jigisha.
    #17524

    Jigisha,

    Sorry, this feature is not available as of now.


    Sanjoy Debnath,
    Team CanvasJS

    #17525

    Thanks for the reply….
    Than any of the graph tool available or you know which provides this? or do you have any idea how to achieve this?

    Please let me know its very important for me to do ASAP.

    Thank you
    Jigisha

    #17544

    Jigisa,

    You can find out the intersection points of the curves by solving the original equations of the curves intersecting each other. This will give you accurate result.

    Many curve can pass through finite number of discontinuous dataPoints. CanvasJS uses approximate Bézier curve interpolation, to represent the curve passing through user given dataPoints. So, it’s almost impossible to construct an unique equation passing through the sample dataPoints and find intersection between two spline curve.

    However, there is a workaround using Image processing and convertPixelToValue method (given in API). But this will only give you an approximate Intersecting coordinate of the curves.


    Sanjoy Debnath
    Team CanvasJS

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

You must be logged in to reply to this topic.