@density/chart-historical-counts
Advanced tools
Comparing version 1.3.3 to 1.4.0
@@ -200,4 +200,8 @@ 'use strict'; | ||
var totalDuration = domainEnd - domainStart; | ||
var xAxis = d3.axisBottom(xScale).ticks(Math.floor(totalDuration / (MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MILLISECONDS_PER_SECOND))).tickSizeOuter(0).tickFormat(function (d, i) { | ||
// Get the first tick mark's lovation on the chart's x axis. | ||
var firstHourMark = _moment2.default.utc(domainStart).startOf('hour').valueOf(); | ||
var xAxis = d3.axisBottom(xScale) | ||
// Position a tick at the first whole hour on the axis, then another tick for each hour | ||
// thereafter. | ||
.tickValues(d3.range(firstHourMark, domainEnd, MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MILLISECONDS_PER_SECOND)).tickSizeOuter(0).tickFormat(function (d, i) { | ||
var timeFormat = (0, _moment2.default)(d).add(timeZoneOffset, 'hours').format('hA'); | ||
@@ -204,0 +208,0 @@ return timeFormat.slice(0, timeFormat.startsWith('12') ? -1 : -2).toLowerCase(); |
@@ -204,5 +204,8 @@ import './styles.scss'; | ||
const totalDuration = domainEnd - domainStart; | ||
// Get the first tick mark's lovation on the chart's x axis. | ||
const firstHourMark = moment.utc(domainStart).startOf('hour').valueOf(); | ||
const xAxis = d3.axisBottom(xScale) | ||
.ticks(Math.floor(totalDuration / (MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MILLISECONDS_PER_SECOND))) | ||
// Position a tick at the first whole hour on the axis, then another tick for each hour | ||
// thereafter. | ||
.tickValues(d3.range(firstHourMark, domainEnd, MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MILLISECONDS_PER_SECOND)) | ||
.tickSizeOuter(0) | ||
@@ -209,0 +212,0 @@ .tickFormat((d, i) => { |
{ | ||
"name": "@density/chart-historical-counts", | ||
"version": "1.3.3", | ||
"version": "1.4.0", | ||
"description": "Historical Counts chart", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
649938
21
1952