SciChart WPF 2D Charts > ChartModifier API > Cursors, Tooltips and legends > SeriesInfo – the ViewModels for Tooltips and Legends
SeriesInfo – the ViewModels for Tooltips and Legends

The RolloverModifier and LegendModifier are simply data-sources, which give you an ObservableCollection<SeriesInfo> to bind to in XAML.

https://support.scichart.com/__swift/apps/base/javascript/__global/thirdparty/TinyMCE/plugins/moxiemanager/data/files/RolloverSeriesInfo.png

The following classes in SciChart provide a collection of SeriesInfo that you can bind to:

  • Rollovermodifier.SeriesData
  • TooltipModifier.SeriesData
  • LegendModifier.LegendData

Types of SeriesInfo

Each DataSeries has its own SeriesInfo type. All of them inherit from SeriesInfo, which is the base type. So given you are binding to a collection of SeriesInfo when you use the RolloverModifier or LegendModifier, it becomes possible to expose almost any info about the underlying RenderableSeries or DataSeries

RenderableSeries Type DataSeries Type SeriesInfo Type

FastLineRenderableSeries,

FastMountainRenderableSeries,

FastColumnRenderableSeries,

XyScatterRenderableSeries,

FastImpulseRenderableSeries

XyDataSeries XySeriesInfo

FastOhlcRenderableSeries

FastCandlestickRenderableSeries

OhlcDataSeries OhlcSeriesInfo
FastErrorBarsRenderableSeries HlcDataseries HlcSeriesInfo
FastBandRenderableSeries XyyDataSeries XyySeriesInfo
FastBubbleRenderableSeries XyzDataSeries XyzSeriesInfo
FastHeatmapRenderableSeries Heatmap2DArrayDataSeries HeatmapSeriesInfo

StackedColumnRenderableSeries,

StackedMountainRenderableSeries

XyDataSeries XyStackedSeriesInfo

StackedColumnRenderableSeries,

StackedMountainRenderableSeries
(when IsOneHundredPercent = true)

XyDataSeries OneHundredPercent
StackedSeriesInfo

 

Example of Binding to Collection of SeriesInfo

As a starting point please see our example 2D Charts > Tootips and Hit Test > Using RolloverModifier Tooltips demo, in particular the source code where we create an ItemsControl to consume SeriesInfo objects from the RolloverModifier.

NOTE: when you bind to XValue / YValue which are of type IComparable, you will need a converter or a StringFormat to convert from IComparable to the display value. Yes believe it or not, in XAML if you bind an IComparable which is actually a double to a TextBlock it won't display! Please use an IComparable converter if you get blank values when binding to these properties.

What Else can you do?

In Templating the AxisMarkerAnnotation , we bind an ItemsControl to a collection of SeriesInfo, displaying SeriesName (with Stroke foreground), XValue and YValue. These are the XValue and YValue under the mouse reported by the SeriesInfo.

Well, if you see the XySeriesInfo Members, you can bind to:

  • The RenderableSeries that owns the SeriesInfo
  • The Stroke
  • The SeriesName
  • The XValue, YValue
  • Whether the RenderableSeries IsVisible or not etc...

Other series create other SeriesInfo types, for instance, an XyzDataSeries creates an XyzSeriesInfo, and OhlcDataSeries creates OhlcSeriesInfo. Here you can access and bind to the properties such as Open, High, Low, Close or ZValue (if applicable).

Accessing the RenderableSeries via SeriesInfo

Many people ask us how to bind to a specific property on the RenderableSeries or DataSeries. Well, the SeriesInfo.RenderableSeries exposes the RenderableSeries too so it is possible to expose any property from the RenderableSeries. Don't forget RenderableSeries.DataSeries also allows access from SeriesInfo right back to the original DataSeries!