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



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.