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

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy. We also have a tag=SciChart on where you can earn rep for your questions!

Please note: SciChart team will only answer questions from customers with active support subscriptions. Expired support questions will be ignored. If your support status shows incorrectly, contact us and we will be glad to help.


Hello all,

I have made a custom RenderableSeries, but after adding the series to my ChartSeries, it shows the seriesName in the legend (as desired), but it does not show the Stroke color I assigned to this. It does however, show the stroke color in the legend for the default RenderableSeries.

Could someone please help me out? Thanks in advance!

Custom RenderableSeries sourcecode:

    class TheoreticDistanceBetweenTracksRenderableSeries : FastImpulseRenderableSeries
    protected override void InternalDraw(IRenderContext2D renderContext, IRenderPassData renderPassData)
        if (!(renderPassData.PointSeries is Point2DSeries dataPointSeries)) return;

        var pointSeries = CurrentRenderPassData.PointSeries;

        for (var i = 0; i < dataPointSeries.Count; i++)
            var index = dataPointSeries.Indexes[i];

            var metadata = (DistanceBetweenTracksMetaData)(DataSeries.HasMetadata ? DataSeries.Metadata[index] : null);
            if (metadata == null) continue;

            var point = pointSeries[i];

            if (double.IsNaN(point.Y))

            var x1 = (float)renderPassData.XCoordinateCalculator.GetCoordinate(metadata.MeasureFrom);
            var x2 = (float)renderPassData.XCoordinateCalculator.GetCoordinate(metadata.MeasureTo);

            var y1 = (float)renderPassData.YCoordinateCalculator.GetCoordinate(metadata.MinimumDistance);
            var y2 = (float)renderPassData.YCoordinateCalculator.GetCoordinate(metadata.MinimumDistance);

            DrawLine(renderContext, x1, x2, y1, y2);


    private void DrawLine(IRenderContext2D renderContext, double x1, double x2, double y1, double y2)
        using (var pen = renderContext.CreatePen(Stroke, false, 3f, Opacity, null, PenLineCap.Flat))
            var drawingHelper =
                SeriesDrawingHelpersFactory.GetSeriesDrawingHelper(renderContext, CurrentRenderPassData);

            var pt1 = TransformPoint(new Point(x1, y1), false);
            var pt2 = TransformPoint(new Point(x2, y2), false);

            drawingHelper.DrawLine(pt1, pt2, pen);

the RenderableSeries is then initiated trough a method:

        private TheoreticDistanceBetweenTracksRenderableSeries CreateTheoreticDistanceSerieMinimum(XyDataSeries<double, double> dataSeries, string title)
        var renderableSeries = new TheoreticDistanceBetweenTracksRenderableSeries
            Tag = title,
            DataSeries = dataSeries,
            DrawNaNAs = LineDrawMode.Gaps,
            Stroke = (Color)Application.Current.TryFindResource("MeasurementColor1"),
            StrokeThickness = 2,
            IsSelected = true,
            YAxisId = "MainSeriesYAxis"

        TooltipModifier.SetIncludeSeries(renderableSeries, true);

        return renderableSeries;

and this method is invoked here:

var dataSerieMinimum = new XyDataSeries<double, double>
            SeriesName = Properties.Resources.TDBT_Minimum,
            AcceptsUnsortedData = false
        dataSerieMinimum.Append(xData, yData, pointMetaDatas);

        chartSeriesViewModels.Add(new ChartSeriesViewModel(dataSerieMinimum, CreateTheoreticDistanceSerieMinimum(dataSerieMinimum, ChartTitleFactory.GetTitle(chartViewModel.ChartType))));

Could anyone help me out? Thank you!

  • You must to post comments
Great Answer

Hi Yves,

You need to set a LegendMarkerTemplate on the custom series.

This is covered in our [Custom RenderableSeries Example here:][1]

The code is as follows:

    <local:SplineLineRenderableSeries x:Name="SplineRenderSeries" Stroke="DarkGreen" StrokeThickness="2"  
                                              IsSplineEnabled="True" UpSampleFactor="10">

                <!-- LegendMarkerTemplate is required to show a marker in the legend next to SeriesName -->
                        <Line VerticalAlignment="Center" Stretch="Fill" Stroke="DarkGreen"
                                StrokeThickness="2" X1="0" X2="1" Y1="0.5" Y2="0.5" />



This template is then rendered in the legend.

Let me know if it helps!

Best regards,

  • Yves Van Doninck
    Thank you, this would indeed help! I have however fixed it instead by making my RenderableSeries inherit from CustomRenderableSeries, instead of the previous. Thank you again for your help!Regard, Yves
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.