FlexChart - how to set LineMarker horizontalPosition correctly?

Posted by: metrik on 20 May 2019, 3:19 am EST

    • Post Options:
    • Link

    Posted 20 May 2019, 3:19 am EST

    Hi,

    I am trying to synchronize line markers between two charts: i.e. when user moves line marker in one chart, another chart should depict this and also move it’s line marker.

    I was able to subscribe to positionChanged event of the first chart but it returns me a Point with absolute coordinates where the mouse is. In order to set horizontalPosition in my second chart I need to somehow convert those coordinates to a value from 0 to 1 (according to documentation). How can I do this?

    Thank you and looking forward for your assistance!

    Kirill

  • Posted 20 May 2019, 10:51 pm EST

    Hi Kirill,

    We are working on this case. It requires more time to investigate because of it’s complexity.

    We will update you as we have some update for you.

    Regards,

    Manish Gupta

  • Posted 21 May 2019, 5:32 am EST

    Hi Manish,

    thank you, looking forward to your advice.

    Regards,

    Kirill Metrik

  • Posted 21 May 2019, 10:43 pm EST

    Hi Kiril,

    We could convert the x,y position to value suitable for horizontalPosition(value between 0 and 1) by subtracting plotArea’s left/top and dividing the result by the plotArea’s width/height. Please refer to the following code snippet:

    let pArea = s.chart.hostElement.querySelector('.wj-plot-area');
    let pRect = Object.assign(wijmo.getElementRect(pArea), pArea.getBBox());                    
    let hp = (e.x - pRect.left)/pRect.width,
    	vp = (e.y - pRect.top)/pRect.height;
    

    You may also refer to the attached sample which demonstrates the same.

    FlexChart_lineMarker.zip

  • Posted 22 May 2019, 12:57 am EST

    Thank you Sharad.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels