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 :/
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