Title: TKOS changes to wxFreeChart 1.6, "wxFreeChartNg"
Author: Alan Yaniger
Date: Sept. 19, 2011
wxFreeChart is a charting library written by Andrey Moskvichev for use with wxWidgets. It handles a wide variety of graphs, and comes with helpful sample code. Although there is some support for dynamically drawn graphs, it can't handle heavy-duty graphing of hundreds of thousands of measurements, being received at high speed without slowing down significantly. It is really best for drawing static graphs.
The TkOS enhancement (wxFreeChartNg) adds high performance, dynamic drawing capabilities to wxFreeChart, enabling it to display data at high acquisition rates.
Tk OpenSystems has modified wxFreechart to enable better performance when drawing large graphs dynamically. Before these changes, wxFreechart would slow down after a few minutes when drawing 1000 points per second. After the changes, wxFreechart can draw graphs at 1000 points per second and continue for several hours without noticeably slowing down. If you're drawing a graph which is monitoring real-time data, and thus you need to be constantly drawing new points, this can make a big difference. To take advantage of this new capability, you need do two things. First, you turn on “adding mode”, so that with each change only new points are drawn, and the old points are not erased and redrawn. You do this by calling the function SetAddingMode() with the argument “true”. Second, you preallocate the amount of memory you need for the plot rather than the default behavior of freeing and reallocating memory for the entire plot with each new point. You do this by passing the amount of memory to be allocated as an argument to the XYSeries constructor. Once the graph is finished, you can call a function “FreeExtra()” to free the allocated but unused memory.
In addition, TKOS has added more flexibility to wxFreechart. For example, you can hide and reshow axes with the SetAxisVisible() function. You can display text for a Y-axis on the right, functionality which did not work before. You can replace one axis object with a different one using the ReplaceAxis() function. You can set a multiplier for all values on the X-Axis , so that if you want to change the units on the X-Axis from seconds to milliseconds, for example, you call SetMultiplier() with an argument of 1000. If you don't want labels on every tick on the axis, use the function SetLabelSkip(). You can show labels for all ticks by setting the label skip value to 1, for every other tick by setting the value to 2, every third tick by setting the value to 3, and so on. The new code also implements the PointMarker class, allows you to set the symbol, color and text of point markers and move the point marker's text. You can also clear an XY series its contents with the Clear() function. This can be useful if you want to clear and redraw the plot, without having to reinitialize the entire chart object.