Forum > TAChart

[solved] adding text notes to charts

(1/4) > >>

Muso:
I wrote some programs that display live sensor data. Since it is live, incidents can occur. When there is for example a loose contact of a cable, I see it in the chart and fix the cable. However, 2 weeks later I don't know this anymore or a colleague looks at the chart and wonders about e.g. a sudden high peak in the chart.
I thought about it for a while and think that a kind of a text note would help me. So for example then I get a sudden peak, I can add a note like "loose cable, already fixed".The note must be attached to a certain x value so that it is at he right position when zooming in/scrolling etc.

I found the marks feature and its example file: https://wiki.freepascal.org/TAChart_documentation#Marksand that is what I need I think. however, I cannot find a way, than I can click into the chart on a data point so that a dialog pops up that I can add a mark. I am pretty sure this is somehow doable so any hint would be nice.
(In my charts I use a lot of tools, see attached and maybe I block myself somehow.)

wp:
Use a TDatapointClickTool and assign it to the double-click, for example (*). In its OnPointClick handler you can determine which data point and which series was double-clicked, you can prompt for a message text, and assign it to the Text element of the data point. And when the series' Marks.Style is at the smsLabel setting, this text will be overlaid on the chart.

See the attached demo.

(*) You may have to add other Shift modifiers to distinguish this tool from the effect of other tools.

Muso:

--- Quote from: wp on July 11, 2022, 08:14:43 pm ---See the attached demo.

--- End quote ---
Many, many thanks. Works perfectly and is indeed exactly what I was looking for!  :)

--- Quote from: wp on July 11, 2022, 08:14:43 pm ---(*) You may have to add other Shift modifiers to distinguish this tool from the effect of other tools.

--- End quote ---
Yes, this is a surprisingly hard task since I use so many tools.

wp:

--- Quote from: Muso on July 11, 2022, 08:44:12 pm ---
--- Quote from: wp on July 11, 2022, 08:14:43 pm ---(*) You may have to add other Shift modifiers to distinguish this tool from the effect of other tools.

--- End quote ---
Yes, this is a surprisingly hard task since I use so many tools.

--- End quote ---
A different approach is to add a toolbar with buttons for zooming, panning, etc., and to restrict the shift modifiers to a  small number of combinations. You can find an example in https://sourceforge.net/p/wp-laz/code/HEAD/tree/MathPlotter/trunk/

Muso:

--- Quote from: Muso on July 11, 2022, 08:44:12 pm ---Many, many thanks. Works perfectly and is indeed exactly what I was looking for!  :)

--- End quote ---

I was a bit too rash. I bound the tool to Ctrl+leftclick and get the input dialog. But the mark is never displayed. it cost me about an hour to realize that one must not set the Marks style in the .lfm file. Only when I keep the .lfm file untouched and set the marks style in the OnCreate form event, it works.Maybe the DataPointHint tool sneaks in here?

Now I need a way to save the mark with my data file (a CSV file that  continuously fill whenever new data arrives). Is there a proven method I should/can use for this?

Navigation

[0] Message Index

[#] Next page

Go to full version