Note that there are some explanatory texts on larger screens.

plurals
  1. PODygraphs library: Access to non-visible data in highlightCallback function possible?
    primarykey
    data
    text
    <p>This is a question regarding the Dygraphs library.</p> <p>When using the "visibility" method in order to suppress the rendering of certain variables of a multivariate time series, only the <em>visible</em> highlighted points get passed to the "highlightCallback" function (third parameter, named "points" in the documentation). It would be convenient if the user had access to all points in the callback function, i.e., <em>highlighted visible</em> points <strong>and</strong> points <em>that were highlighted if the corresponding variables were to be set visible</em>.</p> <p>My question: Is there a functionality/work around to gain access to the coordinates of non-visible highlighted points within the (un)highlightCallback function?</p> <p>In order to clarify the problem, here a quick example:</p> <p>Let's assume we have the following multivariate time series</p> <pre><code>"time_index", "var1", "var2"\n "1", "5.1", "0.3"\n "2", "5.5", "0.2"\n "3", "5.8", "0.1" </code></pre> <p>and a Dygraph object <code>g</code> using this dataset. We set</p> <pre><code>g.updateOptions({visibility: [true, false]}); </code></pre> <p>and, therefore, the time series corresponding to <code>var1</code> is drawn whereas <code>var2</code> is hidden. Now assume that we want to draw a vertical line of length <code>var2</code> for each highlighted point of the time series <code>var1</code>, i.e.,</p> <ul> <li>a line from <code>(1,5.1)</code> to <code>(1,5.4)=(1,5.1+0.3)</code> when point <code>(1,5.1)</code> is highlighted</li> <li>a line from <code>(2,5.5)</code> to <code>(2,5.7)=(2,5.5+0.2)</code> when point <code>(2,5.5)</code> is highlighted</li> <li>a line from <code>(3,5.8)</code> to <code>(3,5.9)=(3,5.8+0.1)</code> when point <code>(3,5.8)</code> is highlighted</li> </ul> <p>This would be done by using the highlightCallback function.</p> <pre><code>g.updateOptions({ highlightCallback: function(event, x, points, row, seriesName) { draw_line(points[0],[points[0].xval,points[0].yval+points[1].yval]); //draw_line(point_start,point_end) } }); </code></pre> <p>Unfortunately, I have not found a way to access the data of the invisible time series <code>var2</code> (i.e., <code>points[1].yval</code>, here used to determine the length of the vertical line) in the highlightCallback function.</p> <p>Thank you for your help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload