Using cubism.js I'm snagging graphite data and creating multiple graphs on page. Looks amazing but I cannot figure out how to modify the default title/text of each graph. Very limited JS experience.
This might be a cubusm.js, d3.js, or general javascript question, I'm not sure. Since graphite nests data within sometimes deep folders structures, I'd like to be able to simplify default the string a bit. Example of text I want to modify ('servers.apt1.loadavg.05', 'servers.apt2.loadavg.05', etc): https://i.stack.imgur.com/wXYsK.png
How do I modify the title/text of each graph's Graphite data? Getting "servers.apt1.loadavg.05, want "apt1" displayed.
var context = cubism.context()
.step( 1 * 30 * 1000 )
.size(960);
var graphite = context.graphite("http://graphite.example.com");
graphFind = 'servers.*.loadavg.05'
graphite.find(graphFind, function(error, results) {
// Map find results to array and set to graphite.metric object type
var metrics = results.sort().map(function(i) {
return graphite.metric(i);
});
// loop through array and print stuff to "graphs" div
for (var i=0;i<metrics.length;i++){
d3.select("#graphs").call(function(div) {
div.append("div")
.selectAll(".horizon")
.data([metrics[i]])
.enter()
.append("div")
.attr("class", "horizon")
.call(context.horizon());
});
}
});