@Nicolas
You made great progress, awesome!
I've seen that one can use this to pass a filter to a widget and get the
tiddler titles:
var tiddlers = $tw.wiki.filterTiddlers(this.myTiddlerFilter);
to get the filter:
CirclePackWidget.prototype.execute = function() {
// Get the parameters from the attributes
this.myDataTiddler = this.getAttribute("data");
this.myTiddlerFilter = this.getAttribute("filter");
};
Then you can make a json object from the tiddlers and their tags and fields
to pass it to d3 afterwards
var jsondata = {};
if ($tw.utils.isArray(tiddlers)) {
for (var i=0; i < tiddlers.length; i++) {
var tiddler = $tw.wiki.getTiddler(tiddlers[i]);
console.log(tiddler);
// here we can build the jsondata from the tiddler
// var tags = tiddler.fields.tags;
// var title = tiddler.fields.title;
// var allTiddlerFields = tiddler.fields;
}
------------
The jsondata can be "filled" like so:
jsondata["entry1"] = "test";
or using the title stored in a variable:
var title = tiddler.fields.title;
jsondata[title] = ...
---------------------
I'm not sure what's the best way to do this, there's also
$tw.wiki.getTiddlerAsJson in $:/core/modules/wiki.js - seems more comfortable
to use:
exports.getTiddlerAsJson = function(title) {
var tiddler = this.getTiddler(title);
if(tiddler) {
var fields = Object.create(null);
$tw.utils.each(tiddler.fields,function(value,name) {
fields[name] = tiddler.getFieldString(name);
});
return JSON.stringify(fields);
} else {
return JSON.stringify({title: title});
}
};
...
What I'm thinking about is, what the jsondata should look like to create a
meaningful, expressive tiddler graph
In your CirclePack for example, which tiddler field should create a group? I
think a subfilter by tag could do that
Simon
--
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/31626649-0153-4c74-9fde-3d9485f05de4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.