How to improve D3 chart performance using Filter

Apr 6, 2011 at 4:56 AM
Edited Apr 7, 2011 at 9:54 AM


    I am drawing a dynamic line chart to which I add around 20 points per second. Now once it reaches around 1 minute the application slows down and then the drawing seems to be so slow and finally it hangs. The CPU utilization reaches 100 as well.

1.  I tried Filtering using the default Filters and that does not improve the performance . I use the code below.

            _Chart = plotter.AddLineGraph(compDS, chartColor, 1, name);
            _Chart.FilteringEnabled = true;
            _Chart.Filters.Add(new FrequencyFilter());

2.  I  thought of displaying graphs for previous 10 seconds data so that system will not draw the lines for older points. Implemented it by setting ViewPort.Visible rectangle when ever new data is added to the chart. I use the following code

            DateTime d = DateTime.Now;
            double xAxisMin = dateAxis.ConvertToDouble(d.AddSeconds(-10));
            double xDiff = dateAxis.ConvertToDouble(d) - xAxisMin;   

            Rect visibleRect = new Rect(xAxisMin, _ChartViewModel.yAxisMin, xDiff, (_ChartViewModel.yAxisMax - _ChartViewModel.yAxisMin));
            plotter.Viewport.Visible = visibleRect;

                foreach (IPointsFilter filter in _Chart.Filters)

In the graph X axis i Display time and Y axis i display a double value in between -250 and 250.

Please suggest how to improve the performance in my scenario...