Dygraph - hide axis labels when not showing data -


I do not know how to hide axis letters from the graph, when the visibility of all the data in the series show that the pivot is hidden The axes are shown without any problem, but when the two series (under my code) is hidden a special axis, the axis is visible and the label changes from 1 to 1/10 in increments of 1. I am grateful for any suggestions below that I am using the code:

     

I do not know how to do this through dygraphs API, but this One way to do this is to check your change event handler, which series is hidden and it determines which axes can be hidden then search all the text with the class - dygraph-axis-label-y and from them Repeat. If their parent DIV is correctly aligned, then this is a Y1 label, if it is omitted, then this is a Y2 label. Update: danvk commented that y2 labels have class dygraph-axis-label-y2 , so I I am updating my answer to use the fact.

  function changes (L) {chart .setVisibility (el.id, el.checked); Var y1vis = ($ ("# 0: checked"). Length + $ ("# 1: Checked"). Length) & gt; 0; Var y2vis = ($ ("# 2: checked"). Length + $ ("# 3: Checked"). Length) & gt; 0; If (y1vis) {$ (".digraph-axis- label-wi: not (.grig-axis-label-y2)"). Show (); } And {$ (".digraph-axis-label-y: no (ograph-axis-label-y2)"). Hide (); } If (y2vis) {$ (".digraph-axis-label-y2"). Show (); } And {$ (".dygraph-axis-label-y2"). Hide (); }}    function change (L) {chart.setVisibility (el.id, el.checked); Var y1vis = ($ ("# 0: checked"). Length + $ ("# 1: Checked"). Length) & gt; 0; Var y2vis = ($ ("# 2: checked"). Length + $ ("# 3: Checked"). Length) & gt; 0; If (y1vis & y2vis) {$ (".digraph-axis-label-y") Show (); } And {$ (".dygraph-axis-label-y"). Each (function () {// var IsY1 = $ (this) .Parent (.css ("text-align") == "right"; // var isY1 =! $ (This) .hasClass (" dygraph-axis-label-y2 "); if (IsY1 & amp;; y1vis) {$ (this) .hide ();} if (! ISY1 & amp;; y2vis) {$ ( This) .hide ();}}); }}  



Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -