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

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 4 months ago
  • last active 4 months ago
0 votes

To whom this may concern:

I would like to create a custom data series where I can manipulate the X-Values more efficiently for a ColumnRenderableSeries, where if I remove a column from the chart or there is a gap in the data, I won’t have any spaces between any of the columns in the chart. I also haven’t found any documentation on creating a custom data series.

My approach is to treat the X values like a stack.
– If a point is appended, a value is pushed to the X values stack and the Y values list.
– If a point is to be removed using RemoveAt(), it only removes the Y-Axis value from the index and pops the X values stack so the order and spacing of the x-values remain the same.

This is similar to Microsoft Excel, where removing a data row linked to a chart deletes the X-axis value instead of leaving a gap.

My thinking is making the following derivation of XYDataSeries (in C# pseudocode):

ColumnDataSeries<TY> : XyDataSeries<int, TY> where TY : IComparable
    Stack<IComparable> XValues { get; set; }
    IList<IComparable> YValues { get; set; }

    Append (T value) 
        XValues.Push (XMax + 1);
        YValues.Add (value);

    RemoveAt (int index) 
        XValues.Pop ();
        YValues.RemoveAt (index);

Can you please advise or provide any documentation for this?

Thank you, and best regards!

— Ari

Edit: Sorry if the code doesn’t look right, I don’t know how to properly wrap C# code on the forums.
Edit 2: Second attempt at posting code. Should see the generics now.

  • Ari Sagiv asked 10 months ago
  • last active 10 months ago
0 votes

Hello everybody.

What is the best way to pass 3 y-values to single x-value?

Currently i’m using XyyDataSeries + XyDataSeries

Don’t know, if it’s best approach?

0 votes

I have created a SciChartSurface with the width of 200 px. I have created a data series with data that corresponds to four vertical lines at 0 %, 25 %, 50 % and 75 % of width. When I set the data series’ width to 115 points all four vertical lines are clearly visible. However when I set the width to 116 points or more, the first line (at x == 0) disappears. Data series is still smaller than the renderable series width in px, so there is no reason for any of the vertical lines to go missing. Is this a bug, or did I configure something wrong?

Here is the xml layout:


Here is the code for MainActivity:

import android.os.Bundle
import com.scichart.charting.model.dataSeries.UniformHeatmapDataSeries
import com.scichart.charting.visuals.SciChartSurface
import com.scichart.charting.visuals.renderableSeries.ColorMap
import com.scichart.drawing.utility.ColorUtil
import kotlin.math.roundToInt

const val WIDTH = 116
const val HEIGHT = 50

class MainActivity : AppCompatActivity()
    override fun onCreate(savedInstanceState: Bundle?)



        val chartSurface = findViewById<SciChartSurface>(
        val chartBuilder = SciChartBuilder.instance()

        val xAxis = chartBuilder.newNumericAxis().build()
        val yAxis = chartBuilder.newNumericAxis().build()

        val dataSeries = UniformHeatmapDataSeries<Int, Int, Int>(Int::class.javaObjectType, Int::class.javaObjectType, Int::class.javaObjectType, WIDTH, HEIGHT)
        for (x in 0 until WIDTH)
            for (y in 0 until HEIGHT)
                val value = when (x)
                    (0.25 * WIDTH).roundToInt(),
                    (0.5 * WIDTH).roundToInt(),
                    (0.75 * WIDTH).roundToInt() -> 50
                    else                        -> 0
                dataSeries.updateZAt(x, y, value)

        val series = chartBuilder.newUniformHeatmap()
            .withColorMap(ColorMap(intArrayOf(ColorUtil.DarkBlue, ColorUtil.CornflowerBlue, ColorUtil.DarkGreen, ColorUtil.Chartreuse, ColorUtil.Yellow, ColorUtil.Red), floatArrayOf(0f, 0.2f, 0.4f, 0.6f, 0.8f, 1f)))

        chartSurface.suspendUpdates().use {
0 votes


I have a question concerning multithreaded access to the DataSeries:

We implemented an overview for our chart as described here. This works fine when we load data, add it to the series and then display it.

Now, for a certain use case we need to display live data. We implemented this in a background thread. We noticed that after some time the application freezes when the update frequency rises. In the documentation I found this:

NOTE: Considerations when a DataSeries is shared across multiple chart surfaces. Currently only a single parent chart is tracked, so DataSeries.SuspendUpdates() where the DataSeries is shared may have unexpected results.

I guess this is what is happening here…so what is the recommended approach to achieve something like this? Do we have to add the data on the UI thread if we want to have the Overview? Here it says:

When appending Data in a background thread, you cannot share a DataSeries between more than one SciChartSurface. You can still share a DataSeries between more than one RenderableSeries.

Does that mean we should create more different RenderableSeries for the main chart surface and the overview surface that are based on the same DataSeries? Any help would be appreciated!

0 votes


Is there any way to get back the 2D data array from the Heatmap2DArrayDataSeries object?

Full of hope for positive answer,

0 votes


I wonder what the most efficient way is to completely reset (clean up) a SciChartGroup? I add all kinds of panes, add data series, add renderable series on different panes. Now, with a single call I like to reset the SciChartSurface to its original state (empty). I want to have all panes removed, as well as references the sciChartGroup may hold to panes, and references the panes hold to different renderable series and data series. I tried to clear ChartPaneViewModels, an observable collection that holds objects of type BaseChartPaneViewModel (which in turn implements IChildPane and ViewModelBase) but that did not have any effect. My SciChartGroup binds via ItemsSource to ChartPaneViewModels

What is your recommendation how to best reset the whole sciChartGroup?


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