Skip to content Skip to sidebar Skip to footer

Official Dygraphs.com Synchronize.html Demo Is Busted: My Version Too

I refer to http://dygraphs.com/tests/synchronize.html. Right now my own implementation is also giving me fits, which isn't surprising since I developed it as an edited version of t

Solution 1:

I do believe that it's most appropriate for me to answer my own question, though it is a bit awkward. I burned a number of hours on this simple thing since posting the question. Here's the code and the answer:

`    <scripttype="text/javascript">
  gs = [];
  var blockRedraw = false;
  var initialized = false;
  for (var i = 1; i <= 4; i++) {
    gs.push(
      newDygraph(
        document.getElementById("div" + i),
        NoisyData, {
          rollPeriod: 7,
          errorBars: true,
          drawCallback: function(me, initial) {
            if (blockRedraw || initial) return;
            blockRedraw = true;
            var range = me.xAxisRange();
            //var yrange = me.yAxisRange();for (var j = 0; j < 4; j++) {
              if (gs[j] == me) continue;
              gs[j].updateOptions( {
                dateWindow: range/*,
                valueRange: yrange*/
              } );
            }
            blockRedraw = false;
          }
        }
      )
    );
  }
</script>`

The code there is copied directly off of the dygraphs.com synchronize.html page except that I've commented out var yrange = me.yAxisRange() and also the valueRange part of the updateOptions() argument.

Apparently if you put those range values in there you are forestalling the auto scaling from happening. I don't really know what's happening under the hood but that seems to be the deal. It solves the problem for my own analogous implementation. (That is, I found that the jsfiddle version that dygraphs.com has provided doesn't actually draw the graphs, making it useless for testing. So I have only tested this on my version which is really almost the same.)

Post a Comment for "Official Dygraphs.com Synchronize.html Demo Is Busted: My Version Too"