DataBreaking enable.

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

Posts: 48
Joined: Mon Jan 12, 2015 6:52 am

DataBreaking enable.

Post by ehdrnsep » Mon Oct 10, 2016 5:27 am

I write code.
"series.DataBreaking.Enabled = false;"
But dataBreaked.
I have to remove double.NaN value?

Code: Select all

using Arction.WinForms.Charting;
using Arction.WinForms.Charting.SeriesXY;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DataBreak
    public partial class Form1 : Form
        public Form1()

        private void CreateChart()
            LightningChartUltimate chart = new LightningChartUltimate();
            chart.ViewXY.LegendBox.Visible = false;
            chart.Dock = DockStyle.Fill;
            chart.Parent = this;

            PointLineSeries series = new PointLineSeries(chart.ViewXY, chart.ViewXY.XAxes[0], chart.ViewXY.YAxes[0]);
            series.DataBreaking.Enabled = false;

            SeriesPoint[] points = new SeriesPoint[10];
            for (int i = 0; i < points.Length; i++)
                points[i].X = i;
                points[i].Y = i;

            points[5].Y = double.NaN;

            series.Points = points;

i want this.
i want this.
want.png (61.89 KiB) Viewed 7622 times
series.DataBreaking.Enabled = false;
series.DataBreaking.Enabled = false;
databreak.png (57.56 KiB) Viewed 7622 times

Posts: 400
Joined: Mon Mar 14, 2016 9:22 am

Re: DataBreaking enable.

Post by ArctionKestutis » Tue Oct 11, 2016 7:01 am


PointLineSeries, SampleDataSeries, AreaSeries or HighLowSeries could not handle NaN under normal conditions. You could verify that by switching to Dx9 RenderingEngine or by exporting your Chart to EMF file. Only Dx11 RenderingEngine is handling NaN satisfactory, but result will look bad if you would like to ignore other values than NaN.
To overcome this problem we added series.DataBreaking.Enabled option. Then it is enabled (=True), chart will be rendered normally despite data being "contaminated" with some bad measurements/values. Note, with DataBreaking Enabled Chart rendering is slower.
However, LightningChart do not have a priori knowledge what user want to do with "missing value". It is for user to decided that to do in this situation: show as missing value, replace with interpolated value or remove altogether.

P.S. in your situation it looks like you would like to replace NaN with interpolated value.

All the best,

Posts: 183
Joined: Tue Mar 18, 2014 2:55 pm

Re: DataBreaking enable.

Post by greggorob64 » Tue Oct 11, 2016 9:39 pm

To highjack this thread, you mention that performance is slower when using databreaking is enabled. Is this something I should be concerned about? I use it pretty extensively since the feature came in.

If the performance is something concerned with, i'd rather go back to the 'invalid sample regions' feature that arction used to handle these issues before the feature came in.

Posts: 400
Joined: Mon Mar 14, 2016 9:22 am

Re: DataBreaking enable.

Post by ArctionKestutis » Wed Oct 12, 2016 6:56 am

There is no number carved in stone. How slow it will be depend on type of series used and in which situation. The pure rendering performance would be slower just because number of vertices is at least doubled. However, for the LineSeries it may be just fraction of milliseconds. You may further optimize performance by using MaxValue/MinValue instead of NaN as your breaking value. If you need flexibility and your data set occasionally comes with missing values, when DataBreaking Enabled is perfect solution. However, if you looking to minimize frame rendering time, when you may look at this place for optimization.