--- /dev/null
+// This script can be used to check for errors/console warnings in _all_ the
+// files in tests/*.html.
+//
+// Suggested usage:
+//
+// npm install casperjs
+// for x in tests/*.html; casperjs scripts/casperscript.js $x
+
+var casper = require('casper').create({
+ verbose: true
+});
+var filename = casper.cli.args[0];
+
+casper.echo(filename);
+casper.on('remote.message', function(message) {
+ this.echo('page console: ' + message);
+});
+
+casper.on('resource.error', function(e) {
+ this.echo('resource.error: ' + e);
+});
+casper.on('page.error', function(e) {
+ this.echo('error! ' + e);
+});
+
+casper.start(filename, function() { });
+
+casper.run();
}
return ticks;
};
-
-// These are set here so that this file can be included after dygraph.js
-// or independently.
-// if (Dygraph &&
-// Dygraph.DEFAULT_ATTRS &&
-// Dygraph.DEFAULT_ATTRS['axes'] &&
-// Dygraph.DEFAULT_ATTRS['axes']['x'] &&
-// Dygraph.DEFAULT_ATTRS['axes']['y'] &&
-// Dygraph.DEFAULT_ATTRS['axes']['y2']) {
-// Dygraph.DEFAULT_ATTRS['axes']['x']['ticker'] = Dygraph.dateTicker;
-// Dygraph.DEFAULT_ATTRS['axes']['y']['ticker'] = Dygraph.numericTicks;
-// Dygraph.DEFAULT_ATTRS['axes']['y2']['ticker'] = Dygraph.numericTicks;
-// }
Dygraph.endPan = DygraphInteraction.endPan;
Dygraph.endZoom = DygraphInteraction.endZoom;
+Dygraph.numericLinearTicks = DygraphTickers.numericLinearTicks;
+Dygraph.numericTicks = DygraphTickers.numericTicks;
+Dygraph.dateTicker = DygraphTickers.dateTicker;
+Dygraph.Granularity = DygraphTickers.Granularity;
+Dygraph.getDateAxis = DygraphTickers.getDateAxis;
+Dygraph.floatFormat = utils.floatFormat;
+
export default Dygraph;
return [l1x, l1y, r1x, r1y];
}
+// i.e. is none of (null, undefined, NaN)
+function isOK(x) {
+ return !!x && !isNaN(x);
+};
// A plotter which uses splines to create a smooth curve.
// See tests/plotters.html for a demo.
// right control point for previous point
var lastRightX = points[0].canvasx, lastRightY = points[0].canvasy;
- var isOK = Dygraph.isOK; // i.e. is none of (null, undefined, NaN)
for (var i = 1; i < points.length; i++) {
var p0 = points[i - 1],
rollPeriod: 14,
errorBars: true,
labelsSeparateLines: true,
- yAxisLabelWidth: 20
+ axes: {
+ y: {
+ axisLabelWidth: 20
+ }
+ }
}
);
</script>
'boxShadow': '4px 4px 4px #888'
},
labelsSeparateLines: true,
- yAxisLabelWidth: 20
+ axes: {
+ y: {
+ axisLabelWidth: 20
+ }
+ }
}
);
</script>
<html>
-<head>
- <script src="../src/polyfills/dashed-canvas.js"></script>
-</head>
<body>
<p>You should see solid black and blue lines with a dashed red line in between
them:</p>
windowProps[k] = true;
}
</script>
- <!--
<script type="text/javascript" src="../dist/dygraph.js"></script>
- -->
- <script type="text/javascript" src="../dygraph-combined.js"></script>
<script type="text/javascript">
for (k in window) {
if (!windowProps.hasOwnProperty(k)) {
<iframe id="iframe" width=400 height=520 src="http://en.wikipedia.org/">iframe here</iframe>
<p>Click on various places in the chart, then drag the mouse over the iframe
- and release it. When you mouse back over the charts, strange things will
+ and release it. When you mouse back over the charts, strange things shouldn't
happen.</p>
<script type="text/javascript">
</table>
<script type="text/javascript">
- Dygraph.addEvent(document, "mousewheel", function() { lastClickedGraph = null; });
- Dygraph.addEvent(document, "click", function() { lastClickedGraph = null; });
+ document.addEventListener("mousewheel", function() {
+ lastClickedGraph = null;
+ }, false);
+ document.addEventListener("click", function() { lastClickedGraph = null; }, false);
var g = new Dygraph(document.getElementById("div_g"),
NoisyData, { errorBars : true });
var s = document.getElementById("g2_console");
function clickV3(event, g, context) {
lastClickedGraph = g;
- Dygraph.cancelEvent(event);
+ event.preventDefault();
+ event.stopPropagation();
}
function scrollV3(event, g, context) {
var yPct = percentages[1];
zoom(g, percentage, xPct, yPct);
- Dygraph.cancelEvent(event);
+ event.preventDefault();
+ event.stopPropagation();
}
// Adjusts [x, y] toward each other by zoomInPercentage%
});
var g3 = new Dygraph(document.getElementById("labelsKMG2yValueFormatter"), data, {
labelsKMG2: true,
- yValueFormatter: formatValue,
+ axes: {
+ y: {
+ valueFormatter: formatValue
+ }
+ },
labels: ['Base', 'Power']
});
"7,0\n"+
"8,100\n"+
"9,500\n"+
- "101,500\n"+
"30,500\n"+
"50,400\n"+
"100,300\n"+
+ "101,500\n"+
"300,200\n"+
"1000,100\n"+
"";
title: 'Four series on the same scale',
xlabel: 'Date',
ylabel: 'Count',
- yAxisLabelWidth: 80
+ axes: {
+ y: {
+ axisLabelWidth: 80
+ }
+ }
}
);
</script>
<script type="text/javascript" src="../dist/dygraph.js"></script>
<!-- Include the Javascript for the plug-in -->
- <script type="text/javascript" src="../extras/unzoom.js"></script>
+ <script type="text/javascript" src="../src/extras/unzoom.js"></script>
</head>
<body>
<h2>Plugins Demo</h2>
drawAxis : false
}
},
+ labels: ['X', 'Y'],
showRangeSelector: true,
rangeSelectorHeight: 30
}
<head>
<title>Plotters demo</title>
<script type="text/javascript" src="../dist/dygraph.js"></script>
- <script type="text/javascript" src="../extras/smooth-plotter.js"></script>
+ <script type="text/javascript" src="../src/extras/smooth-plotter.js"></script>
<style type="text/css">
body {
document.getElementById("div_g"),
data, {
rollPeriod: 7,
- pixelsPerYLabel: 20
+ axes: {
+ y: {
+ pixelsPerLabel: 20
+ }
+ }
}
);
g2 = new Dygraph(
document.getElementById("div_g2"),
data, {
rollPeriod: 7,
- pixelsPerYLabel: 20
+ axes: {
+ y: {
+ pixelsPerLabel: 20
+ }
+ }
}
);
</script>
},
ylabel: 'Primary y-axis',
y2label: 'Secondary y-axis',
- yAxisLabelWidth: 60
+ axes: {
+ y: {
+ axisLabelWidth: 60
+ }
+ }
}
);
},
axes: {
y: {
- valueRange: [40, 80]
+ valueRange: [40, 80],
+ axisLabelWidth: 60
},
y2: {
// set axis-related properties here
}
},
ylabel: 'Primary y-axis',
- y2label: 'Secondary y-axis',
- yAxisLabelWidth: 60
+ y2label: 'Secondary y-axis'
}
);
},
},
axes: {
+ y: {
+ axisLabelWidth: 60
+ },
y2: {
// set axis-related properties here
labelsKMB: true
},
ylabel: 'Primary y-axis',
y2label: 'Secondary y-axis',
- yAxisLabelWidth: 60
}
);
'Y3': { axis: 'y2' },
'Y4': { axis: 'y2' }
},
- xAxisLabelWidth: 100,
- yAxisLabelWidth: 100,
axes: {
x: {
valueFormatter: function(ms) {
return 'xalf(' + formatDate(d) + ')';
},
pixelsPerLabel: 100,
+ axisLabelWidth: 100,
},
y: {
valueFormatter: function(y) {
},
axisLabelFormatter: function(y) {
return 'yalf(' + y.toPrecision(2) + ')';
- }
+ },
+ axisLabelWidth: 100
},
y2: {
valueFormatter: function(y2) {
"2009/07/12 05:00:00,3,6\n" +
"2009/07/12 06:00:00,4,6"
}
+ function zeropad(x) {
+ return (x < 10) ? '0' + x : x;
+ }
var g1 = new Dygraph(
document.getElementById("normal"),
document.getElementById("seconds"),
HourlyData(),
{
- xAxisLabelWidth: 70,
axes: {
x: {
+ axisLabelWidth: 70,
axisLabelFormatter: function(d, gran) {
- return Dygraph.zeropad(d.getHours()) + ":"
- + Dygraph.zeropad(d.getMinutes()) + ":"
- + Dygraph.zeropad(d.getSeconds());
+ return zeropad(d.getHours()) + ":"
+ + zeropad(d.getMinutes()) + ":"
+ + zeropad(d.getSeconds());
}
}
}