Giter VIP home page Giter VIP logo

chartex's Introduction

ChartEx

ChartEx is a WinForms Chart wrapper which optimizes rendering of huge portions of data.

What it does

ChartEx optimizes displaying of huge portions of data on a single Chart Control from .NET WinForms Framework. While simple Chart doesn't allow threading it will take some time for Chart to render huge portions of data, ChartEx wraps the Chart and efficiently solves the problem.

See it in action. Rendering of 6 series with 10,000 points in each. Update-rate 100 ms. ![Image](https://raw.githubusercontent.com/adya/ChartEx/master/wiki/ce.gif)
See it in action. Scaling of 6 series with 10,000 points in each. Update-rate 100 ms. ![Image](https://raw.githubusercontent.com/adya/ChartEx/master/wiki/ce2.gif)

Hot it works

ChartEx utilized all data management and provides a way to specify one of the predefined or custom data approximation algorithms. The key for this problem was to reduce amount of points to be rendered (since points were lose too each other and most of them were rendered on the top of each other which is redundant). These algorithms determines major and minor data array peeks and renders on the Chart only major points. Furthermore, it behaves in the same way when scaling the Chart: if there are still lots of points ChartEx will apply approximation to the scaled area.

How to use

Wrap the Chart object

  Chart chart = new Chart();
  ChartEx chartEx = new ChartEx(chart);

Set approximation algorithm (Optional)

Approximation algorithm is provided by IChartExSelector interface.

  chartEx.SelectionMethod = new MyApproximationSelector();

You can set either predefined selector or create your own.

a) ChartEx comes with predefined IChartExSelector's:

  • ChartExSimpleSelector - Evenly selects points; (default selector)
  • ChartExPeekSelector - Selects stationary points;
  • ChartExDeltaPeekSelector - Selects stationary points which have delta between two consecutive points greater than specified threshold value;
  • ChartExSavitzkyGolaySelector - Selects points using Savitzky–Golay filter;

b) To create custom selector you have to implement IChartExSelector. Example:

  class ChartExSimpleSelector : IChartExSelector
  {
    private int GetStep(int amountOfPoints, int maxRenderedPoints)
    {
        return (int)Math.Ceiling((double)amountOfPoints / maxRenderedPoints);
    }

    public List<PointF> Select(List<PointF> candidatePoints, int maxPoints)
    {
        List<PointF> resultPoints = new List<PointF>();
        int step = GetStep(candidatePoints.Count, maxPoints);
        for (int i = 0; i < candidatePoints.Count; i += step)
            resultPoints.Add(candidatePoints[i]);
        return resultPoints;
    }
  }

Add series and points

  • You can create SeriesEx as you usually do with regular Series
  SeriesEx seriesEx = new SeriesEx("Name"); // SeriesEx wraps regular Series.
  • Or wrap an existing series
  Series series = new Series("Regular");
  SeriesEx seriesEx = new SeriesEx(series);
  • Add created seriesEx
  chartEx.Series.Add(seriesEx);

Points added through Add method of the regular series will not be observable and therefore ChartEx won't refresh approximation.

Customize Chart and Series

Since ChartEx and SeriesEx were designed as wrappers you are able to access their wrapped objects by WrappedChart and WrappedSeries respectivelyю

For example, change series ChartType to line:

  seriesEx.WrappedSeries.ChartType = SeriesChartType.Line;

Or set range of chart's X-axis:

  chartEx.WrappedChart.ChartAreas[0].AxisX.Minimum = 0;
  chartEx.WrappedChart.ChartAreas[0].AxisX.Maximum = 100;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.