Search code examples
c#wpfgraphing

Dynamic Graph Filtering


I am working on a graph in WPF, in each section there are thousands of points to draw. The performance for rendering this graph is horrible.

Does anyone have any experience with a filter that will represent the graph with much fewer points - similar to the way a stock graph draws itself when its zoomed out.

Thank you.


Solution

  • When you talk about a graph, I'm assuming you mean as in a chart rather than lots of nodes and edges (hence the stock example).

    So, assuming that's the case, here are a couple of webpages covering algorithms for simplifying polylines:

    http://www.kevlindev.com/tutorials/geometry/simplify_polyline/page2.htm

    http://softsurfer.com/Archive/algorithm_0205/algorithm_0205.htm

    You could generate simplified polyline versions of the graph lines for various scales (on demand).