-Dygraph.Circles = {
- DEFAULT : function(g, name, ctx, canvasx, canvasy, color, radius) {
- ctx.beginPath();
- ctx.fillStyle = color;
- ctx.arc(canvasx, canvasy, radius, 0, 2 * Math.PI, false);
- ctx.fill();
- },
- TRIANGLE : function(g, name, ctx, cx, cy, color, radius) {
- Dygraph.DrawPolygon_(3, Math.PI / 3, ctx, cx, cy, color, radius);
- },
- SQUARE : function(g, name, ctx, cx, cy, color, radius) {
- Dygraph.DrawPolygon_(4, Math.PI / 4, ctx, cx, cy, color, radius);
- },
- DIAMOND : function(g, name, ctx, cx, cy, color, radius) {
- Dygraph.DrawPolygon_(4, Math.PI / 4, ctx, cx, cy, color, radius, Math.PI / 8);
- },
- PENTAGON : function(g, name, ctx, cx, cy, color, radius) {
- Dygraph.DrawPolygon_(5, Math.PI / 5, ctx, cx, cy, color, radius);
- },
- HEXAGON : function(g, name, ctx, cx, cy, color, radius) {
- Dygraph.DrawPolygon_(6, Math.PI / 6, ctx, cx, cy, color, radius);
- },
- CIRCLE : function(g, name, ctx, cx, cy, color, radius) {
- ctx.beginPath();
- ctx.lineStyle = color;
- ctx.arc(cx, cy, radius, 0, 2 * Math.PI, false);
- ctx.fill();
- },
- STAR : function(g, name, ctx, cx, cy, color, radius) {
- Dygraph.DrawPolygon_(5, 2 * Math.PI / 5, ctx, cx, cy, color, radius);
+ // Try to figure out what happeend.
+ // If the value is the empty string, parse it as null.
+ if (/^ *$/.test(x)) return null;
+
+ // If it was actually "NaN", return it as NaN.
+ if (/^ *nan *$/i.test(x)) return NaN;
+
+ // Looks like a parsing error.
+ var msg = "Unable to parse '" + x + "' as a number";
+ if (opt_line !== undefined && opt_line_no !== undefined) {
+ msg += " on line " + (1+(opt_line_no||0)) + " ('" + opt_line + "') of CSV.";