lr-chartist-tooltip
tooltip plugin for chartist chart library
- support templates
- no dependency (other than Chartist itself)
- 70 lines of code
install
npm install lr-chartist-tooltip
bower install lr-chartist-tooltip
usage
var chart = new Chartist.Line('.ct-chart', {
labels: [1, 2, 3],
series: [
[
{meta: 'description', value: 1 },
{meta: 'description', value: 5},
{meta: 'description', value: 3}
],
[
{meta: 'other description', value: 2},
{meta: 'other description', value: 4},
{meta: 'other description', value: 2}
]
]
}, {
plugins: [
Chartist.plugins.lrTooltip({template:'<p>{{meta}}:{{y}}</p>'})
]
});
template variables (to put between {{ }} )
- y the y value
- x the x value
- meta some meta data string
options
- tooltipClass : the class name added to the tooltip element (default ct-tooltip)
- template : the template string to be interpolated (default {{y}})
-
labelOffset: x and y value to position the tooltip