Pre loader

Dynamic Series addition with respective X and Y Axes

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 am creating a chart which should add a series with its respective X and Y axes on a button click.

I am adding axes as follows:

private void AddYAxis(List<double> yValues)
        var yAxis = new NumericAxis()
            AxisAlignment = AxisAlignment.Left,
            AxisTitle = "Number of Samples (per Series)",
            Id = "first"

private void AddXAxis(List<DateTime> xValues)
        var xAxis = new DateTimeAxis()
            TextFormatting = "YYYY-MM-DD HH:mm:ss",
            AxisAlignment = AxisAlignment.Bottom,
            AxisTitle = "Bottom Axis",
            Id = "first"

Then, I am adding the renderable series:

 private void AddSeriesClick(List<DateTime> xValues, List<double> yValues)
        var dataSeries = new XyDataSeries<DateTime, double>();
        dataSeries.Append(xValues, yValues);

        var renderSeries = new FastLineRenderableSeries
            Stroke = Color.FromArgb(0xFF, 0x40, 0x83, 0xB7),
            DataSeries = dataSeries,
            StrokeThickness = 2,
        renderSeries.XAxis = sciChart.XAxes.GetAxisById("first");
        renderSeries.YAxis = sciChart.YAxes.GetAxisById("first");

But, I am only able to see the Axis titles and nothing else is rendered in the chart.

Following exception is thrown:

SciChartSurface didn’t render, because an exception was thrown:
Message: AxisCollection.GetAxisById(‘DefaultAxisId’) returned no axis with ID=DefaultAxisId. Please check you have added an axis with this Id to the AxisCollection

Stack Trace: at SciChart.Charting.Model.AxisCollection.GetAxisById(String axisId, Boolean assertAxisExists)
at A.IJ.DB(AxisCollection D, IRenderableSeries I, RenderPassInfo J, IPointResamplerFactory M, IDataSeries& O, IndexRange& S, IPointSeries& T, Int32& AB)
at A.IJ.S(ISciChartSurface D, Size I)
at A.IJ.RenderLoop(IRenderContext2D renderContext)
at SciChart.Charting.Visuals.SciChartSurface.DoDrawingLoop()

The program ‘[17304] SciChart_MultipleXAxis.exe’ has exited with code 0 (0x0).

Can you kindly look into it.

  • You must to post comments

Hi Pradnya,

Did you figure it out? I saw that the questoin was marked as closed.

The answer to the question is: do not set RenderableSeries.XAxis or RenderableSeries.YAxis (these are set internally by ScIChart), but isntead please set RenderableSeries.XAxisId and RenderableSeries.YAxisId to match the Id of the X,Y axis you want to measure that series by.

For more information about multiple axis charts, please see our Multiple Axis tutorial.

Best regards

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.