Hi
One of my current private projects required a more professional chart to display measured data.
A few years ago, I wrote
PlotXY in a form that I could no longer use. I also was not very happy looking at the code so I decided to rewrite it but reuse some of the old code blocks.
An important goal was to keep it as performant as possible, as it has to render several thousands of lines and markers. It quickly became clear to me that, under these circumstances, it was taking too much time for the old code to render parts of the diagram that were not visible. For this reason, I implemented a new line-clipping algorithm, described here
http://masm32.com/board/index.php?topic=9518.0.
I wrote the code so that other chart types, such as bar charts, could be easily derived, reusing most of the common underlying infrastructure. The provided example in the attachment implements
ChartXY, which is a series if (x, y) points, connected by straight lines.
I added code for gesture control, a general setup dialog, and some handy mouse interactions for moving and scaling the data. Use the left mouse button to drag the data, the scroll wheel to zoom in and out, the ctrl and shift keys and double clicking add more user functionality. The areas of the chart react differently to the interactions. All of these features can be enabled or disabled by setting some internal flags.
The input data type can be selected between
REAL4 and
REAL8 at compile time. All internal calculations are adjusted accordingly.
I compiled the code for 32 bit so that it can be viewed on machines that don’t support 64 bit.
There may be a bug or two in the code, so feedback is welcome.
To recompile the code, some newer files are required, which will only be available in the GitHub repo until the next official ObjAsm release.
I will replace the old Demo07 with this new architecture and say goodbye to the older
PlotXY.
Regards, Biterider