javascript - Chart js how to toggle line without click -
i knee-deep in chart.js project , sake of simplicity, let's assume have lines a, b, , c in plain line chart. there way create chart containing 3 lines shows & b, , has c crossed out in legend , not displayed on graph itself? (toggled clicked.)
the exact functionality i'm trying have
1. generate lines a, b, , c
2. simulate onclick() onto line c
i think i'm overlooking simple , want sure before go rewriting chart.js source code. have searched docs no luck.
thanks in advance!
ok, simple.
data line isn't hidden. (same clicked)
{ label: object.keys(data)[i], fill: false, linetension: 0.1, backgroundcolor: color, bordercolor: color, bordercapstyle: 'butt', borderdash: [], borderdashoffset: 0.0, borderjoinstyle: 'miter', pointbordercolor: color, pointbackgroundcolor: "#fff", pointborderwidth: 1, pointhoverradius: 5, pointhoverbackgroundcolor: color, pointhoverbordercolor: color, pointhoverborderwidth: 2, pointradius: 1, pointhitradius: 10, data: data[object.keys(data)[i]] }
and data line hidden (clicked)
{ hidden: true, label: object.keys(data)[i], fill: false, linetension: 0.1, backgroundcolor: color, bordercolor: color, bordercapstyle: 'butt', borderdash: [], borderdashoffset: 0.0, borderjoinstyle: 'miter', pointbordercolor: color, pointbackgroundcolor: "#fff", pointborderwidth: 1, pointhoverradius: 5, pointhoverbackgroundcolor: color, pointhoverbordercolor: color, pointhoverborderwidth: 2, pointradius: 1, pointhitradius: 10, data: data[object.keys(data)[i]] }
only difference is
hidden: true
simple fix.
Comments
Post a Comment