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
40
Support for selecting and highlighting chart regions
posted

We would like to adapt the xamDataChart control so that the user can highlight regions of the chart. In some kind the function is similar to the zoom / pan function, but instead of panning / zooming the selected region should be shown a little different (e.g. alpha-blended). The function should allow to select a specific region of the X-Axis, Y-Axis selection is not needed so the whole height of the plot can be used.

After looking at the source I think that re-using the zoom / pan thing would not be the best way and instead developing something new here is the better way.  My plan is:

  • Adding a path which represents the selected are
  • Registering for MouseLeftButtonDown, MouseMove and MouseLeftButtonUp which trigger the selection
  • Updating the added path upon a mouve move
  • Calling a custom event handler after the selection is finished

Now I have some questions:

  1. How do get access to the PlotAreaBorder from outside. Is the PlotAreaBackgroundContent right?
  2. How do I get the dimensions of the plot. Again: Is PlotAreaBackgroundContent right?
  3. How do I highlight the selected region afterwards. I thought about re-using the info-strips from the samples but these are in the background (meaning that the plot is in front of it). Or would I need to add a custom UI element such as a path which is used for the highlighting?

Kind regards

Parents
No Data
Reply
  • 28496
    Suggested Answer
    Offline posted

    cgrill said:
    How do get access to the PlotAreaBorder from outside. Is the PlotAreaBackgroundContent right?

    I'm not sure what you mean by PlotAreaBorder.  Do you want to apply a border brush to the PlotArea?  If so, yes, you can assign a Border element to the PlotAreaBackgroundContent.

    cgrill said:
    How do I get the dimensions of the plot. Again: Is PlotAreaBackgroundContent right?

    If you assign something to the PlotAreaBackgroundContent, its bounds should match up with the dimensions of the plot.  Or, you can use the ViewportRect property.

    cgrill said:
    How do I highlight the selected region afterwards. I thought about re-using the info-strips from the samples but these are in the background (meaning that the plot is in front of it). Or would I need to add a custom UI element such as a path which is used for the highlighting?

    There are a number of ways to do this, but I would recommend writing a custom series for this purpose.

Children