- // TODO(danvk): is this outer div actually necessary?
- div = document.createElement("div");
- div.style.position = 'absolute';
- if (axis == 1) {
- div.style.left = box.left;
- } else {
- div.style.right = box.left;
- }
- div.style.top = box.top + 'px';
- div.style.width = box.width + 'px';
- div.style.height = box.height + 'px';
- div.style.fontSize = (that.attr_('yLabelWidth') - 2) + 'px';
-
- var inner_div = document.createElement("div");
- inner_div.style.position = 'absolute';
- inner_div.style.width = box.height + 'px';
- inner_div.style.height = box.width + 'px';
- inner_div.style.top = (box.height / 2 - box.width / 2) + 'px';
- inner_div.style.left = (box.width / 2 - box.height / 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
-
- if (typeof(document.documentMode) !== 'undefined' &&
- document.documentMode < 9) {
- // We're dealing w/ an old version of IE, so we have to rotate the text
- // using a BasicImage transform. This uses a different origin of rotation
- // than HTML5 rotation (top left of div vs. its center).
- inner_div.style.filter =
- 'progid:DXImageTransform.Microsoft.BasicImage(rotation=' +
- (axis == 1 ? '3' : '1') + ')';
- inner_div.style.left = '0px';
- inner_div.style.top = '0px';
- }
-
- class_div = document.createElement("div");
- class_div.className = classes;
- class_div.innerHTML = html;
-
- inner_div.appendChild(class_div);
- div.appendChild(inner_div);
- return div;
- }
-
- var div;
- if (this.attr_('ylabel')) {
- div = createRotatedDiv(1, 'dygraph-label dygraph-ylabel',
- this.attr_('ylabel'));
- this.container.appendChild(div);
- this.chartLabels.ylabel = div;
- }
- if (this.attr_('y2label') && this.dygraph_.numAxes() == 2) {
- div = createRotatedDiv(2, 'dygraph-label dygraph-y2label',
- this.attr_('y2label'));
- this.container.appendChild(div);
- this.chartLabels.y2label = div;
- }
-};
-
-
-DygraphCanvasRenderer.prototype._renderAnnotations = function() {
- var annotationStyle = {
- "position": "absolute",
- "fontSize": this.attr_('axisLabelFontSize') + "px",
- "zIndex": 10,
- "overflow": "hidden"
- };
-
- var bindEvt = function(eventName, classEventName, p, self) {
- return function(e) {
- var a = p.annotation;
- if (a.hasOwnProperty(eventName)) {
- a[eventName](a, p, self.dygraph_, e);
- } else if (self.dygraph_.attr_(classEventName)) {
- self.dygraph_.attr_(classEventName)(a, p, self.dygraph_,e );
- }
+ this.endSegment = function() {
+ ctx.stroke(); // should this include closePath?
+ };
+ this.drawLine = function(x1, y1, x2, y2) {
+ renderer._dashedLine(ctx, x1, y1, x2, y2, strokePattern);
+ };
+ this.skipPixel = function(prevX, prevY, curX, curY) {
+ // TODO(konigsberg): optimize with http://jsperf.com/math-round-vs-hack/6 ?
+ return (Math.round(prevX) == Math.round(curX) &&
+ Math.round(prevY) == Math.round(curY));