Pre loader

Two FastLineRenderableSeries displayed delayed

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


Hello everybody,

Having two FastLineRenderableSeries objects, how can I display them on the same chart, where the X axis represents the time, but the second one with a small time delay on the x-axis (shifted)? Thanks.

  • You must to post comments
Best Answer

Hi Marius

This can be achieved with our Filters API.

We already have an Offset filter but this only offsets in the Y-direction.

Offsetting in the X-direction could be achieved by writing a custom filter. For example, try this:

/// To create a custom filter, inherit FilterBase and override FilterALl. For best performance, you can also override FilterOnAppend
/// </summary>
public class OffsetXFilter : FilterBase
    private readonly XyDataSeries<TimeSpan, double> _originalDataSeries;
    private readonly XyDataSeries<TimeSpan, double> _filteredDataSeries = new XyDataSeries<TimeSpan, double>();
    public OffsetXFilter(XyDataSeries<TimeSpan, double> originalDataSeries, TimeSpan offset) : base(originalDataSeries)
        _originalDataSeries = originalDataSeries;
        // Store a reference in the base class to the FilteredDataSeries
        FilteredDataSeries = _filteredDataSeries;
        XOffset = offset;
        // Update the filter

    public TimeSpan XOffset { get; set; }

    protected override void FilterOnAppend(int index)
        // Override FilterOnAppend to update just the latest data-point in _filteredDataSeries for a more efficient filter
    protected override void FilterOnInsert(int startIndex, int count)
        // Override FilterOnInsert to update just the inserted data-point in _filteredDataSeries for a more efficient filter
        base.FilterOnInsert(startIndex, count);
    protected override void FilterOnRemove(int startIndex, int count)
        // Override FilterOnRemove to update just the removed data-point in _filteredDataSeries for a more efficient filter
        base.FilterOnRemove(startIndex, count);
    protected override void FilterOnUpdate(int index)
        // Override FilterOnUpdate to update just the updated data-point in _filteredDataSeries for a more efficient filter
    public override void FilterAll()
        // When FilterAll is called, recreate the FilteredDataSeries and apply the filtering.

        for (int i = 0; i < _originalDataSeries.Count; i++)
            _filteredDataSeries.Append(_originalDataSeries.XValues[i] + XOffset, _originalDataSeries.YValues[i]);

Note: The above is not the most performant solution, as it will update the entire Offset filtered dataseries on every change of the underlying series. For optimal results, consider overriding the other functions like filterOnAppend, filterOnRemove etc

Best regards

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies