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
120
Highlight a range
posted

Hello,

I want to highlight a range in x and y direction for good values. if a value is between x[-20;20] and y[-15;15] it should be easily to see that the value is good.

Like in the picture i attached. 

Is it possible to draw a rectangle on the canvas that works with zoom? Any other Solutions? Something like the ValueOverlay for a range.

Serencely,

Parents
No Data
Reply
  • 34430
    Verified Answer
    Offline posted

    Hello ScheugenpflugAG,

    There does not currently exist a built-in way to draw a Rectangle to your canvas that works with zoom, although you can do this by maintaining your Rectangle's positions by handling the RefreshCompleted event of the XamDataChart. This event fires whenever the chart redraws, which happens on zoom, pan, and resize.

    Using the ScaleValue methods of the X and Y axes of your chart can help you to find the absolute point for the top-left and the bottom-right of your Rectangle. At this point, you can use the attached Canvas.SetTop and Canvas.SetLeft methods to set the top left of your Rectangle to the absolute point's top-left. Then, the Height and Width of the Rectangle will be the bottomRight minus the topLeft for the two directions. Adding this to the RootCanvas.Children collection of one of your axes will get it to show up behind your actual Series elements. After the Rectangle is added, you simply need to get it from the RootCanvas.Children collection and maintain its Height/Width and Canvas.Top/Left.

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

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

    Sincerely,
    Andrew
    Associate Developer

    XamDataChartGoodRectangleDemo.zip
Children
No Data