Dygraphs change series name dynamically? -
i have dygraphs chart has 115 or series plotted on it. works great. however, i'm trying figure out how retrieve series name of highlighted series, , how format number.
example on dygraph fiddle page (though, use big php string data, won't shown). http://jsfiddle.net/em2mg/861/
i end highlighted label of "year: 1955 y73 portfolio: $1,000,000". want able retrieve 73 number, , edit says. can't find in dygraph js file specific label formatter series number ,or method retrieve it. don't want have label every series manually.
ideas? great charting software.
gr = new dygraph( // containing div document.getelementbyid("graphdiv2"), // csv or path csv file. <?php echo $chartdatastring2; ?>, { title: 'spending level', ylabel: 'spending ($)', xlabel: 'year', labelsdivstyles: { 'textalign': 'right' }, digitsafterdecimal: 0, yaxislabelwidth: 100, axes: { y: { labelskmb: false, maxnumberwidth: 11, valueformatter: function numberwithcommas(x) { return 'spending: $' + x.tostring().replace(/\b(?=(\d{3})+(?!\d))/g, ","); }, axislabelformatter: function numberwithcommas(x) { return '$' + x.tostring().replace(/\b(?=(\d{3})+(?!\d))/g, ","); } }, x: { valueformatter: function numberwithcommas(x) { return 'year: ' + x; }, }, }, showlabelsonhighlight: true, highlightcirclesize: 3, strokewidth: 1.5, strokeborderwidth: 0, highlightseriesbackgroundalpha: 1.0, highlightseriesopts: { strokewidth: 4, strokeborderwidth: 2, highlightcirclesize: 5, }, } );
the built-in dygraphs legend charts, @ point outgrow it. sounds you've reached point. i'd suggest hiding built-in legend , implementing own using highlightcallback , unhighlightcallback. can access series names via g.getlabels().
Comments
Post a Comment