Wednesday, June 5, 2013

Graph, just a simple graph

For RealBasic there are several Plot, Graph or graphing components to draw simple and even very complex graphs. Some of the more capable components are commercial software and indeed are on a professional level. Sometimes however all that is needed is a quick chart to show some trend or series of data in an application.

Also there are free and open source components out there with again varying levels of complexity and capability. Having used some for a while, we ended up making our own version to be very simple in use and to introduce only one class. So there is not the Graph that can include several Plots that can include several Series objects. This class or component is a single Graph object that can plot a line-graph.


All the data are copied to arrays in the Graph object, no additional files or classes are needed.

In the GraphExample project the Graph object is included and of course with all source code readable and editable. It only draws line graphs; adding bar graphs or other plot types is of course possible. The handling of the text sizing could be more elegant and the scale-values could be simpler. But it comes as source code and free to use and extend.

To figure out the current capabilities (range limiting, x-grid only etc...) do have a rummage round the example project and the Graph source.

We may even extend it ourselves.

Good luck :)