Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
20
draw visual elements
posted

Dear support,

is possibile draw a polygon, polyline, rectangle, triangle over chart using x/y scale?

Parents
No Data
Reply
  • 34430
    Offline posted

    Hello Walter,

    It is possible to draw elements on the XamDataChart, as each of the series and axes of the chart expose a RootCanvas property that returns the Canvas that that particular series or axis uses to draw. You can obtain this Canvas and add your elements to the Children collection programmatically. You can determine where to place your elements by using the ScaleValue properties of your axes which scales a particular value from axis space to screen space, and so you can use the Canvas.SetTop/SetLeft/etc. methods to set where you wish your element to show on the chart.

    Where this becomes interesting is when you want to go to resize or zoom the XamDataChart, as you will need to maintain the Canvas position of your elements. I would recommend using the XamDataChart's RefreshCompleted event for this, as this event fires for when the XamDataChart needs to redraw on zoom or resize, and it will allow you to re-position your elements in the chart.

    I have attached a sample project to demonstrate the above. I hope this helps you.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer

    XamDataChartShapesCase.zip
Children
No Data