capture values to then draw a historical chart ?

102 views
Skip to first unread message

Sebastian Ovide

unread,
Jun 27, 2020, 4:57:57 PM6/27/20
to TiddlyWiki
Hi All,

I'm capturing some numerical values that I'm saving as fields of a tiddler. I'd like to save the tiddler with all the values somewhere so that I can draw a historical chart using old values. I was thinking to just copy the tiddler to a new tiddler with the same name plus a date. For example:

"datatiddler" captures the current numerical values in fields. and "datatiddler-2020-06-10" capture the values the 10 June 2020. And perhaps adding the tag "datatiddler" or/and a "snapshot" tag (or field?)

Another option is to create one tiddler per value instead of putting all the values in the same tiddler, and do something similar the the previous idea (snapshots clones)

What do you think ? Any better way ?


Thanks

Mat

unread,
Jun 27, 2020, 5:06:55 PM6/27/20
to TiddlyWiki
I don't understand - why can't you just save the original tiddler that already has the values? Or are you talking about making a template which is then used for each date instance?

Also note that DataTiddler is a special concept in TW. It doesn't seem like this is what you're referring to - but maybe you are, and if you're not maybe you should consider it :-)

<:-)

Sebastian Ovide

unread,
Jun 27, 2020, 7:17:46 PM6/27/20
to TiddlyWiki
imagine a tiddler called "me" and it has a field called "weight" and one called "pressure". Once a day I can updates those values. As they change over time, I'd like to draw a chart (perhaps a plugin or macro using JS). 

Does it makes sense ?

TW Tones

unread,
Jun 27, 2020, 11:24:55 PM6/27/20
to TiddlyWiki
Data tiddlers are a good way to store repeat row data. There is the simple one and the json data tiddler. You could store these values as key value pairs with an index of date time of the change. You can then make period analysis. The data tiddler would be one for each tiddler you are tracking. This could make it a generic solution.

If you provide the field update method you can trigger an action to update a data tiddler etc only if the value changes.

Mohammad s trash bin plugin moves tiddlers into json or the $:/trashbin namespace I believe and with the right hack you could interrogate the trashed tiddlers.

Noteself implementations and others retain tiddler versions perhaps you could use them?

Do share back. I would build a solution myself if I had time.

Regards
Tony

CJ Veniot

unread,
Jun 27, 2020, 11:46:11 PM6/27/20
to TiddlyWiki
G'day Sebastian,

Drawing a chart is way out of my league, but I'll offer some thoughts in case they are useful.

I can't help but want to divide things up in a way that makes sense to me, but may very much be overboard ...

I imagine a tiddler called you.  But then I imagine a whole bunch of tiddlers, one per day, each tagged with a "Daily Numbers" tag (or whatever tag makes sense.)

All of these "Daily Numbers" tiddlers are journal tiddlers with those weight and pressure fields.

I'm not sure how to go about it, but seems to me I've seen examples of using a tiddler data entry form for creation of new tiddlers and setting the values of fields for the new tiddlers.  Not something I've ever done myself.

Then the hard work:  getting the list of all tiddlers tagged "Daily Numbers", along with their field values, and putting them in a chart (D3 plugin?)  Again, stuff I've never done myself.

Side note: there's got to be a way to get the most current "Daily Numbers" tiddler to show, on the "you" tiddler, the most recent values for weight and pressure.

Please, take all of that with a heaping amount of salt.  I wish I could offer up something with way more meat on the bone.

Whatever you come up with, I sure look forward to seeing it.

Cheers !

Jed Carty

unread,
Jun 28, 2020, 3:42:00 AM6/28/20
to TiddlyWiki
I made a plugin for simple time series plots, you can see it demoed here: https://ooktech.com/TiddlyWiki/ScatterPlot/

Somewhere I have a setup for gathering data like you describe, I will look for it.

Sebastian Ovide

unread,
Jun 28, 2020, 5:44:17 AM6/28/20
to TiddlyWiki
good ideas in the thread.

Just trying to implement in the most TW friendly way. 

TW Tones  suggestion of using data tiddlers seems good. That means 1 tiddler for each "variable" that I want to keep history of, key would be just a timestamp and perhaps the latest value could have its own key "latest". So for example the tiddler weight would have something like this

latest:80
20200622:80
20200612:83
20200601:86

as TW supports datatiddler out of the box it would allows me to do {{weight##latest}} to get the latest value and with some macro (perhaps JS) I could just parse {{weight}}

just trying to get my head around (still cannot think 100% in TW) about using a filter,  macro or widget for this ? 

I guess that. a filter could retrieve the latest value or a series of values (??), and perhaps a macro (or widget?) can save a value... 

Sebastian Ovide

unread,
Jun 28, 2020, 6:32:45 AM6/28/20
to TiddlyWiki
getting there. 

<$edit-text  tiddler="weight" index="tmp" tag="input" type="number"/> <$button>
<$action-listops $tiddler="weight" $index="latest" $filter={{weight##tmp}}/>
<$action-listops $tiddler="weight" $index=<<now YYYY0MM0DD0hh0mm0ss>> $filter={{weight##tmp}}/>record
</$button>

weight -> {{weight}}
weight##latest -> {{weight##latest}}


probably the key "latest" is not required. But needs a simple way to access the latest value. I guess that it could be done with an filter but probably harder compared to {{weight##latest}}

TW Tones

unread,
Jun 28, 2020, 8:27:12 PM6/28/20
to TiddlyWiki
Sebastian,

Good to see you progressing here. Latest can be stored anywhere you want but I like the idea of it being stored in the same dataset.

When using data tiddlers you tend to use indexes and getindex etc... but in many cases ## replaces the !! that provides a text reference to a field.
So in many cases an index is almost a fieldname in a data tiddler, and in many cases you can use filters as if they were fields.

I Just build a small set of examples here, as much to clarify for my self. Try it on tiddlywiki.com

;Tiddlywiki.com has the tiddler $:/config/OriginalTiddlerPaths which is a large data set for experiments


Last {{{ [[$:/config/OriginalTiddlerPaths]indexes[]sort[]last[]] }}}
<hr>


First {{{ [[$:/config/OriginalTiddlerPaths]indexes[]sort[]first[]] }}}
<hr>


6th {{{ [[$:/config/OriginalTiddlerPaths]indexes[]sort[]nth[6]] }}}
<hr>


<$list filter="[range[10,20]]" variable=row>
<<row>>: {{{ [[$:/config/OriginalTiddlerPaths]indexes[]sort[]nth<row>] }}}<br>
</$list>
<hr>


;All


{{{ [[$:/config/OriginalTiddlerPaths]indexes[]sort[]] }}}


Regards
TW Tones

Sebastian Ovide

unread,
Jun 29, 2020, 2:06:53 PM6/29/20
to TiddlyWiki
hey TW Tones, 

that's very useful indeed. Thanks! 
Reply all
Reply to author
Forward
0 new messages