Pre loader

All the 2D Line Charts on a TabControl seem to share one axis between all tabs.

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums


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));
  • You must to post comments

Hi Tony,

Is this related to this known issue with WPF TabControl Virtualization?

Best regards,

  • Tony_at_DataH
    Yes that was it. Is killing the TabControl virtualisation the recommended workaround? With simpler controls, the theory is that by judicious use of databinding the correct behaviour can be obtained. For instance, if you put a text box on a tab control then as long as the contents is databound then of course the text will persist when you move between tabs. Is there no a way to data bind the axis or visible range or something and so achieve persistence by the same means? Or am I setting off into the tar pit by even attempting that? Thanks.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.