I defined a js macro to generate text output and then use in another widget. The wikitext below is working for me.
<$set name="data-daylength" value=<<e_daylength latitude:"27">>>
<$htmlwidgets type="echarts4r" data=<<data-daylength>> uuid="htmlwidget-9e88bb152f72bbc8b7f4" />
</$set>
In next step, I want to replace latitude from another variable. The following test is not working for me
<$set name="latitude1" value="-27">
<$set name="data-daylength" value=<$transclude $variable="e_daylength" latitude=<<latitude1>> >
<<data-daylength>>
<$htmlwidgets type="echarts4r" data=<<data-daylength>> uuid="htmlwidget-9e88bb152f72bbc8b7f4" />
</$set>
</$set>
Any suggestions?
e_daulength is a js macro return json string:
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Information about this macro
*/
exports.name = "e_daylength";
exports.params = [
{name: "latitude"}
];
/*
Run the macro
*/
exports.run = function(latitude) {
latitude = latitude || latitude.getVariable("currentTiddler");
var output = {
"x": {
}
};
return JSON.stringify(output);
};
})();