I'm trying to add text labels to certain data points with xCharts. For every point that has a "name" property I want a label near the point with the "name" value as text. This picture shows what I want:
And here is the data set:
var data = {
"xScale": "time",
"yScale": "linear",
"type": "line",
"main": [{
"className": ".pizza",
"data": [{
"x": "2012-11-05",
"y": 1
}, {
"x": "2012-11-06",
"y": 6
}, {
"x": "2012-11-07",
"y": 13,
"name": "Name 1"
}, {
"x": "2012-11-08",
"y": -3
}, {
"x": "2012-11-09",
"y": -4
}, {
"x": "2012-11-10",
"y": 9,
"name": "Name 2"
}, {
"x": "2012-11-11",
"y": 6
}]
}]
};
From what I understand this kind of customization is not supported out of the box in xCharts and must be done with d3 and I'm guessing it something along the lines as described in the documentation about Custom Vis Types. But I'm a complete newbie on d3 so I can't figure out how to create something useful.