2 years, 11 months ago samParticipant
First off — wow. I found DataGraph just a week or so ago. What a wonderful tool. Made my first useful graph without reading any documentation at all. Intuitive to explore and use for simple stuff, but with lots of power-user features appearing upon delving in & drilling down.
Is there any way I can programmatically label an arbitrary (not periodic) subset of data points? Using a separate spreadsheet table containing the abitrary label locations, style information, and descriptive text to automate the label-creation process rather than my doing it by hand in DG?
Think of it like a “mail merge” feature for DG except instead of a table of names and addresses going into a word processor to produce a form letter, it’s a table of data labels going into DG to produce hundreds or thousands of graph labels with a few mouse clicks.
Such a feature would expand DataGraph’s capabilities considerably. While DG can handle many kinds of algorithmically-processed labels (labels based on mathematical functions) with aplomb, new possibilities would be opened up if it could apply labels by merging arbitrary label data sets.
Any process that creates timestamped event logs could be swiftly labelled on DataGraph charts. Industrial process-control logs, security system logs, sports event finishing times and scores, stock market data, attendance records, etc.
Further explanation & specific examples
My main use case at present is graphing fairly basic time series of CO2 & PM (particulate matter) data, typical on an hours-to-days time scale, often in a long & thin strip-chart format. The chart aspect ratio might be anywhere from 25:1 to 100:1, with actual dimensions of up to 50 feet long x 6 inches tall in some cases.
The raw measurement data sets are straightforward (x; y1; y2) arrays containing on average 5,000 to 20,000 rows, for example:
Timestamp; CO2 concentration, PM2.5 concentration
All well and good, a cake-walk to chart the data itself.
Then I need to annotate these line charts using DataGraph’s “label” feature. In my case I have hundreds (or thousands) of timestamped events (in a different spreadsheet, separate from the raw measurement data) that I want to annotate the graphs with. The most I manage by hand is to pick 30 or 40 out of thousands of events & apply them by hand. (Copy-pasting DG’s “Label” definition box over and over, manually adjusting label text & format as needed.) Hand labelling is fine as far as it goes but it doesn’t scale past 50 or so arbitrary label definitions & locations.
Here’s a sample of the first few rows from my Events spreadsheet (separate from the raw data) to illustrate further. (The full spreadsheet might be 150 to 1500 rows.)
Row Number; Timestamp; CO2 PPM Measurement; ActionCategory; ActionDescriptionText
1; 2020-02-10 06:05:25Z; 800 PPM CO2; External; Vent Fan Turned ON
2; 2020-02-10 07:17:25Z; 400 PPM CO2; Recovery Room; Vent Fan Turned OFF
3; 2020-02-10 08:01:42Z; 500 PPM CO2; Internal; Heater Turned ON
4; 2020-02-10 08:05:25Z; 525 PPM CO2; Recovery Room; Vent Fan Turned ON
5; 2020-02-10 11:05:25Z; 642 PPM CO2; External; Filter Fan Turned ON
(… hundreds of rows omitted …)
I would like to import this table into DataGraph, telling DG, “Take these table entries and create individual labels on the graph at each of these timestamp marks (column 2), with the label height at the included data point (column 3), with appearance details (font, color, angle, etc.) set according the event’s Category (column 4), with the label’s descriptive text coming from the ActionDescriptiveText field (column 5).”
The label style definitions would be created elsewhere & earlier within DG, with each Style definition name matching one of the ActionCategory items above. For example, Row 2 above would get processed as “Create a label and set its Style to “Recovery Room”. Put the label at 2020-02-10 07:17:25 x-axis location, and 400 PPM CO2 y-axis location.”
Is there an existing method to automatically import and parse my separate set of event label entries? If not, could I build it using something like Applescript?
Ideally such a feature would be scalable to an effectively unlimited number of labels subject only to the maximum space available on the graph.2 years, 11 months ago dgteamModerator
Glad you found us!
Let’s start with what you can do now …
Here is your sample data imported into DG with the Time column using an ICU format string.
I also removed the text from the CO2 column using the File/Paste Special, to remove the text, and converted this column to a number.
Now the Time and CO2 data can be plotted using the Points command, where the ActionCategory column is used as a label, and you can change the label format.
Now you have points and labels beside the points.
Changing the Marker to ‘No Point’ …
Gives you the labels without any points.
You could include this command along with the Plot command of all your data.
Here are some limitations:
- font, color, angle, etc. will all be the same.
- the location of the label relative the point is all the same side.
That said — we have been thinking about a Labels command that would have a lot more flexibility.
I also have some other suggestions for you on other ways you could indicate this with other commands.
Before I go any further, are we on the right track for what you want to do?2 years, 11 months ago samParticipant
This is definitely on the right track. Your detailed reply solves my immediate need which is to stop putting 40 to 50 labels on each graph “by hand” (copying & pasting Label commands).
I can then obtain my additionally-requested functionality of having different sets of “labels” (actually just
Points) appear in different styles, by sorting my EventsLog by the ActionCategory field, then assigning groups of EventLog items to different
Pointscommands, changing the style for each
Pointscommand according to how I want that EventCategory of log entries to appear on the graph.
(In your example screenshots you used EventCategory as the Label text field, in fact I would want to use ActionDescriptionText as the Label text for each plotted point. The purpose for the EventsCategory field is to allow me to map different kinds of plotted points to different visual styles for the labels appear next to the points.)
It will take me a week or three to revisit my workflow & integrate your very useful suggestions. I will return to & update this discussion thread after further practice & experimentation in DG.
NB, I did look through the entire DG YouTube tutorial series before posting. Did I miss the topic covering this angle of programmatic label (or pseudo-label) creation? If not, you might consider adding this to the list of topics for future tutorials.
Thanks for your help & suggestions so far.
You must be logged in to reply to this topic.