SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components

0 votes

I am creating an real-time application that handles multiple series in one surface. The series number is variant from 2 to 10. I use “RenderableSeries” then bind it to ObservableCollection. But I can not update DataSeries during run time and it throw an error? is it possible at all?

  • neda asked 1 year ago
  • last active 1 year ago
0 votes

Sorry for the simple question and please point me to the correct place if I have missed this in the docs.

I am just trying to easily bind the DataSeries of a FastLineRenderableSeries as a custom UserControl.

In my MainView I have placed the custom control:

<customUserControls:CustomLineChart x:Name="CustomLineChart1"
                                                    Grid.Row="0" />

My CustomLineChart.xaml is:

    <sci:SciChartSurface x:Name="simpleLineChart">
            <sci:FastLineRenderableSeries x:Name="lineRenderSeries"
                                          StrokeThickness="2" >

        <!--  Create an X Axis with GrowBy  -->
            <sci:NumericAxis DrawMajorBands="True"
                             GrowBy="0.1, 0.1" />

        <!--  Create a Y Axis with GrowBy. Optional bands give a cool look and feel for minimal performance impact  -->
            <sci:NumericAxis DrawMajorBands="True"
                             GrowBy="0.5, 0.5" />



I am trying to figure out how to bind the UserControl lineRenderSeries.DataSeries property in my MainViewModel

So something like this in my MainView.cs:

public partial class MainView : Window
    public MainView(MainViewModel vm, IMainFactory mainFactory)
        DataContext = vm;

        CustomLineChart1.lineRenderSeries.DataSeries = vm.SomeXyDataSeries;

Which works if the SomeXyDataSeries is set prior to this object getting created and does not update because it is not bound

Or something like this in my MainView.xaml

<customUserControls:SimpleLineChart x:Name="CoreStrategyPLGraph"
                                                    DataSeries="{Binding SomeXyDataSeries}"/>

I have just been having an issue understanding how to properly set up this binding on the UserControl.

Any input/clarification on how to do this would be great!

Thank you,

  • Leland asked 1 year ago
  • last active 1 year ago
0 votes

Hi SciChart!

I am evaluating the trial for possible use in a major project within our organisation.

We have decided to use the System.Reactive reactive extensions as our event handler and I have reached the point where I have an IObservableCollection (instantiated as ObservableCollectionExtended) of where T can be any type containing X and Y values.

My question is, is it possible to Bind a scichart Line Series on to such a collection in order to update via the reactivestream updates?

I’d rather not have to copy points into yet another collection type if possible.

Note: I looked at the nuget for scichart wpf reactive library and that seems to bind on to rx 2.2.5 whereas I’m using system.reactive 4.1.6

Any direction for a new-to-reactive developer would be greatly received.


0 votes


I am using .NET 4.0 and SciChart v4.2.6.11205.

I have a viewmodel with the following property:
public AnnotationCollection Annotations { get; set; }

I have tried binding to the Annotations property from my view with the following code but without success:
Annotations=”{Binding Annotations}”
Annotations=”{Binding Path=Annotations}”

How to I bind to an AnnotationsCollection with SciChart 4.0?

Do you have an example you can send me.


0 votes


we’ve just update scichart from ->

Since this, the renderable series is not updating when the bound property change is notified.

anybody else seen this?

            <s:XyScatterRenderableSeries DataSeries="{Binding AcceptableDataPoints}" s:TooltipModifier.TooltipTemplate="{StaticResource XyTooltipTemplate}">
                    <s:EllipsePointMarker Width="9" Height="9"  Fill="#AAFFFFFF" Stroke="SteelBlue" StrokeThickness="2" ></s:EllipsePointMarker>
0 votes

I am trying to bind from my ViewModel to the DataSeries of a ScatterRenderableSeries3D, but no data is showing.

I am binding in this way:

My ViewModel has a property of type ObservableCollection<XyzDataSeries3D<DateTime, double, int>>. I can populate ChartItems, and see the data in it. The property is being notified of change as expected.

If I populate the DataSeries directly from code behind, it works, but not when being bound.

What am I doing wrong?

0 votes

I have implemented two custom themes for use when viewing charts on screen versus printing. Unfortunately, the themes do not contain all necessary color definitions. For example, these are multi-series charts, with each series having a different color. Is there any way to extend the ThemeManager to include these additional required brushes (and of course, be able to bind to those colors from XAML).

Alternatively, if there is a way to bind to existing ThemeManager colors from XAML, i could simply use several existing but otherwise unused ThemeManager brushes for my various series stroke brushes.


0 votes

I did modify this CustomAnnotationChartModifier. I added a databinding to bing the ShowLabelProperty to the IsSelectedProperty.

    // Recreate all annotations, called when LabelsSource property changes or when the
    // CustomAnnotationChartModifier is attached to the parent surface
    private void RebuildAnnotations() {
        if (base.ParentSurface == null || LabelsSource == null)
        var annotationCollection = base.ParentSurface.Annotations;
        foreach (var item in LabelsSource) {
            var vla = new VerticalLineAnnotation();
            vla.DataContext = item;
            vla.SetBinding(AnnotationBase.X1Property, new Binding("X1") { Mode = BindingMode.OneWay });
            // bind ShowLabelProperty
                new Binding("IsSelected") { RelativeSource = RelativeSource.Self, Mode=BindingMode.OneWay });
            vla.IsEditable = this.IsEditable;
            // after manipulation: write X1Property back to Viewmodel 
            vla.DragEnded += Annotation_DragEnded;
            vla.LabelPlacement = LabelPlacement.Top;
            // test to set directly ShowLabel = (bool)e.NewValue;
            //vla.Unselected += annotation_SelectionChanged;
            //vla.Selected += annotation_SelectionChanged; 
            if (this.MarkerManipulatedCommand != null)
                vla.ManipulationCompleted += new EventHandler<ManipulationCompletedEventArgs>(manipulationCompleted_EventHandler);

    private void annotation_SelectionChanged(object sender, EventArgs e) {
        var vla = sender as VerticalLineAnnotation;
        if (vla == null) return;
        vla.ShowLabel =vla.IsSelected;

Result: Select the annoation will show the label. Unselect will not remove the label.
I did try the unselected and selected-event to do the same on other way ->same result.
I can see also that each new selection lighter the label (is it shown more than one time?).

How can I add ToolTipLabel inside that CustomAnnotationChartModifier to see the y-values?


1 vote

I want to put multiple Line Charts on a standard WPF TabControl. One Chart per tab.
Each tab should show a different chart with, in general, a different range on its X axis.
After a chart on a tab has been panned or zoomed, then after switching to another tab and then returning to the original tab, then the original X axis values should be preserved.
My problem is that I end up with a behaviour that looks like all the charts share one X axis.

So my question is how can I achieve the desired behaviour?
I did try databinding XAxis and, later, XAxes, but I ended up with the same behaviour.
Thanks in advance to anyone that can help me out with this.

Here is the briefest example I could construct that displays the problem.
It simply displays 3 tabs with different ranges of X values and AutoRange set to “Once”.
When it runs, all 3 charts are displayed with the same X axis range which is only correctly autoranged for the first tab.
The attached images are screenshots of the three tabs.

Here is my XAML:

    xmlns:local="clr-namespace:SciTest" xmlns:s="" x:Class="SciTest.MainWindow"
    Title="MainWindow" Height="300  " Width="500">

    <TabControl ItemsSource="{Binding}">
            <!--This dictates what goes in the Tab header-->
                <TextBlock Text="{Binding Title}" />
            <!--This dictates what goes in the tab page-->
                <s:SciChartSurface RenderableSeries="{Binding RSeries}">
                        <s:NumericAxis AutoRange="Always"/>

And here is the code-behind for the Data Context

    class RSeriesSource
    public String Title { get; set; }
    public ObservableCollection<IRenderableSeries> RSeries{get;set;}
    static Random rnd = new Random(); //for generating example data
    public RSeriesSource()
        RSeries = new ObservableCollection<IRenderableSeries>();
    public static RSeriesSource Example(int n)
        RSeriesSource res = new RSeriesSource();
        res.Title = "S" + n.ToString();
        return res;

    FastLineRenderableSeries AddRS(int offset)
        XyDataSeries<Double, Double> Series = new XyDataSeries<Double, Double>();
        for (int ix = 0; ix < 10; ix++)
            Series.Append(offset * 5 + ix, offset + rnd.NextDouble());
        FastLineRenderableSeries res = new FastLineRenderableSeries();
        res.DataSeries = Series;
        //if (yAx != null)
        //    res.YAxisId = yAx.Id; //Use the Id NOT the axis
        return res;

class RSeriesSourceList : ObservableCollection<RSeriesSource>
    public RSeriesSourceList()
        for (int i = 0; i < 3; i++)
            Add( RSeriesSource.Example(i));
0 votes

I have the following xaml code for HorizontalLineAnnotations. I have a viewmodel with simple properties for WasteMaxValue etc.
I don’t get any binding errors. Sometimes everything works as expected when I start up. Sometimes the lines show up but they wont follow when I resize the view (and the graph). Sometimes the lines don’t show up at all.
If I do a very fast “pan” with the mouse so that the graph data moves outside the graph, the lines show up and they follow when I resize the view and the graph. Have you experienced this before? Is it an obvious error?

                <s:HorizontalLineAnnotation HorizontalAlignment="Stretch" 
                    Y1="{Binding WasteMaxValue}" Stroke="Red" StrokeThickness="2">
                <s:HorizontalLineAnnotation HorizontalAlignment="Stretch" 
                    Y1="{Binding WasteMinValue}" Stroke="Red" StrokeThickness="2">
                <s:HorizontalLineAnnotation HorizontalAlignment="Stretch" 
                    Y1="{Binding WarningMaxValue}" Stroke="Yellow" StrokeThickness="2">
                <s:HorizontalLineAnnotation HorizontalAlignment="Stretch" 
                    Y1="{Binding WarningMinValue}" Stroke="Yellow" StrokeThickness="2">
                <s:HorizontalLineAnnotation HorizontalAlignment="Stretch" 
                    Y1="{Binding SetValue}" Stroke="Green" StrokeThickness="2">
0 votes

I would like a “Pause” button on my chart to temporarily suspend drawing updates, even while realtime data updates are still coming in to the databound DataSeries. Pressing the button again would re-enable drawing updates and show the data lines updated with all the data collected while drawing was previously paused.

Is there anything in the SciChart API to do this easily or would I need to do this manually (possibly by cloning the DataSeries when the chart is paused and databinding to the clones, then restoring the original binding when un-paused)?


0 votes

I am directly editing my XyDataSeries on a chart by using my mouse. As the mouse moves I edit either the x or y value of a point using the methods

    public void SetPointYValueAt(IDataSeries series, int index, double newValue)
        series.YValues[index] = newValue;

    public void SetPointXValueAt(IDataSeries series, int index, double newValue, double xMin, double xMax)
        var xValue = newValue;

        // limit x values to keep them sorted
        if (xValue < xMin) xValue = xMin;
        if (xValue > xMax) xValue = xMax;
        series.XValues[index] = xValue;


With this code I am not getting an update at my ViewModel:

    public IDataSeries<double, double> MyDataSeries
        get { return _myDataSeries; }
            _myDataSeries = value;

Here is my XAML:

            <sciChartExtensions:StepLineRenderableSeries x:Name="HResitivitySeries" IsDigitalLine="True" DataSeries="{Binding MyDataSeries, Mode=TwoWay}">

Where StepLineRenderableSeries is derived from FastLineRenderableSeries with IsDigitalLine = true and the HitTest method overridden.

How can I get MyDataSeries to update?

1 vote


I have a surface with multiple dataseries in it. I have a legend for each serie, setup like this:

chart.ChartModifier = new Abt.Controls.SciChart.ChartModifiers.LegendModifier() { Name = "legendModifier" };

var legend = new Abt.Controls.SciChart.Visuals.SciChartLegend { Margin = new Thickness(5) };

// Bind the legend to the data source
var legendDataBinding = new Binding("LegendData") { Source = chart.ChartModifier };
legend.SetBinding(Abt.Controls.SciChart.Visuals.SciChartLegend.LegendDataProperty, legendDataBinding);

And it works fine.
However, I would also like to bind the visibility of the legends to the visibility of the dataseries. I have tried this:

// Bind the legend visibility to the data source
var legendVisibilityBinding = new Binding("Visibility") 
    Converter = new BoolToVisibilityConverter(),
    Source = line.IsVisible
legend.SetBinding(Abt.Controls.SciChart.Visuals.SciChartLegend.LegendDataProperty, legendVisibilityBinding);

But it doesn’t seem to work, any suggestions, anyone?


  • JacobB asked 7 years ago
  • last active 7 years ago
Showing 13 results
This template supports the sidebar's widgets. Add one or use Full Width layout.