Comparing version
{ | ||
"name": "pedicab", | ||
"version": "1.6.11", | ||
"version": "1.6.12", | ||
"description": "Rickshaw is a JavaScript toolkit for creating interactive time series graphs.", | ||
@@ -5,0 +5,0 @@ "main": [ |
{ | ||
"name": "pedicab", | ||
"version": "1.6.11", | ||
"version": "1.6.12", | ||
"homepage": "https://shutterstock.github.io/rickshaw/", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -13,8 +13,16 @@ Rickshaw.namespace('Rickshaw.Graph.Band') | ||
var bands = args.bands || graph.bands | ||
var vis = args.vis || graph.vis | ||
var vis = args.vis || graph.vis | ||
bands.forEach(function(band) { | ||
var config = graph.renderer.config | ||
var configRenderer = !!config && config.renderer | ||
bands.forEach(function(band, i) { | ||
vis.select('#band-' + i).remove() | ||
vis.select('#band-text-' + i).remove() | ||
var width = graph.x(band.to) - graph.x(band.from) | ||
vis | ||
.insert('rect', 'path') | ||
.insert('rect', ':first-child') | ||
.attr('id', 'band-' + i) | ||
.attr('x', graph.x(band.from)) | ||
@@ -28,3 +36,4 @@ .attr('y', 0) | ||
vis | ||
.insert('text', 'path') | ||
.insert('text', ':first-child') | ||
.attr('id', 'band-text-' + i) | ||
.attr('x', graph.x(band.from) + width / 2) | ||
@@ -31,0 +40,0 @@ .attr('y', 0) |
@@ -202,9 +202,9 @@ Rickshaw.namespace('Rickshaw.Graph.HoverDetail') | ||
// What should the top be | ||
var topInt = this.graph.y(point.value.y0 + point.value.y) | ||
var topIntAdjusted = topInt | ||
var xLabelsize = xLabel.getBoundingClientRect() | ||
if (topInt < xLabelsize.height + xLabelsize.top) { | ||
// Let's make sure the label doesn't overlap with the tooltip | ||
topIntAdjusted = xLabelsize.height + xLabelsize.top | ||
//account for the xLabel's padding | ||
var xLabelPadding = 12 | ||
if (topInt < xLabelsize.height + xLabelPadding) { | ||
topIntAdjusted = xLabelsize.height + xLabelPadding | ||
} | ||
@@ -219,4 +219,2 @@ | ||
dot.className = 'dot' | ||
// the dot should be in the right position regardless of altering | ||
// the tooltip location | ||
dot.style.top = topInt + 'px' | ||
@@ -223,0 +221,0 @@ dot.style.borderColor = series.color |
Rickshaw.namespace('Rickshaw.Graph.RangeSlider.Preview') | ||
Rickshaw.Graph.RangeSlider.Preview = Rickshaw.Class.create({ | ||
initialize: function(args) { | ||
@@ -6,0 +5,0 @@ if (!args.element) |
@@ -26,2 +26,4 @@ Rickshaw.namespace('Rickshaw.Graph.TapZoom') | ||
var self = this | ||
//for caching timestamp values | ||
//when last two values are within target time range, triggers the zoom effect | ||
var taps = [] | ||
@@ -39,5 +41,8 @@ var doubleTapTimeLimit = 300 | ||
taps.push(d3.event.timeStamp) | ||
d3.event.preventDefault() | ||
var withinTimeLimit = | ||
taps.length > 1 && | ||
taps[taps.length - 1] - taps[taps.length - 2] < doubleTapTimeLimit | ||
if (self.graph.window.xMin === undefined) { | ||
@@ -51,6 +56,3 @@ self.graph.window.xMin = domain[0] | ||
if ( | ||
taps.length > 1 && | ||
taps[taps.length - 1] - taps[taps.length - 2] < doubleTapTimeLimit | ||
) { | ||
if (withinTimeLimit) { | ||
zoomChart() | ||
@@ -74,69 +76,1 @@ } | ||
}) | ||
Rickshaw.namespace('Rickshaw.Graph.TapZoom'); | ||
Rickshaw.Graph.TapZoom = Rickshaw.Class.create({ | ||
initialize: function(args) { | ||
if (!args || !args.graph) { | ||
throw new Error("Rickshaw.Graph.TapZoom needs a reference to a graph"); | ||
} | ||
var defaults = { | ||
zoomAmount: 50, | ||
maxZoomed: 60, | ||
callback: function() {} | ||
}; | ||
this.graph = args.graph; | ||
this.svg = d3.select(this.graph.element).select("svg"); | ||
this.svgWidth = parseInt(this.svg.attr("width"), 10); | ||
this.zoomAmount = args.zoomAmount || defaults.zoomAmount; | ||
this.maxZoomed = args.maxZoomed || defaults.maxZoomed; | ||
this.callback = args.callback || defaults.callback; | ||
this.registerTouchEvents(); | ||
}, | ||
registerTouchEvents: function() { | ||
var self = this; | ||
var taps = []; | ||
var doubleTapTimeLimit = 300; | ||
var domain = this.graph.dataDomain(); | ||
var chart = d3.select('.rickshaw_graph') | ||
.style("touch-action", "manipulation"); | ||
this.svg.on("touchstart", onTouchStart); | ||
function onTouchStart(){ | ||
taps.push(d3.event.timeStamp); | ||
d3.event.preventDefault(); | ||
if (self.graph.window.xMin === undefined) { | ||
self.graph.window.xMin = domain[0]; | ||
} | ||
if (self.graph.window.xMax === undefined) { | ||
self.graph.window.xMax = domain[1]; | ||
} | ||
if (taps.length > 1 && taps[taps.length - 1] - taps[taps.length - 2] < doubleTapTimeLimit) { | ||
zoomChart(); | ||
} | ||
} | ||
function zoomChart(){ | ||
self.graph.window.xMin = self.graph.window.xMin + self.zoomAmount; | ||
self.graph.window.xMax = self.graph.window.xMax - self.zoomAmount; | ||
if (self.graph.window.xMax - self.graph.window.xMin < self.maxZoomed) { | ||
return; | ||
} | ||
self.graph.update(); | ||
taps = []; | ||
self.callback(); | ||
} | ||
} | ||
}); |
/* jshint -W079 */ | ||
var Rickshaw = { | ||
version: '1.6.11', | ||
version: '1.6.12', | ||
@@ -6,0 +6,0 @@ namespace: function(namespace, obj) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1198891
-0.31%11527
-0.83%