X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=plugins%2Fchart-labels.js;h=da231d806f23886364454061b729f0434c2fe383;hb=4707563ce91e069b58ed6c1be38c8e4ace4a2150;hp=af12bcb11ec6db32dacd7d4c31da07137619df4a;hpb=5dfebe76ebfa5442d53f1c4a7e6fc384c439cccb;p=dygraphs.git diff --git a/plugins/chart-labels.js b/plugins/chart-labels.js index af12bcb..da231d8 100644 --- a/plugins/chart-labels.js +++ b/plugins/chart-labels.js @@ -3,8 +3,12 @@ * Copyright 2012 Dan Vanderkam (danvdk@gmail.com) * MIT-licensed (http://opensource.org/licenses/MIT) */ +/*global Dygraph:false */ + Dygraph.Plugins.ChartLabels = (function() { +"use strict"; + // TODO(danvk): move chart label options out of dygraphs and into the plugin. // TODO(danvk): only tear down & rebuild the DIVs when it's necessary. @@ -58,7 +62,7 @@ chart_labels.prototype.detachLabels_ = function() { var createRotatedDiv = function(g, box, axis, classes, html) { // TODO(danvk): is this outer div actually necessary? - div = document.createElement("div"); + var div = document.createElement("div"); div.style.position = 'absolute'; if (axis == 1) { // NOTE: this is cheating. Should be positioned relative to the box. @@ -100,14 +104,14 @@ var createRotatedDiv = function(g, box, axis, classes, html) { inner_div.style.top = '0px'; } - class_div = document.createElement("div"); + var class_div = document.createElement("div"); class_div.className = classes; class_div.innerHTML = html; inner_div.appendChild(class_div); div.appendChild(inner_div); return div; -} +}; chart_labels.prototype.layout = function(e) { this.detachLabels_(); @@ -121,6 +125,7 @@ chart_labels.prototype.layout = function(e) { 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'; @@ -189,7 +194,7 @@ chart_labels.prototype.clearChart = function() { }; chart_labels.prototype.destroy = function() { - detachLabels(); + this.detachLabels_(); };