g.updateOptions({
dateWindow: dateWindow
});
- Dygraph.cancelEvent(event);
+ event.preventDefault();
}
},
strokeWidth: 1.5,
gridLineColor: 'rgb(196, 196, 196)',
- drawYGrid: false,
- drawYAxis: false
+ axes: {
+ x: {
+ drawAxis: false
+ },
+ y: {
+ drawGrid: false
+ }
+ }
});
window.onmouseup = finishDraw;
}
var g = new Dygraph(gdiv, data, {
labels: ['x', 'A', 'B'],
- labelDivWidth: 100,
+ labelsDivWidth: 100,
gridLineColor: '#ccc',
includeZero: true,
width: 250,
'8,8, \n' +
'10,10, \n',
{
- labels: ['x', 'A', 'B' ],
connectSeparatedPoints: true,
drawPoints: true
}
<title>Dygraphs Gallery</title>
<script src="../dist/dygraph.js"></script>
- <script src="../extras/synchronizer.js"></script>
+ <script src="../src/extras/synchronizer.js"></script>
<script src="lib/jquery-1.4.2.js"></script>
<script src="../common/textarea.js"></script>
function clickV3(event, g, context) {
lastClickedGraph = g;
- Dygraph.cancelEvent(event);
+ event.preventDefault();;
}
function scrollV3(event, g, context) {
var yPct = percentages[1];
zoom(g, percentage, xPct, yPct);
- Dygraph.cancelEvent(event);
+ event.preventDefault();
}
// Adjusts [x, y] toward each other by zoomInPercentage%
},
run: function() {
var lastClickedGraph;
- // TODO(konigsberg): Add cleanup to remove callbacks.
- Dygraph.addEvent(document, "mousewheel", function() { lastClickedGraph = null; });
- Dygraph.addEvent(document, "click", function() { lastClickedGraph = null; });
+ document.addEventListener("mousewheel", function() { lastClickedGraph = null; });
+ document.addEventListener("click", function() { lastClickedGraph = null; });
new Dygraph(document.getElementById("div_g"),
NoisyData, { errorBars : true });
new Dygraph(document.getElementById("div_g2"),
},
underlayCallback : captureCanvas
});
+ },
+ clean: function() {
+ document.removeEventListener('mousewheel');
+ document.removeEventListener('click');
}
});
},
{
strokeWidth: 2,
- 'parabola': {
- strokeWidth: 0.0,
- drawPoints: true,
- pointSize: 4,
- highlightCircleSize: 6
- },
- 'line': {
- strokeWidth: 1.0,
- drawPoints: true,
- pointSize: 1.5
- },
- 'sine wave': {
- strokeWidth: 3,
- highlightCircleSize: 10
+ series: {
+ 'parabola': {
+ strokeWidth: 0.0,
+ drawPoints: true,
+ pointSize: 4,
+ highlightCircleSize: 6
+ },
+ 'line': {
+ strokeWidth: 1.0,
+ drawPoints: true,
+ pointSize: 1.5
+ },
+ 'sine wave': {
+ strokeWidth: 3,
+ highlightCircleSize: 10
+ }
}
}
);
-t [ envify --NODE_ENV development ] \
--debug \
-o dist/tests.js \
- auto_tests/tests/utils_test.js
-
-# auto_tests/tests/*.js
+ auto_tests/tests/*.js
GridPlugin
];
+// There are many symbols which have historically been available through the
+// Dygraph class. These are exported here for backwards compatibility.
Dygraph.GVizChart = GVizChart;
+Dygraph.DASHED_LINE = utils.DASHED_LINE;
+Dygraph.DOT_DASH_LINE = utils.DOT_DASH_LINE;
+Dygraph.dateAxisLabelFormatter = utils.dateAxisLabelFormatter;
+Dygraph.toRGB_ = utils.toRGB_;
+Dygraph.findPos = utils.findPos;
+Dygraph.pageX = utils.pageX;
+Dygraph.pageY = utils.pageY;
+Dygraph.dateString_ = utils.dateString_;
+Dygraph.defaultInteractionModel = DygraphInteraction.defaultModel;
+Dygraph.nonInteractiveModel = Dygraph.nonInteractiveModel_ = DygraphInteraction.nonInteractiveModel_;
+Dygraph.Circles = utils.Circles;
+
+Dygraph.Plugins = {
+ Legend: LegendPlugin,
+ Axes: AxesPlugin,
+ // ...
+};
+Dygraph.DataHandlers = {
+ DefaultHandler
+};
+
+Dygraph.startPan = DygraphInteraction.startPan;
+Dygraph.startZoom = DygraphInteraction.startZoom;
+Dygraph.movePan = DygraphInteraction.movePan;
+Dygraph.moveZoom = DygraphInteraction.moveZoom;
+Dygraph.endPan = DygraphInteraction.endPan;
+Dygraph.endZoom = DygraphInteraction.endZoom;
export default Dygraph;
/*global Dygraph:false */
(function() {
+
"use strict";
+ // Matches DefaultHandler.parseFloat
+ var parseFloat = function(val) {
+ if (val === null) return NaN;
+ return val;
+ };
+
Dygraph.DataHandlers.RebaseHandler = function(baseOpt) {
this.baseOpt = baseOpt;
};
for (var i = 0; i <= lastIdx; ++i) {
var item = series[i];
var yraw = item[1];
- var yval = yraw === null ? null : Dygraph.DataHandler.parseFloat(yraw);
+ var yval = yraw === null ? null : parseFloat(yraw);
if (yval !== null) {
if (i === firstIdx) {
yval = (this.baseOpt === "percent") ? 0 : this.baseOpt;
var point = {
x: NaN,
y: NaN,
- xval: Dygraph.DataHandler.parseFloat(item[0]),
+ xval: parseFloat(item[0]),
yval: yval,
name: setName,
idx: i + boundaryIdStart
};
};
-Dygraph.update(Dygraph.Circles, {
+var customCircles = {
TRIANGLE : shapeFunction(3),
SQUARE : shapeFunction(4, Math.PI / 4),
DIAMOND : shapeFunction(4),
ctx.closePath();
ctx.stroke();
}
-});
+};
+
+for (var k in customCircles) {
+ if (!customCircles.hasOwnProperty(k)) continue;
+ Dygraph.Circles[k] = customCircles[k];
+}
})();
if (tool == 'zoom') {
Dygraph.defaultInteractionModel.mousedown(event, g, context);
} else {
- // prevents mouse drags from selecting page text.
- if (event.preventDefault) {
- event.preventDefault(); // Firefox, Chrome, etc.
- } else {
- event.returnValue = false; // IE
- event.cancelBubble = true;
- }
+ event.preventDefault(); // Firefox, Chrome, etc.
isDrawing = true;
setPoint(event, g, context);
}
g.updateOptions({
dateWindow: dateWindow
});
- Dygraph.cancelEvent(event);
+ event.preventDefault();
}
},
strokeWidth: 1.5,
<link rel='stylesheet' href='http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css' />
- <script type="text/javascript" src="../extras/hairlines.js"></script>
- <script type="text/javascript" src="../extras/super-annotations.js"></script>
+ <script type="text/javascript" src="../src/extras/hairlines.js"></script>
+ <script type="text/javascript" src="../src/extras/super-annotations.js"></script>
<style>
#demodiv {
<div id="div_g1" style="width:600px; height:300px;"></div>
<script type="text/javascript">
- Dygraph.Interaction.DEBUG = true;
-
function data0() {
return "Date,A\n" +
"20101201,5\n"+