Hi Martian Just to expand on Mario’s answer: the D3 plugin is little more than a tech demo to show how a third party library can be integrated with TiddlyWiki. In particular, the way that data is passed to it doesn’t easily permit the data to be created dynamically. I agree that the best way forwards for your use case is likely to involve improving the D3 widget itself.
Best wishes Jeremy > On 22 Apr 2016, at 13:11, PMario <[email protected]> wrote: > > On Friday, April 22, 2016 at 12:34:51 PM UTC+2, Martian wrote: > I am playing with D3 plugin examples > <http://www.google.com/url?q=http%3A%2F%2Ftiddlywiki.com%2Fplugins%2Ftiddlywiki%2Fd3%2F&sa=D&sntz=1&usg=AFQjCNF42mPQhxLfI5zeUQJ1PdtSSAWSYA>. > > ok > > my idea was to create a tiddlers with Title and Text = city names and add > field "size". I tagged these tiddlers with tag "Cities" > > then I created a tiddler "toJSON" with macro as in > $:/core/templates/exporters/JsonFile > > \define renderContent() > <$text text=<<jsontiddlers filter:"[tag[Cities]]">>/> > \end > <<renderContent>> > > > good idea and imo you are at the right way. But it seems the <$d3cloud> > widget has a very exact idea, how the data has to be presented. ... I had a > very fast look at the code. So it seems the data parameter can only handle > tiddlers with the type application/json. I thought it would be more flexible > and also allows a "json formatted text stream". ... It doesn't :/ > > then tried to use these tiddler "toJSON" as source for D3 macros as > This is a demo of TiddlyWiki5 incorporating a plugin for the [[D3.js]] > visualization library. > > ! Word Cloud > > <$d3cloud data="toJSON" spiral={{$:/spiral}}/> > > but it doesn't work because [[toJSON]] don't have "application/json". > > But then I manually copied [[toJSON]] content to tiddler [[toJSON2]] typed > with "application/json" and put it into data="toJSON2" to $d3cloud - then it > works ok and showed me Word Cloud. > > Yea. That's the workflow it would need. You need to create a button, that > uses the output of <<jsontiddlers filter:"[tag[Cities]]">> and creates a new > tiddler type application/json that can be fed into the widget. So no "one > click" but a "two click" solution and a bit cumbersome. if you modify the > "city" tiddlers or create a new on, you'll also need to create a new "data > set" the the $d3cloud widget can understand. That's sub-optimal. > > IMO the better way would be to extend the widget, so it can be called like > this: > > <$d3cloud data=<<jsontiddlers filter:"[tag[Cities]]">> spiral={{$:/spiral}}/> > > --------- > > The problem is, that I don't have a fast solution. > > The button to create a data tiddler that works looks like this: > > > <$button> > <$action-sendmessage $message="tm-new-tiddler" title="citiesCloudData" > type="application/json" text=<<jsontiddlers filter:"[tag[city]]">>/> > createCouldData > </$button> > > > Some remarks: > > I would use city as a tag for a city and not the plural. It just looks > stange. (most of the time my tags are lower case. So I can remember how to > write them :) > > And I would rewrite the d3cloud widget. It seems the examples are the minimum > required functionality to show something. .. Imo they are there to show, how > the library can be used. The widgets are very simple examples and imo not > production ready. > > have fun! > Mario > > > > -- > You received this message because you are subscribed to the Google Groups > "TiddlyWiki" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/tiddlywiki > <https://groups.google.com/group/tiddlywiki>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/tiddlywiki/2243e137-da57-49ad-9020-6437be89c1b5%40googlegroups.com > > <https://groups.google.com/d/msgid/tiddlywiki/2243e137-da57-49ad-9020-6437be89c1b5%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/792D11C1-31AA-4554-A770-A5665FA06601%40gmail.com. For more options, visit https://groups.google.com/d/optout.

