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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -