1

I'm using SciChart to plot measurement results in an interactive line graph. The user needs to be able to select certain ranges which are used to perform further analysis. The parts that are selected need to be visually highlighted. The ranges also need to be directly editable from a table.

I've considered the following options:

  1. using direct data bindings on the X property of a VerticalLineAnnotationViewModel using the new MVVM API. This seems to work fine. I can move the vertical lines, and the table is updated accordingly, and vice versa. But how can I draw the highlighting between two vertical lines, also using data binding? I guess the highlighting should be something like a BoxAnnotation with an opaque background. I can't use an extra Annotions property on the SciChartSurface. How can I add an extra binding to draw the highlighting, while still maintaining the direct data bindings for the vertical lines in the graph and table?

  2. using direct data bindings on a BoxAnnotationViewModel using the new MVVM API. I bind the start and end of a range to the X1 and X2 property. Y1 and Y2 are set to an arbitrary value outside the regular Y-range. This seems to work fine, however, I can only drag the rectangles, I can't make them wider. How can I allow the rectangles to be resized in the X-direction only, and preferably also disable dragging functionality?

Here is an example of the functionality I would like to achieve.1

If there are other options to obtain a similar functionality, please let me know.

Erik
  • 11
  • 3

1 Answers1

0

There is an example of how to use the CompositeAnnotation API in SciChart WPF charts to create a Range Annotation - composed of a BoxAnnotation for the background, and two Line Annotations for the left and right edge.

The example source code is here

The annotation is draggable, resizable and can be created in the Viewmodel for true MVVM approach.

enter image description here

Using the CompositeAnnotation API any combination of annotations can be applied to the chart to create complex shapes or drawings which are optionally editable / draggable.

Dr. Andrew Burnett-Thompson
  • 20,980
  • 8
  • 88
  • 178