@density/chart-historical-counts
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -147,3 +147,3 @@ 'use strict'; | ||
var lastX = xScale(_moment2.default.min(domainEnd, _moment2.default.utc())); | ||
var lastX = xScale(domainEnd); | ||
var lastY = yScale(lastEvent.count); | ||
@@ -187,5 +187,3 @@ | ||
graphGroup.select('.historical-counts-path').attr('d', pathPrefix + linePath + pathSuffix); | ||
graphGroup.select('.historical-counts-path-outline').attr('d', function (d) { | ||
return pathPrefix + linePath + ('H' + graphWidth); | ||
}); | ||
graphGroup.select('.historical-counts-path-outline').attr('d', pathPrefix + linePath + ('H' + graphWidth)); | ||
@@ -235,3 +233,3 @@ // Draw the axes in the svg | ||
var mouseX = d3.mouse(overlayRect.node())[0]; | ||
overlayGroup.call(_overlayLine2.default, xScale, yScale, domainStart, domainEnd, graphWidth, graphHeight, initialCount, timeZoneLabel, timeZoneOffset, overlayDialogTopBottomMargin, overlayDialogBottomTopMargin, overlayDialogBorderRadius, overlayDialogTopWidth, overlayDialogTopHeight, overlayDialogBottomWidth, overlayDialogBottomHeight, overlayDialogTopIconCenterOffset, overlayDialogTopTextCenterOffset, data, mouseX); | ||
overlayGroup.call(_overlayLine2.default, xScale, yScale, domainStart, domainEnd, graphWidth, graphHeight, initialCount, lastEvent, timeZoneLabel, timeZoneOffset, overlayDialogTopBottomMargin, overlayDialogBottomTopMargin, overlayDialogBorderRadius, overlayDialogTopWidth, overlayDialogTopHeight, overlayDialogBottomWidth, overlayDialogBottomHeight, overlayDialogTopIconCenterOffset, overlayDialogTopTextCenterOffset, data, mouseX); | ||
} | ||
@@ -244,3 +242,3 @@ | ||
overlayRect.select('rect').attr('x', -1 * leftMargin).attr('y', -1 * topMargin).attr('width', leftMargin + graphWidth + rightMargin).attr('height', topMargin + graphHeight + bottomMargin).on('touchstart', showOverlay).on('touchmove', showOverlay).on('mousemove', showOverlay).on('mouseout', function () { | ||
overlayGroup.call(_overlayLine2.default, xScale, yScale, domainStart, domainEnd, graphWidth, graphHeight, initialCount, timeZoneLabel, timeZoneOffset, overlayDialogTopBottomMargin, overlayDialogBottomTopMargin, overlayDialogBorderRadius, overlayDialogTopWidth, overlayDialogTopHeight, overlayDialogBottomWidth, overlayDialogBottomHeight, overlayDialogTopIconCenterOffset, overlayDialogTopTextCenterOffset, data, null); | ||
overlayGroup.call(_overlayLine2.default, xScale, yScale, domainStart, domainEnd, graphWidth, graphHeight, initialCount, lastEvent, timeZoneLabel, timeZoneOffset, overlayDialogTopBottomMargin, overlayDialogBottomTopMargin, overlayDialogBorderRadius, overlayDialogTopWidth, overlayDialogTopHeight, overlayDialogBottomWidth, overlayDialogBottomHeight, overlayDialogTopIconCenterOffset, overlayDialogTopTextCenterOffset, data, null); | ||
}); | ||
@@ -247,0 +245,0 @@ }; |
@@ -21,3 +21,3 @@ 'use strict'; | ||
function overlayLine(selection, timeScale, countScale, domainStart, domainEnd, graphWidth, graphHeight, initialCount, timeZoneLabel, timeZoneOffset, overlayDialogTopBottomMargin, overlayDialogBottomTopMargin, overlayDialogBorderRadius, overlayDialogTopWidth, overlayDialogTopHeight, overlayDialogBottomWidth, overlayDialogBottomHeight, overlayDialogTopIconCenterOffset, overlayDialogTopTextCenterOffset, data, mouseX) { | ||
function overlayLine(selection, timeScale, countScale, domainStart, domainEnd, graphWidth, graphHeight, initialCount, lastEvent, timeZoneLabel, timeZoneOffset, overlayDialogTopBottomMargin, overlayDialogBottomTopMargin, overlayDialogBorderRadius, overlayDialogTopWidth, overlayDialogTopHeight, overlayDialogBottomWidth, overlayDialogBottomHeight, overlayDialogTopIconCenterOffset, overlayDialogTopTextCenterOffset, data, mouseX) { | ||
var now = _moment2.default.utc(); | ||
@@ -31,4 +31,3 @@ | ||
// the graph, remove the line. | ||
if (mouseX === null || data.length === 0 || timeAtPosition < domainStart || // Start bound | ||
Math.min(domainEnd, now.valueOf()) < timeAtPosition // End bound | ||
if (mouseX === null || data.length === 0 || !(domainStart < timeAtPosition && timeAtPosition < lastEvent.timestamp) // Not inside of the graph's x range | ||
) { | ||
@@ -35,0 +34,0 @@ selection.select('.historical-counts-overlay-line').remove(); |
10
index.js
@@ -135,3 +135,3 @@ import './styles.scss'; | ||
const lastX = xScale(moment.min(domainEnd, moment.utc())); | ||
const lastX = xScale(domainEnd); | ||
const lastY = yScale(lastEvent.count); | ||
@@ -184,3 +184,3 @@ | ||
graphGroup.select('.historical-counts-path-outline') | ||
.attr('d', d => pathPrefix + linePath + `H${graphWidth}`); | ||
.attr('d', pathPrefix + linePath + `H${graphWidth}`); | ||
@@ -261,3 +261,4 @@ | ||
overlayGroup.call(updateOverlayLine, | ||
xScale, yScale, domainStart, domainEnd, graphWidth, graphHeight, initialCount, timeZoneLabel, timeZoneOffset, | ||
xScale, yScale, domainStart, domainEnd, graphWidth, graphHeight, initialCount, | ||
lastEvent, timeZoneLabel, timeZoneOffset, | ||
overlayDialogTopBottomMargin, overlayDialogBottomTopMargin, overlayDialogBorderRadius, | ||
@@ -284,3 +285,4 @@ overlayDialogTopWidth, overlayDialogTopHeight, overlayDialogBottomWidth, overlayDialogBottomHeight, | ||
overlayGroup.call(updateOverlayLine, | ||
xScale, yScale, domainStart, domainEnd, graphWidth, graphHeight, initialCount, timeZoneLabel, timeZoneOffset, | ||
xScale, yScale, domainStart, domainEnd, graphWidth, graphHeight, initialCount, | ||
lastEvent, timeZoneLabel, timeZoneOffset, | ||
overlayDialogTopBottomMargin, overlayDialogBottomTopMargin, overlayDialogBorderRadius, | ||
@@ -287,0 +289,0 @@ overlayDialogTopWidth, overlayDialogTopHeight, overlayDialogBottomWidth, overlayDialogBottomHeight, |
@@ -8,3 +8,4 @@ import { bisector } from 'd3'; | ||
export default function overlayLine(selection, | ||
timeScale, countScale, domainStart, domainEnd, graphWidth, graphHeight, initialCount, timeZoneLabel, timeZoneOffset, | ||
timeScale, countScale, domainStart, domainEnd, graphWidth, graphHeight, initialCount, | ||
lastEvent, timeZoneLabel, timeZoneOffset, | ||
overlayDialogTopBottomMargin, overlayDialogBottomTopMargin, overlayDialogBorderRadius, | ||
@@ -26,4 +27,3 @@ overlayDialogTopWidth, overlayDialogTopHeight, overlayDialogBottomWidth, overlayDialogBottomHeight, | ||
data.length === 0 || | ||
timeAtPosition < domainStart || // Start bound | ||
Math.min(domainEnd, now.valueOf()) < timeAtPosition // End bound | ||
!(domainStart < timeAtPosition && timeAtPosition < lastEvent.timestamp) // Not inside of the graph's x range | ||
) { | ||
@@ -30,0 +30,0 @@ selection.select('.historical-counts-overlay-line').remove(); |
{ | ||
"name": "@density/chart-historical-counts", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Historical Counts chart", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
607953
1936