Fixed range for y axis when using x-axis rangeSelector

1,257 views
Skip to first unread message

David Banks

unread,
Dec 9, 2013, 3:43:19 PM12/9/13
to dygraph...@googlegroups.com
Hi, new dygraphs user here. Awesome library!

Just one minor thing that I can't sort out. I have a graph with a range selector along the x-axis. I set valueRange to [5, 30].
If you use the range selector to move through the data the y-axis obeys the limits I set, but if you drag the graph itself the y limits adjust.

An example can be seen here.

Try reducing the x range to 10 days.  Then drag the range selector left or right and the y axis remains unchanged.
Then try dragging the graph itself (not the range selector) left or right with the mouse to see what I mean.

You can play with the options in the javascript console by accessing the dygraph object stored in dygraphSettings.dygraph
The code I used is:

var graph = new Dygraph(
  document.getElementById("dygraph-graph"),
  get_graph_data(["Temperature"]),
  {
    labels: ["Time", "Temperature"],
    labelsDiv: "dygraph-legend",
    labelsSeparateLines: true,
    colors: ["#dd0000"],
    valueRange: [5, 30],
    showRangeSelector: true,
    drawXGrid: false,
    axes: {
      y: {
        valueFormatter: function(y) {
          return y.toFixed(1) + "\xB0C";
        }
      }
    }
  }
);

Thanks,
David


Dan Vanderkam

unread,
Dec 9, 2013, 3:48:58 PM12/9/13
to dygraph...@googlegroups.com, Paul Felix
+paul


--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Paul Felix

unread,
Dec 9, 2013, 4:16:50 PM12/9/13
to dygraphs-users
Hi David,

If I understand correctly, the range selector is properly adhering to your valueRange setting, but the 'drag-to-pan' interaction model is not. If you turn off the range selector, the default interaction model has a 'drag-to-zoom' and a 'shift-drag-to-pan' behavior, and it looks like that has the same problem. Is that what you see?

If that's the case, you may want to submit a bug report regarding the interaction models and a custom valueRange. I believe it's a problem independent of the range selector.

Paul


On Mon, Dec 9, 2013 at 3:43 PM, David Banks <banks...@gmail.com> wrote:

David Banks

unread,
Dec 9, 2013, 4:54:25 PM12/9/13
to dygraph...@googlegroups.com
That seems to be the case Paul. 

Without a range selector, zooming works fine with a valueRange specified but the panning feature still allows you to drag the graph vertically. If there was no vertical drag, it looks to me like it would always stay in the specified value range.
I don't know if that's the same problem as the range selector though, because there is no vertical panning when using a range selector. It adjusts by itself...

I'm happy to submit a report but just a little confused about what exactly is causing the issue

David

Paul Felix

unread,
Dec 9, 2013, 5:06:10 PM12/9/13
to dygraphs-users
The range selector plugin just happens to install a different 'canned' interaction model:

  Dygraph.Interaction.dragIsPanInteractionModel

Without the range selector, the default interaction model is

  Dygraph.Interaction.defaultModel

Both of these interaction models seem to exhibit the problem.

Paul


--

David Banks

unread,
Dec 9, 2013, 7:26:45 PM12/9/13
to dygraph...@googlegroups.com
Ok guys I filed a bug report (issue 499).
I found one temporary solution for now... set interactionModel to {} and only use the range selector to pan the graph ;)

Hector Tellez

unread,
May 26, 2016, 6:36:02 PM5/26/16
to dygraphs-users, banks...@gmail.com
Any updates on this? I couldn't find if this issue has been or not solved.
Reply all
Reply to author
Forward
0 new messages