Merge pull request #678 from danvk/dygraphs-css
authorDan Vanderkam <danvdk@gmail.com>
Wed, 28 Sep 2016 12:50:36 +0000 (08:50 -0400)
committerGitHub <noreply@github.com>
Wed, 28 Sep 2016 12:50:36 +0000 (08:50 -0400)
Move styles over to CSS

111 files changed:
auto_tests/coverage.html
auto_tests/runner.html
auto_tests/tests/axis_labels.js
auto_tests/tests/pathological_cases.js
css/dygraph.css [new file with mode: 0644]
docs/annotations.html
gallery/border.js
gallery/edge-padding.js
gallery/index.html
gallery/range-selector.js
gallery/styled-chart-labels.js
gallery/temperature-sf-ny.js
src/dygraph-default-attrs.js
src/dygraph-options-reference.js
src/dygraph-utils.js
src/dygraph.js
src/plugins/annotations.js
src/plugins/axes.js
src/plugins/chart-labels.js
src/plugins/legend.js
tests/annotation-native.html
tests/annotation.html
tests/avoidMinZero.html
tests/border.html
tests/callback.html
tests/century-scale.html
tests/charting-combinations.html
tests/color-cycle.html
tests/color-visibility.html
tests/connect-separated.html
tests/crosshair.html
tests/css-positioning.html
tests/custom-bars.html
tests/custom-circles.html
tests/customLabel.html
tests/customLabelCss3.html
tests/dateWindow.html
tests/daylight-savings.html
tests/demo.html
tests/dense-fill.html
tests/draw-points.html
tests/drawing.html
tests/dygraph-many-points-benchmark.html
tests/dygraph.html
tests/dynamic-update.html
tests/exported-symbols.html
tests/fillGraph-alpha.html
tests/fillGraph.html
tests/fractions.html
tests/grid_dot.html
tests/gviz-infinity.html
tests/gviz-selection.html
tests/gviz.html
tests/hairlines.html
tests/highlighted-region.html
tests/hourly.html
tests/iframe.html
tests/independent-series.html
tests/interaction.html
tests/is-zoomed-ignore-programmatic-zoom.html
tests/is-zoomed.html
tests/isolated-points.html
tests/label-div.html
tests/labelsDateUTC.html
tests/labelsKMB.html
tests/layout-options.html
tests/legend-formatter.html
tests/legend-values.html
tests/linear-regression-addseries.html
tests/linear-regression-fractions.html
tests/linear-regression.html
tests/link-interaction.html
tests/logscale.html
tests/missing-data.html
tests/multi-scale.html
tests/native-format.html
tests/negative.html
tests/no-range.html
tests/no-visibility.html
tests/number-format.html
tests/numeric-axis.html
tests/numeric-gviz.html
tests/out-of-order.html
tests/per-series.html
tests/perf.html
tests/plotter.html
tests/plotters.html
tests/plugins.html
tests/range-selector.html
tests/resize.html
tests/reverse-y-axis.html
tests/series-highlight.html
tests/small-range-zero.html
tests/smooth-plots.html
tests/spacing.html
tests/stacked.html
tests/steps.html
tests/stock.html
tests/straw-broom.html
tests/styled-chart-labels.html
tests/synchronize.html
tests/temperature-sf-ny.html
tests/two-axes-vr.html
tests/two-axes.html
tests/unboxed-spark.html
tests/underlay-callback.html
tests/value-axis-formatters.html
tests/visibility.html
tests/x-axis-formatter.html
tests/zero-series.html
tests/zoom.html

index 0457347..e8cd24c 100644 (file)
@@ -3,6 +3,7 @@
   <meta charset="utf-8">
   <title>dygraphs tests</title>
   <link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
+  <link rel="stylesheet" href="../css/dygraph.css" />
 </head>
 <body>
   <div id="graph"></div>
index c3a3d87..2f48d5b 100644 (file)
@@ -3,6 +3,7 @@
   <meta charset="utf-8">
   <title>dygraphs tests</title>
   <link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
+  <link rel="stylesheet" href="../css/dygraph.css" />
 </head>
 <body>
   <div id="graph"></div>
index c390392..5a631fa 100644 (file)
@@ -798,75 +798,6 @@ it('testAxisLabelFontSizeNull', function() {
   assertFontSize(document.querySelectorAll(".dygraph-axis-label-y"), "14px");
 });
 
-it('testAxisLabelColor', function() {
-  var graph = document.getElementById("graph");
-  var g = new Dygraph(graph, simpleData, {});
-
-  // Be sure we're dealing with a black default.
-  assert.equal("black", DEFAULT_ATTRS.axisLabelColor);
-
-  var assertColor = function(selector, expected) {
-    Util.assertStyleOfChildren(selector, "color", expected);
-  }
-
-  assertColor(document.querySelectorAll(".dygraph-axis-label-x"), "rgb(0, 0, 0)");
-  assertColor(document.querySelectorAll(".dygraph-axis-label-y"), "rgb(0, 0, 0)");
-
-  g.updateOptions({ axisLabelColor : "red"});
-  assertColor(document.querySelectorAll(".dygraph-axis-label-x"), "rgb(255, 0, 0)"); 
-  assertColor(document.querySelectorAll(".dygraph-axis-label-y"), "rgb(255, 0, 0)"); 
-
-  g.updateOptions({
-    axisLabelColor : null,
-    axes : { 
-      x : { axisLabelColor : "blue" },
-    }   
-  }); 
-
-  assertColor(document.querySelectorAll(".dygraph-axis-label-x"), "rgb(0, 0, 255)"); 
-  assertColor(document.querySelectorAll(".dygraph-axis-label-y"), "rgb(0, 0, 0)");
-
-  g.updateOptions({
-    axes : { 
-      y : { axisLabelColor : "green" },
-    }   
-  }); 
-
-  assertColor(document.querySelectorAll(".dygraph-axis-label-x"), "rgb(0, 0, 255)"); 
-  assertColor(document.querySelectorAll(".dygraph-axis-label-y"), "rgb(0, 128, 0)"); 
-
-  g.updateOptions({
-    series : { 
-      Y2 : { axis : "y2" } // copy y2 series to y2 axis.
-    },  
-    axes : { 
-      y2 : { axisLabelColor : "yellow" },
-    }   
-  }); 
-
-  assertColor(document.querySelectorAll(".dygraph-axis-label-x"), "rgb(0, 0, 255)"); 
-  assertColor(document.querySelectorAll(".dygraph-axis-label-y1"), "rgb(0, 128, 0)"); 
-  assertColor(document.querySelectorAll(".dygraph-axis-label-y2"), "rgb(255, 255, 0)"); 
-});
-
-it('testAxisLabelColorNull', function() {
-  var graph = document.getElementById("graph");
-  var g = new Dygraph(graph, simpleData,
-    {
-      axisLabelColor: null
-    });
-
-  var assertColor = function(selector, expected) {
-    Util.assertStyleOfChildren(selector, "color", expected);
-  }
-
-  // Be sure we're dealing with a 14-point default.
-  assert.equal(14, DEFAULT_ATTRS.axisLabelFontSize);
-
-  assertColor(document.querySelectorAll(".dygraph-axis-label-x"), "rgb(0, 0, 0)");
-  assertColor(document.querySelectorAll(".dygraph-axis-label-y"), "rgb(0, 0, 0)");
-});
-
 /*
  * This test shows that the label formatter overrides labelsKMB for all values.
  */
index 0bcab0b..0fab200 100644 (file)
@@ -90,7 +90,6 @@ it('testCombinations', function() {
       var opts = {
         width: 300,
         height: 150,
-        labelsDivWidth: 100,
         pointSize: 10
       };
       for (var key in base) {
diff --git a/css/dygraph.css b/css/dygraph.css
new file mode 100644 (file)
index 0000000..75d5868
--- /dev/null
@@ -0,0 +1,117 @@
+/**
+ * Default styles for the dygraphs charting library.
+ */
+
+.dygraph-legend {
+  position: absolute;
+  font-size: 14px;
+  z-index: 10;
+  width: 250px;  /* labelsDivWidth */
+  /*
+  dygraphs determines these based on the presence of chart labels.
+  It might make more sense to create a wrapper div around the chart proper.
+  top: 0px;
+  right: 2px;
+  */
+  background: white;
+  line-height: normal;
+  text-align: left;
+  overflow: hidden;
+}
+
+/* styles for a solid line in the legend */
+.dygraph-legend-line {
+  display: inline-block;
+  position: relative;
+  bottom: .5ex;
+  padding-left: 1em;
+  height: 1px;
+  border-bottom-width: 2px;
+  border-bottom-style: solid;
+  /* border-bottom-color is set based on the series color */
+}
+
+/* styles for a dashed line in the legend, e.g. when strokePattern is set */
+.dygraph-legend-dash {
+  display: inline-block;
+  position: relative;
+  bottom: .5ex;
+  height: 1px;
+  border-bottom-width: 2px;
+  border-bottom-style: solid;
+  /* border-bottom-color is set based on the series color */
+  /* margin-right is set based on the stroke pattern */
+  /* padding-left is set based on the stroke pattern */
+}
+
+.dygraph-roller {
+  position: absolute;
+  z-index: 10;
+}
+
+/* This class is shared by all annotations, including those with icons */
+.dygraph-annotation {
+  position: absolute;
+  z-index: 10;
+  overflow: hidden;
+}
+
+/* This class only applies to annotations without icons */
+/* Old class name: .dygraphDefaultAnnotation */
+.dygraph-default-annotation {
+  border: 1px solid black;
+  background-color: white;
+  text-align: center;
+}
+
+.dygraph-axis-label {
+  /* position: absolute; */
+  /* font-size: 14px; */
+  z-index: 10;
+  line-height: normal;
+  overflow: hidden;
+  color: black;  /* replaces old axisLabelColor option */
+}
+
+.dygraph-axis-label-x {
+}
+
+.dygraph-axis-label-y {
+}
+
+.dygraph-axis-label-y2 {
+}
+
+.dygraph-title {
+  font-weight: bold;
+  z-index: 10;
+  text-align: center;
+  /* font-size: based on titleHeight option */
+}
+
+.dygraph-xlabel {
+  text-align: center;
+  /* font-size: based on xLabelHeight option */
+}
+
+/* For y-axis label */
+.dygraph-label-rotate-left {
+  text-align: center;
+  /* See http://caniuse.com/#feat=transforms2d */
+  transform: rotate(90deg);
+  -webkit-transform: rotate(90deg);
+  -moz-transform: rotate(90deg);
+  -o-transform: rotate(90deg);
+  -ms-transform: rotate(90deg);
+}
+
+/* For y2-axis label */
+.dygraph-label-rotate-right {
+  text-align: center;
+  /* See http://caniuse.com/#feat=transforms2d */
+  transform: rotate(-90deg);
+  -webkit-transform: rotate(-90deg);
+  -moz-transform: rotate(-90deg);
+  -o-transform: rotate(-90deg);
+  -ms-transform: rotate(-90deg);
+}
index 0a3ba17..9ed49b1 100644 (file)
@@ -6,6 +6,9 @@
   .annotation {
     font-size: 12px !important;
   }
+  .dygraph-legend {
+    width: 300px;
+  }
 </style>
 
 <h2>dygraphs Annotations</h2>
@@ -26,7 +29,6 @@ them.</p>
       showRoller: true,
       customBars: true,
       labelsKMB: true,
-      labelsDivWidth: 300
     }
   );
 
index b5e4f68..eacaf46 100644 (file)
@@ -6,12 +6,12 @@ Gallery.register(
     title: 'Graph stays within the border',
     setup: function(parent) {
       parent.innerHTML =
+          "<style>.dygraph-legend { border: 1px solid black; }</style>" +
           "<div id='bordered' style='border: 1px solid red; width:600px; height:300px;'></div>";
     },
     run: function() {
       new Dygraph(document.getElementById('bordered'), data,
       {
-        labelsDivStyles: { border: '1px solid black' },
         title: 'Chart Title',
         xlabel: 'Date',
         ylabel: 'Temperature (F)'
index be79054..5956d4a 100644 (file)
@@ -6,6 +6,7 @@ Gallery.register(
     title: 'Graph edge padding and axis position',
     setup: function(parent) {
       parent.innerHTML = (
+          "<style>.dygraph-legend { width: 100px; }</style>" +
           "<p>" +
           "  <b>Mode:</b>" +
           "    <input type='radio' name='mode'>use {x,y}RangePad</input>" +
@@ -39,7 +40,6 @@ Gallery.register(
 
           var g = new Dygraph(gdiv, data, {
               labels: ['x', 'A', 'B'],
-              labelsDivWidth: 100,
               gridLineColor: '#ccc',
               includeZero: true,
               width: 250,
index c953deb..a749cf0 100644 (file)
@@ -2,6 +2,7 @@
 <html>
   <head>
     <title>Dygraphs Gallery</title>
+    <link rel="stylesheet" href="../css/dygraph.css" />
 
     <script src="../dist/dygraph.js"></script>
     <script src="../src/extras/synchronizer.js"></script>
index 09bfd49..e243b43 100644 (file)
@@ -7,6 +7,11 @@ Gallery.register(
     title: 'Demo of the Range Selector',
     setup: function(parent) {
       parent.innerHTML = [
+          "<style>",
+          "  #darkbg .dygraph-axis-label { color: white; }",
+          "  .dygraph-legend { text-align: right; }",
+          "  #darkbg .dygraph-legend { background-color: #101015; }",
+          "</style>",
           "<p>No roll period.</p>",
           "<div id='noroll' style='width:600px; height:300px;'></div>",
           "",
@@ -27,7 +32,6 @@ Gallery.register(
             title: 'Daily Temperatures in New York vs. San Francisco',
             ylabel: 'Temperature (F)',
             legend: 'always',
-            labelsDivStyles: { 'textAlign': 'right' },
             showRangeSelector: true
           }
       );
@@ -41,7 +45,6 @@ Gallery.register(
             title: 'Daily Temperatures in New York vs. San Francisco',
             ylabel: 'Temperature (F)',
             legend: 'always',
-            labelsDivStyles: { 'textAlign': 'right' },
             showRangeSelector: true,
             rangeSelectorHeight: 30,
             rangeSelectorPlotStrokeColor: 'yellow',
@@ -58,11 +61,9 @@ Gallery.register(
               title: 'Nightly Temperatures in New York vs. San Francisco',
               ylabel: 'Temperature (F)',
               legend: 'always',
-              labelsDivStyles: { 'textAlign': 'right', 'backgroundColor': '#101015' },
               showRangeSelector: true,
               rangeSelectorPlotFillColor: 'MediumSlateBlue',
               rangeSelectorPlotFillGradientColor: 'rgba(123, 104, 238, 0)',
-              axisLabelColor: 'white',
               colorValue: 0.9,
               fillAlpha: 0.4
           }
index 0268f6d..6f8c3b4 100644 (file)
@@ -6,6 +6,7 @@ Gallery.register(
     title: 'Each chart label is styled independently with CSS',
     setup: function(parent) {
       parent.innerHTML = [
+          "<style>.dygraph-legend { text-align: right; background: none; }</style>",
           "<p class='infotext'>This chart's labels are styled</p>",
           "<div class='chart' id='div_g' style='width:600px; height:300px;'></div>",
           "<p class='infotext'>This version of the chart uses the default styles:</p>",
@@ -21,10 +22,6 @@ Gallery.register(
               titleHeight: 32,
               ylabel: 'Temperature (F)',
               xlabel: 'Date (Ticks indicate the start of the indicated time period)',
-              labelsDivStyles: {
-                'text-align': 'right',
-                'background': 'none'
-              },
               strokeWidth: 1.5
             }
           );
@@ -37,10 +34,6 @@ Gallery.register(
               title: 'High and Low Temperatures (30-day average)',
               ylabel: 'Temperature (F)',
               xlabel: 'Date (Ticks indicate the start of the indicated time period)',
-              labelsDivStyles: {
-                'text-align': 'right',
-                'background': 'none'
-              },
               strokeWidth: 1.5
             }
           );
index f2c9ad1..7e41310 100644 (file)
@@ -8,6 +8,7 @@ Gallery.register(
     title: 'Demo of a graph with many data points and custom error bars.',
     setup: function(parent) {
       parent.innerHTML = [
+          "<style>.dygraph-legend { text-align: right; }</style>",
           "<p>Roll period of 14 timesteps.</p>",
           "<div id='roll14' style='width:600px; height:300px;'></div>",
           "<p>No roll period.</p>",
@@ -23,7 +24,6 @@ Gallery.register(
             title: 'Daily Temperatures in New York vs. San Francisco',
             ylabel: 'Temperature (F)',
             legend: 'always',
-            labelsDivStyles: { 'textAlign': 'right' }
           }
       );
       new Dygraph(
@@ -36,7 +36,6 @@ Gallery.register(
             title: 'Daily Temperatures in New York vs. San Francisco',
             ylabel: 'Temperature (F)',
             legend: 'always',
-            labelsDivStyles: { 'textAlign': 'right' }
           }
       );
     }
index 5b7cb32..36cbd3e 100644 (file)
@@ -12,10 +12,6 @@ var DEFAULT_ATTRS = {
   highlightSeriesBackgroundAlpha: 0.5,
   highlightSeriesBackgroundColor: 'rgb(255, 255, 255)',
 
-  labelsDivWidth: 250,
-  labelsDivStyles: {
-    // TODO(danvk): move defaults from createStatusMessage_ here.
-  },
   labelsSeparateLines: false,
   labelsShowZeroValues: true,
   labelsKMB: false,
@@ -67,7 +63,6 @@ var DEFAULT_ATTRS = {
   axisLineColor: "black",
   axisLineWidth: 0.3,
   gridLineWidth: 0.3,
-  axisLabelColor: "black",
   axisLabelWidth: 50,
   gridLineColor: "rgb(128,128,128)",
 
index 4b1a23b..73615c2 100644 (file)
@@ -41,12 +41,6 @@ OPTIONS_REFERENCE =  // <JSON>
     "type": "integer",
     "description": "The size of the dot to draw on each point in pixels (see drawPoints). A dot is always drawn when a point is \"isolated\", i.e. there is a missing point on either side of it. This also controls the size of those dots."
   },
-  "labelsDivStyles": {
-    "default": "null",
-    "labels": ["Legend"],
-    "type": "{}",
-    "description": "Additional styles to apply to the currently-highlighted points div. For example, { 'fontWeight': 'bold' } will make the labels bold. In general, it is better to use CSS to style the .dygraph-legend class than to use this property."
-  },
   "drawPoints": {
     "default": "false",
     "labels": ["Data Line display"],
@@ -439,12 +433,6 @@ OPTIONS_REFERENCE =  // <JSON>
     "example": "[10, 110]",
     "description": "Explicitly set the vertical range of the graph to [low, high]. This may be set on a per-axis basis to define each y-axis separately. If either limit is unspecified, it will be calculated automatically (e.g. [null, 30] to automatically calculate just the lower bound)"
   },
-  "labelsDivWidth": {
-    "default": "250",
-    "labels": ["Legend"],
-    "type": "integer",
-    "description": "Width (in pixels) of the div which shows information on the currently-highlighted points."
-  },
   "colorSaturation": {
     "default": "1.0",
     "labels": ["Data Series Colors"],
@@ -695,12 +683,6 @@ OPTIONS_REFERENCE =  // <JSON>
     "type": "float (0.0 - 1.0)",
     "description" : "Error bars (or custom bars) for each series are drawn in the same color as the series, but with partial transparency. This sets the transparency. A value of 0.0 means that the error bars will not be drawn, whereas a value of 1.0 means that the error bars will be as dark as the line for the series itself. This can be used to produce chart lines whose thickness varies at each point."
   },
-  "axisLabelColor": {
-    "default": "black",
-    "labels": ["Axis display"],
-    "type": "string",
-    "description" : "Color for x- and y-axis labels. This is a CSS color string."
-  },
   "axisLabelWidth": {
     "default": "50 (y-axis), 60 (x-axis)",
     "labels": ["Axis display", "Chart labels"],
index 79215d4..8e972a6 100644 (file)
@@ -837,7 +837,6 @@ var pixelSafeOptions = {
   'annotationDblClickHandler': true,
   'annotationMouseOutHandler': true,
   'annotationMouseOverHandler': true,
-  'axisLabelColor': true,
   'axisLineColor': true,
   'axisLineWidth': true,
   'clickCallback': true,
@@ -855,8 +854,6 @@ var pixelSafeOptions = {
   'interactionModel': true,
   'isZoomedIgnoreProgrammaticZoom': true,
   'labelsDiv': true,
-  'labelsDivStyles': true,
-  'labelsDivWidth': true,
   'labelsKMB': true,
   'labelsKMG2': true,
   'labelsSeparateLines': true,
index 3ffc2e6..ce9f110 100644 (file)
@@ -1029,32 +1029,28 @@ Dygraph.prototype.getPropertiesForSeries = function(series_name) {
  */
 Dygraph.prototype.createRollInterface_ = function() {
   // Create a roller if one doesn't exist already.
-  if (!this.roller_) {
-    this.roller_ = document.createElement("input");
-    this.roller_.type = "text";
-    this.roller_.style.display = "none";
-    this.graphDiv.appendChild(this.roller_);
+  var roller = this.roller_;
+  if (!roller) {
+    this.roller_ = roller = document.createElement("input");
+    roller.type = "text";
+    roller.style.display = "none";
+    roller.className = 'dygraph-roller';
+    this.graphDiv.appendChild(roller);
   }
 
   var display = this.getBooleanOption('showRoller') ? 'block' : 'none';
 
-  var area = this.plotter_.area;
-  var textAttr = { "position": "absolute",
-                   "zIndex": 10,
+  var area = this.getArea();
+  var textAttr = {
                    "top": (area.y + area.h - 25) + "px",
                    "left": (area.x + 1) + "px",
                    "display": display
-                  };
-  this.roller_.size = "2";
-  this.roller_.value = this.rollPeriod_;
-  for (var name in textAttr) {
-    if (textAttr.hasOwnProperty(name)) {
-      this.roller_.style[name] = textAttr[name];
-    }
-  }
+                 };
+  roller.size = "2";
+  roller.value = this.rollPeriod_;
+  utils.update(roller.style, textAttr);
 
-  var dygraph = this;
-  this.roller_.onchange = function() { dygraph.adjustRoll(dygraph.roller_.value); };
+  roller.onchange = () => this.adjustRoll(roller.value);
 };
 
 /**
@@ -3340,7 +3336,6 @@ Dygraph.prototype.size = function() {
  */
 Dygraph.prototype.setAnnotations = function(ann, suppressDraw) {
   // Only add the annotation CSS rule once we know it will be used.
-  Dygraph.addAnnotationRule();
   this.annotations_ = ann;
   if (!this.layout_) {
     console.warn("Tried to setAnnotations before dygraph was ready. " +
@@ -3431,48 +3426,6 @@ Dygraph.prototype.ready = function(callback) {
 };
 
 /**
- * @private
- * Adds a default style for the annotation CSS classes to the document. This is
- * only executed when annotations are actually used. It is designed to only be
- * called once -- all calls after the first will return immediately.
- */
-Dygraph.addAnnotationRule = function() {
-  // TODO(danvk): move this function into plugins/annotations.js?
-  if (Dygraph.addedAnnotationCSS) return;
-
-  var rule = "border: 1px solid black; " +
-             "background-color: white; " +
-             "text-align: center;";
-
-  var styleSheetElement = document.createElement("style");
-  styleSheetElement.type = "text/css";
-  document.getElementsByTagName("head")[0].appendChild(styleSheetElement);
-
-  // Find the first style sheet that we can access.
-  // We may not add a rule to a style sheet from another domain for security
-  // reasons. This sometimes comes up when using gviz, since the Google gviz JS
-  // adds its own style sheets from google.com.
-  for (var i = 0; i < document.styleSheets.length; i++) {
-    if (document.styleSheets[i].disabled) continue;
-    var mysheet = document.styleSheets[i];
-    try {
-      if (mysheet.insertRule) {  // Firefox
-        var idx = mysheet.cssRules ? mysheet.cssRules.length : 0;
-        mysheet.insertRule(".dygraphDefaultAnnotation { " + rule + " }", idx);
-      } else if (mysheet.addRule) {  // IE
-        mysheet.addRule(".dygraphDefaultAnnotation", rule);
-      }
-      Dygraph.addedAnnotationCSS = true;
-      return;
-    } catch(err) {
-      // Was likely a security exception.
-    }
-  }
-
-  console.warn("Unable to add default annotation CSS rule; display may be off.");
-};
-
-/**
  * Add an event handler. This event handler is kept until the graph is
  * destroyed with a call to graph.destroy().
  *
index 46d0891..87153c8 100644 (file)
@@ -56,12 +56,6 @@ annotations.prototype.didDrawChart = function(e) {
   if (!points || points.length === 0) return;
 
   var containerDiv = e.canvas.parentNode;
-  var annotationStyle = {
-    "position": "absolute",
-    "fontSize": g.getOption('axisLabelFontSize') + "px",
-    "zIndex": 10,
-    "overflow": "hidden"
-  };
 
   var bindEvt = function(eventName, classEventName, pt) {
     return function(annotation_event) {
@@ -75,7 +69,7 @@ annotations.prototype.didDrawChart = function(e) {
   };
 
   // Add the annotations one-by-one.
-  var area = e.dygraph.plotter_.area;
+  var area = e.dygraph.getArea();
 
   // x-coord to sum of previous annotation's heights (used for stacking).
   var xToUsedHeight = {};
@@ -93,18 +87,18 @@ annotations.prototype.didDrawChart = function(e) {
       tick_height = a.tickHeight;
     }
 
+    // TODO: deprecate axisLabelFontSize in favor of CSS
     var div = document.createElement("div");
-    for (var name in annotationStyle) {
-      if (annotationStyle.hasOwnProperty(name)) {
-        div.style[name] = annotationStyle[name];
-      }
-    }
+    div.style['fontSize'] = g.getOption('axisLabelFontSize') + "px";
+    var className = 'dygraph-annotation';
     if (!a.hasOwnProperty('icon')) {
-      div.className = "dygraphDefaultAnnotation";
+      // camelCase class names are deprecated.
+      className += ' dygraphDefaultAnnotation dygraph-default-annotation';
     }
     if (a.hasOwnProperty('cssClass')) {
-      div.className += " " + a.cssClass;
+      className += " " + a.cssClass;
     }
+    div.className = className;
 
     var width = a.hasOwnProperty('width') ? a.width : 16;
     var height = a.hasOwnProperty('height') ? a.height : 16;
index f93f36f..2d9e31f 100644 (file)
@@ -19,6 +19,8 @@ Options left to make axis-friendly.
   ('xAxisHeight')
 */
 
+import * as utils from '../dygraph-utils';
+
 /**
  * Draws the axes. This includes the labels on the x- and y-axes, as well
  * as the tick marks on the axes.
@@ -115,19 +117,14 @@ axes.prototype.willDrawChart = function(e) {
     return {
       position: 'absolute',
       fontSize: g.getOptionForAxis('axisLabelFontSize', axis) + 'px',
-      zIndex: 10,
-      color: g.getOptionForAxis('axisLabelColor', axis),
       width: g.getOptionForAxis('axisLabelWidth', axis) + 'px',
-      // height: g.getOptionForAxis('axisLabelFontSize', 'x') + 2 + "px",
-      lineHeight: 'normal',  // Something other than "normal" line-height screws up label positioning.
-      overflow: 'hidden'
     };
   };
 
   var labelStyles = {
-    x : makeLabelStyle('x'),
-    y : makeLabelStyle('y'),
-    y2 : makeLabelStyle('y2')
+    x: makeLabelStyle('x'),
+    y: makeLabelStyle('y'),
+    y2: makeLabelStyle('y2')
   };
 
   var makeDiv = function(txt, axis, prec_axis) {
@@ -139,11 +136,8 @@ axes.prototype.willDrawChart = function(e) {
      */
     var div = document.createElement('div');
     var labelStyle = labelStyles[prec_axis == 'y2' ? 'y2' : axis];
-    for (var name in labelStyle) {
-      if (labelStyle.hasOwnProperty(name)) {
-        div.style[name] = labelStyle[name];
-      }
-    }
+    utils.update(div.style, labelStyle);
+    // TODO: combine outer & inner divs
     var inner_div = document.createElement('div');
     inner_div.className = 'dygraph-axis-label' +
                           ' dygraph-axis-label-' + axis +
@@ -202,6 +196,7 @@ axes.prototype.willDrawChart = function(e) {
         } else {
           label.style.top = top + 'px';
         }
+        // TODO: replace these with css classes?
         if (tick.axis === 0) {
           label.style.left = (area.x - getAxisOption('axisLabelWidth') - getAxisOption('axisTickSize')) + 'px';
           label.style.textAlign = 'right';
index 5fbbdc5..2d09fc8 100644 (file)
@@ -79,16 +79,8 @@ var createRotatedDiv = function(g, box, axis, classes, html) {
   inner_div.style.height = box.w + 'px';
   inner_div.style.top = (box.h / 2 - box.w / 2) + 'px';
   inner_div.style.left = (box.w / 2 - box.h / 2) + 'px';
-  inner_div.style.textAlign = 'center';
-
-  // CSS rotation is an HTML5 feature which is not standardized. Hence every
-  // browser has its own name for the CSS style.
-  var val = 'rotate(' + (axis == 1 ? '-' : '') + '90deg)';
-  inner_div.style.transform = val;        // HTML5
-  inner_div.style.WebkitTransform = val;  // Safari/Chrome
-  inner_div.style.MozTransform = val;     // Firefox
-  inner_div.style.OTransform = val;       // Opera
-  inner_div.style.msTransform = val;      // IE9
+  // TODO: combine inner_div and class_div.
+  inner_div.className = 'dygraph-label-rotate-' + (axis == 1 ? 'right' : 'left');
 
   var class_div = document.createElement("div");
   class_div.className = classes;
@@ -108,10 +100,7 @@ chart_labels.prototype.layout = function(e) {
     // QUESTION: should this return an absolutely-positioned div instead?
     var title_rect = e.reserveSpaceTop(g.getOption('titleHeight'));
     this.title_div_ = createDivInRect(title_rect);
-    this.title_div_.style.textAlign = 'center';
     this.title_div_.style.fontSize = (g.getOption('titleHeight') - 8) + 'px';
-    this.title_div_.style.fontWeight = 'bold';
-    this.title_div_.style.zIndex = 10;
 
     var class_div = document.createElement("div");
     class_div.className = 'dygraph-label dygraph-title';
@@ -123,7 +112,6 @@ chart_labels.prototype.layout = function(e) {
   if (g.getOption('xlabel')) {
     var x_rect = e.reserveSpaceBottom(g.getOption('xLabelHeight'));
     this.xlabel_div_ = createDivInRect(x_rect);
-    this.xlabel_div_.style.textAlign = 'center';
     this.xlabel_div_.style.fontSize = (g.getOption('xLabelHeight') - 2) + 'px';
 
     var class_div = document.createElement("div");
index 96e68f4..8b91841 100644 (file)
@@ -35,9 +35,6 @@ Legend.prototype.toString = function() {
   return "Legend Plugin";
 };
 
-// (defined below)
-var generateLegendDashHTML;
-
 /**
  * This is called during the dygraph constructor, after options have been set
  * but before the data is available.
@@ -52,7 +49,6 @@ var generateLegendDashHTML;
  */
 Legend.prototype.activate = function(g) {
   var div;
-  var divWidth = g.getOption('labelsDivWidth');
 
   var userLabelsDiv = g.getOption('labelsDiv');
   if (userLabelsDiv && null !== userLabelsDiv) {
@@ -62,35 +58,8 @@ Legend.prototype.activate = function(g) {
       div = userLabelsDiv;
     }
   } else {
-    // Default legend styles. These can be overridden in CSS by adding
-    // "!important" after your rule, e.g. "left: 30px !important;"
-    var messagestyle = {
-      "position": "absolute",
-      "fontSize": "14px",
-      "zIndex": 10,
-      "width": divWidth + "px",
-      "top": "0px",
-      "left": (g.size().width - divWidth - 2) + "px",
-      "background": "white",
-      "lineHeight": "normal",
-      "textAlign": "left",
-      "overflow": "hidden"};
-
-    // TODO(danvk): get rid of labelsDivStyles? CSS is better.
-    utils.update(messagestyle, g.getOption('labelsDivStyles'));
     div = document.createElement("div");
     div.className = "dygraph-legend";
-    for (var name in messagestyle) {
-      if (!messagestyle.hasOwnProperty(name)) continue;
-
-      try {
-        div.style[name] = messagestyle[name];
-      } catch (e) {
-        console.warn("You are using unsupported css properties for your " +
-            "browser in labelsDivStyles");
-      }
-    }
-
     // TODO(danvk): come up with a cleaner way to expose this.
     g.graphDiv.appendChild(div);
     this.is_generated_div_ = true;
@@ -136,7 +105,7 @@ Legend.prototype.select = function(e) {
   if (legendMode === 'follow') {
     // create floating legend div
     var area = e.dygraph.plotter_.area;
-    var labelsDivWidth = e.dygraph.getOption('labelsDivWidth');
+    var labelsDivWidth = this.legend_div.offsetWidth;
     var yAxisLabelWidth = e.dygraph.getOptionForAxis('axisLabelWidth', 'y');
     // determine floating [left, top] coordinates of the legend div
     // within the plotter_ area
@@ -195,10 +164,9 @@ Legend.prototype.predraw = function(e) {
   // TODO(danvk): only use real APIs for this.
   e.dygraph.graphDiv.appendChild(this.legend_div_);
   var area = e.dygraph.getArea();
-  var labelsDivWidth = e.dygraph.getOption("labelsDivWidth");
+  var labelsDivWidth = this.legend_div_.offsetWidth;
   this.legend_div_.style.left = area.x + area.w - labelsDivWidth - 1 + "px";
   this.legend_div_.style.top = area.y + "px";
-  this.legend_div_.style.width = labelsDivWidth + "px";
 };
 
 /**
@@ -341,12 +309,10 @@ Legend.defaultFormatter = function(data) {
  * @private
  */
 // TODO(danvk): cache the results of this
-generateLegendDashHTML = function(strokePattern, color, oneEmWidth) {
+function generateLegendDashHTML(strokePattern, color, oneEmWidth) {
   // Easy, common case: a solid line
   if (!strokePattern || strokePattern.length <= 1) {
-    return "<div style=\"display: inline-block; position: relative; " +
-    "bottom: .5ex; padding-left: 1em; height: 1px; " +
-    "border-bottom: 2px solid " + color + ";\"></div>";
+    return `<div class="dygraph-legend-line" style="border-bottom-color: ${color};"></div>`;
   }
 
   var i, j, paddingLeft, marginRight;
@@ -393,10 +359,7 @@ generateLegendDashHTML = function(strokePattern, color, oneEmWidth) {
         // The repeated first segment has no right margin.
         marginRight = 0;
       }
-      dash += "<div style=\"display: inline-block; position: relative; " +
-        "bottom: .5ex; margin-right: " + marginRight + "em; padding-left: " +
-        paddingLeft + "em; height: 1px; border-bottom: 2px solid " + color +
-        ";\"></div>";
+      dash += `<div class="dygraph-legend-dash" style="margin-right: ${marginRight}em; padding-left: ${paddingLeft}em;"></div>`;
     }
   }
   return dash;
index a003497..4e4538d 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Native format annotations</title>
     <script type="text/javascript" src="../dist/dygraph.js"></script>
   </head>
index 6d477e2..4cdcb10 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>demo</title>
     <!--
     <script type="text/javascript" src="dygraph-combined.js"></script>
index a688770..b89e52d 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>dygraph</title>
     <!--
     For production (minified) code, use:
index 89c8313..03dc0a1 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>gadget border</title>
     <!--
     For production (minified) code, use:
@@ -13,6 +14,9 @@
     #bordered {
       border: 1px solid red;
     }
+    .dygraph-legend {
+      border: 1px solid black;
+    }
     </style>
   </head>
   <body>
@@ -21,7 +25,6 @@
     <script type="text/javascript">
     var g = new Dygraph(document.getElementById('bordered'), data,
     {
-      labelsDivStyles: { border: '1px solid black' },
       title: 'Chart Title',
       xlabel: 'Date',
       ylabel: 'Temperature (F)'
index c659930..fc3450c 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>callbacks</title>
     <!--
     For production (minified) code, use:
index 8423715..4dad758 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>demo</title>
     <!--
     For production (minified) code, use:
index 8f2ecaf..18157a6 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Charting combinations</title>
     <script type="text/javascript" src="../dist/dygraph.js"></script>
     <script type="text/javascript" src="data.js"></script>
index 53da503..9cbf071 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>color cycles</title>
     <!--
     For production (minified) code, use:
index c0e6941..73a3b6a 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>color visibility</title>
     <!--
     For production (minified) code, use:
index ef6034d..f0d8294 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>connect separated</title>
     <!--
     For production (minified) code, use:
index 25eb8d8..dffdf03 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>crosshairs</title>
     <!--
     For production (minified) code, use:
index 2db8d69..11238c5 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>demo</title>
     <script type="text/javascript" src="../dist/dygraph.js"></script>
     <style>
index faa08ad..a2f633e 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>custom bars</title>
     <!--
     For production (minified) code, use:
index 55cc0bb..5f988f2 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Custom Circles</title>
     <!--
     For production (minified) code, use:
index c4ebee7..74fc6d6 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Label styles</title>
     <!--
     For production (minified) code, use:
index 2b1b55a..ae08bf7 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Label styles</title>
     <!--
     For production (minified) code, use:
@@ -9,6 +10,16 @@
     <script type="text/javascript" src="../dist/dygraph.js"></script>
 
     <script type="text/javascript" src="data.js"></script>
+    <style>
+      .dygraph-legend {
+        background-color: rgba(200, 200, 255, 0.75);
+        padding: 4px;
+        border: 1px solid black;
+        border-radius: 10px;
+        box-shadow: 4px 4px 4px #888;
+        width: 100px;
+      }
+    </style>
   </head>
   <body>
     <p>Labels are styled with css3:</p>
             NoisyData, {
               rollPeriod: 14,
               errorBars: true,
-              labelsDivWidth: 100,
-              labelsDivStyles: {
-                'backgroundColor': 'rgba(200, 200, 255, 0.75)',
-                'padding': '4px',
-                'border': '1px solid black',
-                'borderRadius': '10px',
-                'boxShadow': '4px 4px 4px #888'
-              },
               labelsSeparateLines: true,
               axes: {
                 y: {
index 96926e4..89c7969 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>dateWindow</title>
     <!--
     For production (minified) code, use:
index b52a654..2e250aa 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Daylight Savings</title>
     <!--
     For production (minified) code, use:
index 2c72699..af01cc5 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>demo</title>
     <!--
     <script type="text/javascript" src="../dist/dygraph.js"></script>
index d2d50fe..033600b 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>dense, filled plots</title>
     <script type="text/javascript" src="../dist/dygraph.js"></script>
     <style>
index 8b062ab..2a04a17 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>individual points</title>
     <!--
     For production (minified) code, use:
index 270b44e..03a9b50 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Dygraphs Drawing Demo</title>
     <!--
     For production (minified) code, use:
index 5b94eb3..5f98755 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Benchmarking for Plots with Many Points</title>
     <!--
     For production (minified) code, use:
index 6795b8c..dd282d1 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>dygraph</title>
     <!--
     For production (minified) code, use:
index 12b46a5..22f53be 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Live random data</title>
     <!--
     For production (minified) code, use:
index 0800823..698f2c0 100644 (file)
@@ -1,6 +1,7 @@
 <!doctype html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Exported Symbols test</title>
   </head>
   <body>
index 751838e..9a952d4 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>fillGraph with per series fillAlpha</title>
     <!--
     For production (minified) code, use:
index d21770d..3e03cd2 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>fillGraph</title>
     <!--
     For production (minified) code, use:
index d4dec6a..4e7ac3d 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Fractions</title>
     <!--
     For production (minified) code, use:
index 3259468..ec783ae 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Custom grid and Dot</title>
     <!--
     For production (minified) code, use:
index aa2cc25..8694172 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>gviz</title>
     <!--
     For production (minified) code, use:
index 61dfaff..39a90d6 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>gviz selection</title>
     <!--
     For production (minified) code, use:
index ba3953f..e06fcf9 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>gviz</title>
     <!--
     For production (minified) code, use:
index 1ffe163..6f03b39 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Hairlines demo</title>
     <script type="text/javascript" src="../dist/dygraph.js"></script>
 
index be2986b..f932c86 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Highlighted Region</title>
     <!--
     For production (minified) code, use:
index 5b5a5c7..9a526d6 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>hourly</title>
     <!--
     For production (minified) code, use:
index d3189f9..93f40df 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>demo</title>
     <script type="text/javascript" src="../dist/dygraph.js"></script>
 
index 1a2153f..b9f07bf 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Independent Series</title>
     <!--
     For production (minified) code, use:
index 8b64843..6d35238 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>interaction model</title>
     <!--
     For production (minified) code, use:
index 134dec9..cffc8be 100644 (file)
@@ -1,5 +1,6 @@
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>isZoomedIgnoreProgrammaticZoom Flag</title>
     <!--
     For production (minified) code, use:
index e3d72ce..1becb2e 100644 (file)
@@ -1,5 +1,6 @@
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>isZoomedIgnoresProgrammaticZoom Flag</title>
     <!--
     For production (minified) code, use:
index 6b8e7d4..045fbad 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>isolated points</title>
     <!--
     For production (minified) code, use:
index 47f1199..b3cd9b6 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>label-div</title>
     <!--
     For production (minified) code, use:
index fe26753..27b7101 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>UTC date labels</title>
     <!--
     For production (minified) code, use:
index 3b44160..fc125c8 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>labelsKMB</title>
     <!--
     For production (minified) code, use:
index 1051976..c4f7ce7 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Layout Options</title>
     <!--
     For production (minified) code, use:
index 10b7c94..b1c506a 100644 (file)
@@ -1,4 +1,5 @@
 <!DOCTYPE html>
+    <link rel="stylesheet" href="../css/dygraph.css">
 <title>legendFormatter</title>
 <style>
 #demodiv {
index c5eec30..da61c0a 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Label styles</title>
     <!--
     For production (minified) code, use:
@@ -17,6 +18,7 @@
         border-radius: 10px;
         box-shadow: 4px 4px 4px #888;
         pointer-events: none;
+        width: 100px;
       }
       pre {
         margin-top: 30px;
@@ -52,7 +54,6 @@
       var baseOpts = {
         rollPeriod: 14,
         errorBars: true,
-        labelsDivWidth: 100,
         labelsSeparateLines: true
       };
 
index f5becaf..2efffb1 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Linear Regression</title>
     <!--
     For production (minified) code, use:
index a2306bb..54c299a 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Linear Regression</title>
     <!--
     For production (minified) code, use:
index 5caae90..873e7ca 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Linear Regression</title>
     <!--
     For production (minified) code, use:
index 93a0bab..c49ac42 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>noise</title>
     <!--
     For production (minified) code, use:
index fda64dd..ca21b92 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>log scale</title>
     <!--
     For production (minified) code, use:
index f337de5..3fd8d60 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>missing data</title>
     <!--
     For production (minified) code, use:
index 478111b..d49fdad 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>multi-scale</title>
     <script type="text/javascript" src="../dist/dygraph.js"></script>
     <style type="text/css">
index 178aefc..2cf59cd 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Native Format</title>
     <!--
     For production (minified) code, use:
index 8a2ad22..e3baf20 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>negatives</title>
     <!--
     For production (minified) code, use:
index 2984c50..e05a40c 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>no range</title>
     <!--
     For production (minified) code, use:
index f01bf3f..b253433 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>no-visibility</title>
     <!--
     For production (minified) code, use:
index c81896d..3f604d2 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Test of number formatting</title>
     <!--
     For production (minified) code, use:
index 5c6ebb5..a864f6b 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>numeric axis</title>
     <!--
     For production (minified) code, use:
index 800680d..fbffd50 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>numeric gviz</title>
     <!--
     For production (minified) code, use:
index 153856a..c3e6741 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>out of order</title>
     <!--
     For production (minified) code, use:
index 60448ba..a35f767 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Per-Series Properties</title>
     <!--
     For production (minified) code, use:
index 20bca86..739d224 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>perf</title>
     <!--
     For production (minified) code, use:
index 38a76f8..e49032a 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>dygraphs Equation Plotter</title>
     <!--
     For production (minified) code, use:
index 6ece182..b56ca1f 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Plotters demo</title>
     <script type="text/javascript" src="../dist/dygraph.js"></script>
 
index 92cd104..f7610bd 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>plugins demo</title>
     <script type="text/javascript" src="../dist/dygraph.js"></script>
 
index b257fe4..ac8e752 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Temperatures with Range Selector</title>
     <!--
     For production (minified) code, use:
       background-color: #101015;
       color: white;
     }
+    #darkbg1 .dygraph-axis-label, #darkbg2 .dygraph-axis-label {
+      color: white;
+    }
+    #noroll .dygraph-legend,
+    #roll14 .dygraph-legend,
+    #darkbg1 .dygraph-legend,
+    #darkbg2 .dygraph-legend {
+      text-align: right;
+    }
+    #darkbg1 .dygraph-legend {
+      background-color: #101015;
+    }
+    #darkbg2 .dygraph-legend {
+      background-color: #101015;
+    }
     </style>
   </head>
   <body>
@@ -61,7 +77,6 @@
             title: 'Daily Temperatures in New York vs. San Francisco',
             ylabel: 'Temperature (F)',
             legend: 'always',
-            labelsDivStyles: { 'textAlign': 'right' },
             showRangeSelector: true
           }
       );
@@ -75,7 +90,6 @@
             title: 'Daily Temperatures in New York vs. San Francisco',
             ylabel: 'Temperature (F)',
             legend: 'always',
-            labelsDivStyles: { 'textAlign': 'right' },
             xAxisHeight: 14,
             showRangeSelector: true,
             rangeSelectorHeight: 80,
               title: 'Nightly Temperatures in NY vs. SF',
               ylabel: 'Temperature (F)',
               legend: 'always',
-              labelsDivStyles: { 'textAlign': 'right', 'backgroundColor': '#101015' },
               showRangeSelector: true,
               rangeSelectorPlotFillColor: 'MediumSlateBlue',
               rangeSelectorPlotFillGradientColor: 'rgba(123, 104, 238, 0)',
-              axisLabelColor: 'white',
               colorValue: 0.9,
               fillAlpha: 0.4
           }
               title: 'Nightly Temperatures in NY vs. SF',
               ylabel: 'Temperature (F)',
               legend: 'always',
-              labelsDivStyles: { 'textAlign': 'right', 'backgroundColor': '#101015' },
               showRangeSelector: true,
               rangeSelectorPlotFillColor: 'MediumSlateBlue',
-              axisLabelColor: 'white',
               colorValue: 0.9,
               fillAlpha: 0.4
           }
index bbc120d..343aa6b 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>resize the window</title>
     <!--
     For production (minified) code, use:
index 253a9f7..99a7173 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>reverse y-axis</title>
     <!--
     For production (minified) code, use:
index 6abb715..8dc8d0b 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Series highlighting</title>
     <!--
     For production (minified) code, use:
index 0f202dd..4f8bf8c 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>no range</title>
     <!--
     For production (minified) code, use:
index 55ebb1c..e051574 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Plotters demo</title>
     <script type="text/javascript" src="../dist/dygraph.js"></script>
     <script type="text/javascript" src="../src/extras/smooth-plotter.js"></script>
index 18f4e4d..8d9292b 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>spacing</title>
     <!--
     For production (minified) code, use:
index 65e5089..e6f6210 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>stacked</title>
     <!--
     For production (minified) code, use:
index 71de53c..e67f45d 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>dygraph</title>
     <!--
     For production (minified) code, use:
index 622788b..4656dd5 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Stock chart</title>
     <!--
     For production (minified) code, use:
index 0a13b69..7628f49 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Straw broom charts demo</title>
     <script type="text/javascript" src="../dist/dygraph.js"></script>
 
index 07a43b9..35c0b5a 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>two series</title>
     <!--
     For production (minified) code, use:
       margin: 5px;
       padding: 2px;
     }
+    .dygraph-legend {
+      text-align: right;
+      background: none;
+    }
     </style>
   </head>
   <body>
               titleHeight: 32,
               ylabel: 'Temperature (F)',
               xlabel: 'Date (Ticks indicate the start of the indicated time period)',
-              labelsDivStyles: {
-                'text-align': 'right',
-                'background': 'none'
-              },
               strokeWidth: 1.5
             }
           );
               title: 'High and Low Temperatures (30-day average)',
               ylabel: 'Temperature (F)',
               xlabel: 'Date (Ticks indicate the start of the indicated time period)',
-              labelsDivStyles: {
-                'text-align': 'right',
-                'background': 'none'
-              },
               strokeWidth: 1.5
             }
           );
index c14ef64..70c264b 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>synchronize</title>
     <!--
     For production (minified) code, use:
index b5cfef1..a778d77 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html> 
 <html> 
   <head> 
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Temperatures</title> 
     <!--
     For production (minified) code, use:
@@ -13,6 +14,9 @@
     #bordered {
       border: 1px solid red;
     }
+    .dygraph-legend {
+      text-align: right;
+    }
     </style> 
   </head> 
   <body> 
@@ -34,7 +38,6 @@
             title: 'Daily Temperatures in New York vs. San Francisco',
             ylabel: 'Temperature (F)',
             legend: 'always',
-            labelsDivStyles: { 'textAlign': 'right' }
           }
       );
       g2 = new Dygraph(
@@ -47,7 +50,6 @@
             title: 'Daily Temperatures in New York vs. San Francisco',
             ylabel: 'Temperature (F)',
             legend: 'always',
-            labelsDivStyles: { 'textAlign': 'right' }
           }
       );
     </script> 
index b714b36..c1ebfb2 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Multiple y-axes with valueRange</title>
     <!--
     For production (minified) code, use:
index f652389..fa187c6 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Multiple y-axes</title>
     <!--
     For production (minified) code, use:
index 2713467..3dc8968 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>dygraphs unboxed</title>
     <!--
     For production (minified) code, use:
index 11b2764..f552b11 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>Custom underlay callback</title>
     <!--
     For production (minified) code, use:
index 31d61ea..caffab4 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>valueFormatter and axisLabelFormatter</title>
     <!--
     For production (minified) code, use:
index 43b73a5..53c14fe 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>visibility</title>
     <!--
     For production (minified) code, use:
index ef884e3..63b9e05 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>X Axis Label Formatting</title>
     <!--
     For production (minified) code, use:
index 72c4baa..100bca1 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>zero series</title>
     <!--
     For production (minified) code, use:
index afc39a3..5803af6 100644 (file)
@@ -1,6 +1,7 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <link rel="stylesheet" href="../css/dygraph.css">
     <title>zoom</title>
     <!--
     For production (minified) code, use: