Skip to content

Commit

Permalink
Expand sparklines for non-pandemic use
Browse files Browse the repository at this point in the history
* Switch sparkline length from 4 weeks to 3 months
* Switch window length from 4 months to 9 months
* Increase visibility of y-axis gridlines
* Switch y-axis gridlines from marking weeks to marking months
  • Loading branch information
krivard committed Apr 24, 2023
1 parent 798a063 commit b1b31d2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/specs/lineSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,11 +704,13 @@ export function generateSparkLine({
formatType: 'cachedTime',
grid: true,
gridDash: [4, 4],
gridColor: color,
gridOpacity: 0.5,
labels: false,
ticks: false,
domain: false,
tickCount: {
interval: 'week',
interval: 'month',
step: 1,
},
},
Expand Down
8 changes: 4 additions & 4 deletions src/stores/params.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { timeDay, timeMonth, timeWeek } from 'd3-time';
import { timeDay, timeMonth } from 'd3-time';
import { formatAPITime, addMissing, fitRange, parseAPITime } from '../data';
import type { EpiDataRow } from '../data';
import { nationInfo } from '../data/regions';
Expand Down Expand Up @@ -36,8 +36,8 @@ export function resolveSensorTimeFrame(
return ALL_TIME_FRAME;
}

export const WINDOW_SIZE = 4; // months;
export const SPARKLINE_SIZE = 4; // weeks;
export const WINDOW_SIZE = 9; // months;
export const SPARKLINE_SIZE = 3; // months;

export class DateParam {
readonly timeValue: number;
Expand All @@ -52,7 +52,7 @@ export class DateParam {
this.value = date;
this.week = EpiWeek.fromDate(date);
this.allTimeFrame = ALL_TIME_FRAME;
this.sparkLineTimeFrame = TimeFrame.compute(date, (d, step) => timeWeek.offset(d, step), SPARKLINE_SIZE);
this.sparkLineTimeFrame = TimeFrame.compute(date, (d, step) => timeMonth.offset(d, step), SPARKLINE_SIZE);
this.windowTimeFrame = TimeFrame.compute(date, (d, step) => timeMonth.offset(d, step), WINDOW_SIZE);
}

Expand Down

0 comments on commit b1b31d2

Please sign in to comment.