Default interaction model and 'valueRange' option

64 views
Skip to first unread message

jne...@iotoptech.com

unread,
Jan 31, 2017, 5:05:18 PM1/31/17
to dygraphs-users
I'm having an odd issue, where if I set a valueRange for the Y axis on one of my charts, and I double click, it reverts to the "automagic" range.  Is there an easy way around this?

Dan Vanderkam

unread,
Jan 31, 2017, 6:18:32 PM1/31/17
to dygraph...@googlegroups.com
Are you using dygraphs 2.0? This was one of the breaking changes. The x- and y-axes now behave consistently.

On Tue, Jan 31, 2017 at 5:05 PM, <jne...@iotoptech.com> wrote:
I'm having an odd issue, where if I set a valueRange for the Y axis on one of my charts, and I double click, it reverts to the "automagic" range.  Is there an easy way around this?

--
You received this message because you are subscribed to the Google Groups "dygraphs-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dygraphs-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jne...@iotoptech.com

unread,
Jan 31, 2017, 8:28:09 PM1/31/17
to dygraphs-users
Version 2.0.0.  Here's a snippet of my code (with some stuff edited out for security purposes).  This is for a page I've been working on purely for demo purposes, so it's by no means optimal.

gs1 = new Dygraph(document.getElementById("div1"),
<?php
$sql = "SELECT date, time, motorinvibration FROM testdata";
$result = $conn->query($sql);
echo "[";
while($r = mysqli_fetch_array($result)){
$test = $r['date'] . " " . $r['time'];
$a = date('Y-m-d H:i:s',strtotime($test));
$a= '"'.$a.'"';
$b = ((float) $r['motorinvibration']);
echo '['."(new Date($a))".','.$b.'],';
}
echo "]";
?>,
{
labels:["Timestamp", "Motor Inboard Vibration"],
legend: 'always',
logscale: true,
digitsAfterDecimal: '3',
valueRange:[0.010, 10.0],
underlayCallback: function(canvas, area, g){
var bottom = g.toDomYCoord(vib_warn_high_low);
var top = g.toDomYCoord(vib_warn_high_up);
canvas.fillStyle = amber;
canvas.fillRect(area.x, top, area.w, bottom - top);
var bottom = g.toDomYCoord(vib_crit_high_low);
var top = g.toDomYCoord(vib_crit_high_up);
canvas.fillStyle = red;
canvas.fillRect(area.x, top, area.w, bottom - top);
var bottom = g.toDomYCoord(vib_warn_low_low);
var top = g.toDomYCoord(vib_warn_low_up);
canvas.fillStyle = amber;
canvas.fillRect(area.x, top, area.w, bottom - top);
}
}
)

I'm also using the synchronizer addon:

      var sync = Dygraph.synchronize([gs1, gs2, gs3, gs4, gs5, gs6, gs7, gs8, gs9, gs10, gs11], {
selection: true,
zoom: true,
range: false
}
);

jne...@iotoptech.com

unread,
Jan 31, 2017, 8:33:13 PM1/31/17
to dygraphs-users
Some screencaps of what's going on.  First image is on fresh page load, second is when I double click on it.



On Tuesday, January 31, 2017 at 4:05:18 PM UTC-6, jne...@iotoptech.com wrote:

Dan Vanderkam

unread,
Jan 31, 2017, 11:35:07 PM1/31/17
to dygraphs-users
Right, this is intended behavior. Double click zooms out all the way on both axes.
--
You received this message because you are subscribed to the Google Groups "dygraphs-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dygraphs-user...@googlegroups.com.

jne...@iotoptech.com

unread,
Feb 1, 2017, 3:53:52 AM2/1/17
to dygraphs-users
There's no way to force it to zoom back out to the range set in the original draw?

Dan Vanderkam

unread,
Feb 1, 2017, 5:51:37 PM2/1/17
to dygraph...@googlegroups.com
You can do customize the double-click behavior using a plugin. Check out this fiddle:

There's one small issue: the `e.preventDefault()` call throws. This is a bug which I'd be happy to fix with a point release.

To unsubscribe from this group and stop receiving emails from it, send an email to dygraphs-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages