Add additional data to point dygraphs
Is it possible to add additional data to a point in dygraph?
For example:
X, Y, myId
[
[1, 2, 'some id value'],
[1, 2, 'some other id value'],
[1, 2, 'some value']
]
And then to get myId again in drawPointCallback, for example, I can work out how to draw a point based on the value type.
Or: when the user clicks on a dot, a callback is called and I can get that id for further action.
+3
source to share
1 answer
If you want to keep the number, you can put it in a hidden series. Or you can use an auxiliary array with the same number of records as your data, for example
var data = [[1, 2], [1, 2], [1, 2]];
var auxiliary = ['some id value', 'some other id value', 'some value'];
new Dygraph(div, data, {
pointClickCallback: function(e, pt) {
console.log(auxiliary[pt.idx]);
}
});
+4
source to share