diff --git a/src/marks/area.js b/src/marks/area.js index 4d232876bc..cf0a5e4918 100644 --- a/src/marks/area.js +++ b/src/marks/area.js @@ -3,6 +3,7 @@ import {Curve} from "../curve.js"; import {Mark} from "../plot.js"; import {first, indexOf, maybeZ, second} from "../options.js"; import {applyDirectStyles, applyIndirectStyles, applyTransform, applyGroupedChannelStyles, groupIndex} from "../style.js"; +import {maybeDenseIntervalX, maybeDenseIntervalY} from "../transforms/bin.js"; import {maybeIdentityX, maybeIdentityY} from "../transforms/identity.js"; import {maybeStackX, maybeStackY} from "../transforms/stack.js"; @@ -60,10 +61,12 @@ export function area(data, options) { return new Area(data, options); } -export function areaX(data, {y = indexOf, ...options} = {}) { - return new Area(data, maybeStackX(maybeIdentityX({...options, y1: y, y2: undefined}))); +export function areaX(data, options) { + const {y = indexOf, ...rest} = maybeDenseIntervalY(options); + return new Area(data, maybeStackX(maybeIdentityX({...rest, y1: y, y2: undefined}))); } -export function areaY(data, {x = indexOf, ...options} = {}) { - return new Area(data, maybeStackY(maybeIdentityY({...options, x1: x, x2: undefined}))); +export function areaY(data, options) { + const {x = indexOf, ...rest} = maybeDenseIntervalX(options); + return new Area(data, maybeStackY(maybeIdentityY({...rest, x1: x, x2: undefined}))); } diff --git a/src/marks/line.js b/src/marks/line.js index 6cbde103bf..24dc7e4d3d 100644 --- a/src/marks/line.js +++ b/src/marks/line.js @@ -3,6 +3,7 @@ import {Curve} from "../curve.js"; import {Mark} from "../plot.js"; import {indexOf, identity, maybeTuple, maybeZ} from "../options.js"; import {applyDirectStyles, applyIndirectStyles, applyTransform, applyGroupedChannelStyles, offset, groupIndex} from "../style.js"; +import {maybeDenseIntervalX, maybeDenseIntervalY} from "../transforms/bin.js"; import {applyGroupedMarkers, markers} from "./marker.js"; const defaults = { @@ -60,9 +61,9 @@ export function line(data, {x, y, ...options} = {}) { } export function lineX(data, {x = identity, y = indexOf, ...options} = {}) { - return new Line(data, {...options, x, y}); + return new Line(data, maybeDenseIntervalY({...options, x, y})); } export function lineY(data, {x = indexOf, y = identity, ...options} = {}) { - return new Line(data, {...options, x, y}); + return new Line(data, maybeDenseIntervalX({...options, x, y})); } diff --git a/src/transforms/bin.js b/src/transforms/bin.js index 2af0502fa6..78bf9d51cc 100644 --- a/src/transforms/bin.js +++ b/src/transforms/bin.js @@ -27,6 +27,18 @@ export function bin(outputs = {fill: "count"}, options = {}) { return binn(x, y, null, null, outputs, maybeInsetX(maybeInsetY(options))); } +function maybeDenseInterval(bin, k, options) { + return options?.interval == null ? options : bin({[k]: options?.reduce === undefined ? "sum" : options.reduce, filter: null}, options); +} + +export function maybeDenseIntervalX(options) { + return maybeDenseInterval(binX, "y", options); +} + +export function maybeDenseIntervalY(options) { + return maybeDenseInterval(binY, "x", options); +} + function binn( bx, // optionally bin on x (exclusive with gx) by, // optionally bin on y (exclusive with gy) diff --git a/test/data/downloads.csv b/test/data/downloads.csv new file mode 100644 index 0000000000..4d73c29439 --- /dev/null +++ b/test/data/downloads.csv @@ -0,0 +1,1567 @@ +date,downloads +2017-11-15,2 +2017-11-16,5 +2017-11-17,1 +2017-11-18,0 +2017-11-19,0 +2017-11-20,0 +2017-11-21,0 +2017-11-22,1 +2017-11-23,0 +2017-11-24,0 +2017-11-25,0 +2017-11-26,1 +2017-11-27,1 +2017-11-28,1 +2017-11-29,0 +2017-11-30,0 +2017-12-01,1 +2017-12-02,1 +2017-12-03,0 +2017-12-04,1 +2017-12-05,1 +2017-12-06,1 +2017-12-07,0 +2017-12-08,0 +2017-12-09,1 +2017-12-10,0 +2017-12-11,0 +2017-12-12,1 +2017-12-13,0 +2017-12-14,1 +2017-12-15,1 +2017-12-16,0 +2017-12-17,0 +2017-12-18,0 +2017-12-19,0 +2017-12-20,0 +2017-12-21,0 +2017-12-22,1 +2017-12-23,0 +2017-12-24,0 +2017-12-25,0 +2017-12-26,0 +2017-12-27,0 +2017-12-28,1 +2017-12-29,0 +2017-12-30,0 +2017-12-31,0 +2018-01-01,0 +2018-01-02,0 +2018-01-03,0 +2018-01-04,0 +2018-01-05,2 +2018-01-06,1 +2018-01-07,0 +2018-01-08,1 +2018-01-09,0 +2018-01-10,0 +2018-01-11,0 +2018-01-12,0 +2018-01-13,0 +2018-01-14,0 +2018-01-15,0 +2018-01-16,2 +2018-01-17,0 +2018-01-18,0 +2018-01-19,0 +2018-01-20,0 +2018-01-21,0 +2018-01-22,0 +2018-01-23,0 +2018-01-24,0 +2018-01-25,0 +2018-01-26,0 +2018-01-27,0 +2018-01-28,1 +2018-01-29,1 +2018-01-30,0 +2018-01-31,1 +2018-02-01,1 +2018-02-02,1 +2018-02-03,2 +2018-02-04,1 +2018-02-05,1 +2018-02-06,1 +2018-02-07,1 +2018-02-08,2 +2018-02-09,1 +2018-02-10,1 +2018-02-11,1 +2018-02-12,1 +2018-02-13,1 +2018-02-14,2 +2018-02-15,1 +2018-02-16,1 +2018-02-17,2 +2018-02-18,1 +2018-02-19,1 +2018-02-20,1 +2018-02-21,1 +2018-02-22,1 +2018-02-23,0 +2018-02-24,2 +2018-02-25,1 +2018-02-26,1 +2018-02-27,0 +2018-02-28,1 +2018-03-01,2 +2018-03-02,1 +2018-03-03,1 +2018-03-04,1 +2018-03-05,1 +2018-03-06,0 +2018-03-07,1 +2018-03-08,2 +2018-03-09,1 +2018-03-10,1 +2018-03-11,1 +2018-03-12,0 +2018-03-13,1 +2018-03-14,3 +2018-03-15,0 +2018-03-16,1 +2018-03-17,2 +2018-03-18,0 +2018-03-19,1 +2018-03-20,2 +2018-03-21,1 +2018-03-22,0 +2018-03-23,5 +2018-03-24,1 +2018-03-25,1 +2018-03-26,2 +2018-03-27,1 +2018-03-28,1 +2018-03-29,1 +2018-03-30,1 +2018-03-31,1 +2018-04-01,1 +2018-04-02,1 +2018-04-03,1 +2018-04-04,1 +2018-04-05,1 +2018-04-06,1 +2018-04-07,1 +2018-04-08,1 +2018-04-09,1 +2018-04-10,1 +2018-04-11,2 +2018-04-12,1 +2018-04-13,4 +2018-04-14,1 +2018-04-15,1 +2018-04-16,2 +2018-04-17,1 +2018-04-18,1 +2018-04-19,1 +2018-04-20,1 +2018-04-21,2 +2018-04-22,0 +2018-04-23,1 +2018-04-24,1 +2018-04-25,1 +2018-04-26,2 +2018-04-27,2 +2018-04-28,1 +2018-04-29,2 +2018-04-30,1 +2018-05-01,1 +2018-05-02,1 +2018-05-03,1 +2018-05-04,1 +2018-05-05,1 +2018-05-06,1 +2018-05-07,1 +2018-05-08,2 +2018-05-09,1 +2018-05-10,1 +2018-05-11,1 +2018-05-12,0 +2018-05-13,2 +2018-05-14,0 +2018-05-15,2 +2018-05-16,2 +2018-05-17,2 +2018-05-18,1 +2018-05-19,1 +2018-05-20,1 +2018-05-21,0 +2018-05-22,2 +2018-05-23,2 +2018-05-24,2 +2018-05-25,1 +2018-05-26,2 +2018-05-27,2 +2018-05-28,2 +2018-05-29,0 +2018-05-30,2 +2018-05-31,6 +2018-06-01,4 +2018-06-02,2 +2018-06-03,6 +2018-06-04,2 +2018-06-05,1 +2018-06-06,1 +2018-06-07,2 +2018-06-08,0 +2018-06-09,2 +2018-06-10,0 +2018-06-11,1 +2018-06-12,2 +2018-06-13,0 +2018-06-14,2 +2018-06-15,0 +2018-06-16,1 +2018-06-17,2 +2018-06-18,0 +2018-06-19,1 +2018-06-20,2 +2018-06-21,2 +2018-06-22,2 +2018-06-23,1 +2018-06-24,1 +2018-06-25,1 +2018-06-26,2 +2018-06-27,1 +2018-06-28,2 +2018-06-29,5 +2018-06-30,2 +2018-07-01,4 +2018-07-02,3 +2018-07-03,3 +2018-07-04,3 +2018-07-05,1 +2018-07-06,4 +2018-07-07,2 +2018-07-08,1 +2018-07-09,1 +2018-07-10,4 +2018-07-11,2 +2018-07-12,2 +2018-07-13,1 +2018-07-14,3 +2018-07-15,0 +2018-07-16,4 +2018-07-17,10 +2018-07-18,9 +2018-07-19,7 +2018-07-20,7 +2018-07-21,1 +2018-07-22,6 +2018-07-23,10 +2018-07-24,7 +2018-07-25,6 +2018-07-26,7 +2018-07-27,6 +2018-07-28,4 +2018-07-29,2 +2018-07-30,7 +2018-07-31,11 +2018-08-01,10 +2018-08-02,6 +2018-08-03,2 +2018-08-04,3 +2018-08-05,8 +2018-08-06,4 +2018-08-07,7 +2018-08-08,10 +2018-08-09,9 +2018-08-10,9 +2018-08-11,0 +2018-08-12,4 +2018-08-13,8 +2018-08-14,11 +2018-08-15,4 +2018-08-16,4 +2018-08-17,6 +2018-08-18,9 +2018-08-19,0 +2018-08-20,12 +2018-08-21,7 +2018-08-22,10 +2018-08-23,9 +2018-08-24,1 +2018-08-25,4 +2018-08-26,5 +2018-08-27,7 +2018-08-28,10 +2018-08-29,15 +2018-08-30,7 +2018-08-31,10 +2018-09-01,12 +2018-09-02,2 +2018-09-03,3 +2018-09-04,7 +2018-09-05,8 +2018-09-06,3 +2018-09-07,8 +2018-09-08,2 +2018-09-09,0 +2018-09-10,8 +2018-09-11,7 +2018-09-12,4 +2018-09-13,12 +2018-09-14,4 +2018-09-15,2 +2018-09-16,4 +2018-09-17,16 +2018-09-18,3 +2018-09-19,9 +2018-09-20,12 +2018-09-21,7 +2018-09-22,0 +2018-09-23,8 +2018-09-24,3 +2018-09-25,9 +2018-09-26,6 +2018-09-27,2 +2018-09-28,7 +2018-09-29,2 +2018-09-30,9 +2018-10-01,8 +2018-10-02,8 +2018-10-03,12 +2018-10-04,8 +2018-10-05,16 +2018-10-06,8 +2018-10-07,7 +2018-10-08,25 +2018-10-09,15 +2018-10-10,18 +2018-10-11,15 +2018-10-12,10 +2018-10-13,8 +2018-10-14,8 +2018-10-15,15 +2018-10-16,10 +2018-10-17,8 +2018-10-18,1 +2018-10-19,12 +2018-10-20,1 +2018-10-21,10 +2018-10-22,12 +2018-10-23,11 +2018-10-24,9 +2018-10-25,9 +2018-10-26,13 +2018-10-27,11 +2018-10-28,13 +2018-10-29,14 +2018-10-30,8 +2018-10-31,8 +2018-11-01,10 +2018-11-02,17 +2018-11-03,8 +2018-11-04,10 +2018-11-05,12 +2018-11-06,6 +2018-11-07,10 +2018-11-08,4 +2018-11-09,9 +2018-11-10,2 +2018-11-11,6 +2018-11-12,21 +2018-11-13,14 +2018-11-14,5 +2018-11-15,9 +2018-11-16,10 +2018-11-17,14 +2018-11-18,9 +2018-11-19,16 +2018-11-20,11 +2018-11-21,6 +2018-11-22,5 +2018-11-23,6 +2018-11-24,13 +2018-11-25,8 +2018-11-26,11 +2018-11-27,4 +2018-11-28,16 +2018-11-29,13 +2018-11-30,8 +2018-12-01,12 +2018-12-02,12 +2018-12-03,18 +2018-12-04,16 +2018-12-05,18 +2018-12-06,7 +2018-12-07,10 +2018-12-08,5 +2018-12-09,11 +2018-12-10,11 +2018-12-11,8 +2018-12-12,9 +2018-12-13,13 +2018-12-14,14 +2018-12-15,17 +2018-12-16,11 +2018-12-17,7 +2018-12-18,22 +2018-12-19,15 +2018-12-20,15 +2018-12-21,20 +2018-12-22,10 +2018-12-23,10 +2018-12-24,13 +2018-12-25,4 +2018-12-26,19 +2018-12-27,3 +2018-12-28,8 +2018-12-29,5 +2018-12-30,12 +2018-12-31,4 +2019-01-01,5 +2019-01-02,22 +2019-01-03,14 +2019-01-04,10 +2019-01-05,9 +2019-01-06,6 +2019-01-07,18 +2019-01-08,10 +2019-01-09,4 +2019-01-10,19 +2019-01-11,15 +2019-01-12,8 +2019-01-13,4 +2019-01-14,19 +2019-01-15,13 +2019-01-16,11 +2019-01-17,11 +2019-01-18,13 +2019-01-19,7 +2019-01-20,6 +2019-01-21,5 +2019-01-22,7 +2019-01-23,3 +2019-01-24,0 +2019-01-25,0 +2019-01-26,0 +2019-01-27,0 +2019-01-28,0 +2019-01-29,0 +2019-01-30,0 +2019-01-31,0 +2019-02-01,0 +2019-02-02,2 +2019-02-03,0 +2019-02-04,0 +2019-02-05,0 +2019-02-06,0 +2019-02-07,1 +2019-02-08,0 +2019-02-09,0 +2019-02-10,1 +2019-02-11,0 +2019-02-12,0 +2019-02-13,0 +2019-02-14,0 +2019-02-15,1 +2019-02-16,0 +2019-02-17,0 +2019-02-18,0 +2019-02-19,0 +2019-02-20,0 +2019-02-21,0 +2019-02-22,0 +2019-02-23,0 +2019-02-24,0 +2019-02-25,0 +2019-02-26,0 +2019-02-27,0 +2019-02-28,0 +2019-03-01,0 +2019-03-02,0 +2019-03-03,0 +2019-03-04,0 +2019-03-05,0 +2019-03-06,1 +2019-03-07,0 +2019-03-08,0 +2019-03-09,0 +2019-03-10,0 +2019-03-11,0 +2019-03-12,0 +2019-03-13,0 +2019-03-14,0 +2019-03-15,0 +2019-03-16,0 +2019-03-17,0 +2019-03-18,0 +2019-03-19,0 +2019-03-20,1 +2019-03-21,1 +2019-03-22,0 +2019-03-23,0 +2019-03-24,0 +2019-03-25,0 +2019-03-26,0 +2019-03-27,0 +2019-03-28,0 +2019-03-29,1 +2019-03-30,1 +2019-03-31,0 +2019-04-01,0 +2019-04-02,1 +2019-04-03,0 +2019-04-04,1 +2019-04-05,0 +2019-04-06,1 +2019-04-07,0 +2019-04-08,0 +2019-04-09,0 +2019-04-10,0 +2019-04-11,0 +2019-04-12,0 +2019-04-13,1 +2019-04-14,0 +2019-04-15,1 +2019-04-16,1 +2019-04-17,1 +2019-04-18,1 +2019-04-19,0 +2019-04-20,0 +2019-04-21,0 +2019-04-22,0 +2019-04-23,1 +2019-04-24,0 +2019-04-25,0 +2019-04-26,0 +2019-04-27,0 +2019-04-28,0 +2019-04-29,0 +2019-04-30,0 +2019-05-01,0 +2019-05-02,0 +2019-05-03,2 +2019-05-04,0 +2019-05-05,0 +2019-05-06,0 +2019-05-07,0 +2019-05-08,0 +2019-05-09,0 +2019-05-10,0 +2019-05-11,0 +2019-05-12,1 +2019-05-13,0 +2019-05-14,0 +2019-05-15,0 +2019-05-16,0 +2019-05-17,0 +2019-05-18,0 +2019-05-19,0 +2019-05-20,0 +2019-05-21,0 +2019-05-22,0 +2019-05-23,1 +2019-05-24,0 +2019-05-25,0 +2019-05-26,0 +2019-05-27,1 +2019-05-28,0 +2019-05-29,0 +2019-05-30,0 +2019-05-31,0 +2019-06-01,0 +2019-06-02,0 +2019-06-03,0 +2019-06-04,1 +2019-06-05,1 +2019-06-06,0 +2019-06-07,0 +2019-06-08,0 +2019-06-09,0 +2019-06-10,1 +2019-06-11,0 +2019-06-12,0 +2019-06-13,0 +2019-06-14,0 +2019-06-15,0 +2019-06-16,0 +2019-06-17,0 +2019-06-18,2 +2019-06-19,0 +2019-06-20,0 +2019-06-21,2 +2019-06-22,0 +2019-06-23,0 +2019-06-24,2 +2019-06-25,0 +2019-06-26,0 +2019-06-27,0 +2019-06-28,0 +2019-06-29,0 +2019-06-30,0 +2019-07-01,0 +2019-07-02,2 +2019-07-03,0 +2019-07-04,0 +2019-07-05,3 +2019-07-06,1 +2019-07-07,1 +2019-07-08,0 +2019-07-09,2 +2019-07-10,2 +2019-07-11,1 +2019-07-12,1 +2019-07-13,0 +2019-07-14,0 +2019-07-15,0 +2019-07-16,0 +2019-07-17,0 +2019-07-18,0 +2019-07-19,0 +2019-07-20,1 +2019-07-21,0 +2019-07-22,2 +2019-07-23,1 +2019-07-24,1 +2019-07-25,0 +2019-07-26,0 +2019-07-27,0 +2019-07-28,1 +2019-07-29,0 +2019-07-30,0 +2019-07-31,0 +2019-08-01,0 +2019-08-02,0 +2019-08-03,0 +2019-08-04,0 +2019-08-05,0 +2019-08-06,0 +2019-08-07,0 +2019-08-08,1 +2019-08-09,0 +2019-08-10,0 +2019-08-11,0 +2019-08-12,0 +2019-08-13,0 +2019-08-14,0 +2019-08-15,0 +2019-08-16,0 +2019-08-17,0 +2019-08-18,0 +2019-08-19,0 +2019-08-20,1 +2019-08-21,0 +2019-08-22,0 +2019-08-23,0 +2019-08-24,0 +2019-08-25,0 +2019-08-26,1 +2019-08-27,0 +2019-08-28,2 +2019-08-29,0 +2019-08-30,1 +2019-08-31,0 +2019-09-01,0 +2019-09-02,0 +2019-09-03,0 +2019-09-04,0 +2019-09-05,1 +2019-09-06,0 +2019-09-07,0 +2019-09-08,0 +2019-09-09,0 +2019-09-10,0 +2019-09-11,0 +2019-09-12,0 +2019-09-13,0 +2019-09-14,0 +2019-09-15,0 +2019-09-16,0 +2019-09-17,0 +2019-09-18,0 +2019-09-19,0 +2019-09-20,0 +2019-09-21,0 +2019-09-22,0 +2019-09-23,0 +2019-09-24,1 +2019-09-25,0 +2019-09-26,0 +2019-09-27,2 +2019-09-28,0 +2019-09-29,0 +2019-09-30,0 +2019-10-01,0 +2019-10-02,0 +2019-10-03,0 +2019-10-04,0 +2019-10-05,0 +2019-10-06,0 +2019-10-07,0 +2019-10-08,1 +2019-10-09,0 +2019-10-10,1 +2019-10-11,0 +2019-10-12,0 +2019-10-13,0 +2019-10-14,0 +2019-10-15,0 +2019-10-16,3 +2019-10-17,1 +2019-10-18,0 +2019-10-19,0 +2019-10-20,0 +2019-10-21,0 +2019-10-22,0 +2019-10-23,0 +2019-10-24,0 +2019-10-25,0 +2019-10-26,0 +2019-10-27,0 +2019-10-28,0 +2019-10-29,1 +2019-10-30,0 +2019-10-31,0 +2019-11-01,0 +2019-11-02,0 +2019-11-03,0 +2019-11-04,0 +2019-11-05,0 +2019-11-06,2 +2019-11-07,0 +2019-11-08,0 +2019-11-09,0 +2019-11-10,1 +2019-11-11,1 +2019-11-12,0 +2019-11-13,0 +2019-11-14,0 +2019-11-15,0 +2019-11-16,0 +2019-11-17,0 +2019-11-18,0 +2019-11-19,0 +2019-11-20,1 +2019-11-21,1 +2019-11-22,0 +2019-11-23,0 +2019-11-24,0 +2019-11-25,0 +2019-11-26,0 +2019-11-27,0 +2019-11-28,1 +2019-11-29,0 +2019-11-30,0 +2019-12-01,1 +2019-12-02,0 +2019-12-03,0 +2019-12-04,0 +2019-12-05,1 +2019-12-06,0 +2019-12-07,0 +2019-12-08,0 +2019-12-09,0 +2019-12-10,0 +2019-12-11,0 +2019-12-12,0 +2019-12-13,0 +2019-12-14,0 +2019-12-15,0 +2019-12-16,0 +2019-12-17,0 +2019-12-18,0 +2019-12-19,0 +2019-12-20,0 +2019-12-21,0 +2019-12-22,0 +2019-12-23,0 +2019-12-24,0 +2019-12-25,1 +2019-12-26,0 +2019-12-27,0 +2019-12-28,0 +2019-12-29,0 +2019-12-30,1 +2019-12-31,0 +2020-01-01,0 +2020-01-02,0 +2020-01-03,1 +2020-01-04,1 +2020-01-05,0 +2020-01-06,1 +2020-01-07,0 +2020-01-08,0 +2020-01-09,0 +2020-01-10,1 +2020-01-11,0 +2020-01-12,1 +2020-01-13,0 +2020-01-14,0 +2020-01-15,0 +2020-01-16,0 +2020-01-17,0 +2020-01-18,2 +2020-01-19,0 +2020-01-20,0 +2020-01-21,0 +2020-01-22,1 +2020-01-23,0 +2020-01-24,1 +2020-01-25,0 +2020-01-26,1 +2020-01-27,0 +2020-01-28,0 +2020-01-29,0 +2020-01-30,0 +2020-01-31,0 +2020-02-01,1 +2020-02-02,0 +2020-02-03,0 +2020-02-04,0 +2020-02-05,0 +2020-02-06,0 +2020-02-07,0 +2020-02-08,0 +2020-02-09,0 +2020-02-10,0 +2020-02-11,0 +2020-02-12,0 +2020-02-13,0 +2020-02-14,0 +2020-02-15,0 +2020-02-16,0 +2020-02-17,0 +2020-02-18,1 +2020-02-19,0 +2020-02-20,0 +2020-02-21,0 +2020-02-22,0 +2020-02-23,0 +2020-02-24,1 +2020-02-25,0 +2020-02-26,1 +2020-02-27,0 +2020-02-28,1 +2020-02-29,0 +2020-03-01,0 +2020-03-02,1 +2020-03-03,0 +2020-03-04,1 +2020-03-05,1 +2020-03-06,0 +2020-03-07,0 +2020-03-08,0 +2020-03-09,0 +2020-03-10,0 +2020-03-11,0 +2020-03-12,0 +2020-03-13,0 +2020-03-14,2 +2020-03-15,0 +2020-03-16,0 +2020-03-17,0 +2020-03-18,1 +2020-03-19,0 +2020-03-20,1 +2020-03-21,0 +2020-03-22,1 +2020-03-23,0 +2020-03-24,0 +2020-03-25,1 +2020-03-26,0 +2020-03-27,0 +2020-03-28,0 +2020-03-29,0 +2020-03-30,0 +2020-03-31,0 +2020-04-01,0 +2020-04-02,0 +2020-04-03,0 +2020-04-04,0 +2020-04-05,0 +2020-04-06,0 +2020-04-07,0 +2020-04-08,1 +2020-04-09,0 +2020-04-10,0 +2020-04-11,0 +2020-04-12,0 +2020-04-13,0 +2020-04-14,0 +2020-04-15,0 +2020-04-16,0 +2020-04-17,0 +2020-04-18,0 +2020-04-19,0 +2020-04-20,0 +2020-04-21,0 +2020-04-22,0 +2020-04-23,0 +2020-04-24,0 +2020-04-25,0 +2020-04-26,0 +2020-04-27,0 +2020-04-28,0 +2020-04-29,0 +2020-04-30,0 +2020-05-01,0 +2020-05-02,0 +2020-05-03,2 +2020-05-04,0 +2020-05-05,0 +2020-05-06,0 +2020-05-07,0 +2020-05-08,0 +2020-05-09,0 +2020-05-10,0 +2020-05-11,0 +2020-05-12,0 +2020-05-13,0 +2020-05-14,0 +2020-05-15,0 +2020-05-16,0 +2020-05-17,0 +2020-05-18,0 +2020-05-19,0 +2020-05-20,0 +2020-05-21,0 +2020-05-22,0 +2020-05-23,0 +2020-05-24,0 +2020-05-25,0 +2020-05-26,1 +2020-05-27,0 +2020-05-28,2 +2020-05-29,0 +2020-05-30,0 +2020-05-31,0 +2020-06-01,0 +2020-06-02,1 +2020-06-03,0 +2020-06-04,0 +2020-06-05,0 +2020-06-06,0 +2020-06-07,1 +2020-06-08,0 +2020-06-09,0 +2020-06-10,0 +2020-06-11,0 +2020-06-12,0 +2020-06-13,0 +2020-06-14,0 +2020-06-15,0 +2020-06-16,0 +2020-06-17,0 +2020-06-18,0 +2020-06-19,0 +2020-06-20,0 +2020-06-21,0 +2020-06-22,0 +2020-06-23,1 +2020-06-24,0 +2020-06-25,1 +2020-06-26,0 +2020-06-27,0 +2020-06-28,0 +2020-06-29,1 +2020-06-30,0 +2020-07-01,0 +2020-07-02,1 +2020-07-03,1 +2020-07-04,0 +2020-07-05,0 +2020-07-06,0 +2020-07-07,0 +2020-07-08,0 +2020-07-09,0 +2020-07-10,0 +2020-07-11,0 +2020-07-12,0 +2020-07-13,0 +2020-07-14,0 +2020-07-15,0 +2020-07-16,1 +2020-07-17,1 +2020-07-18,0 +2020-07-19,0 +2020-07-20,0 +2020-07-21,0 +2020-07-22,0 +2020-07-23,0 +2020-07-24,1 +2020-07-25,0 +2020-07-26,0 +2020-07-27,0 +2020-07-28,0 +2020-07-29,0 +2020-07-30,0 +2020-07-31,0 +2020-08-01,0 +2020-08-02,0 +2020-08-03,0 +2020-08-04,0 +2020-08-05,0 +2020-08-06,0 +2020-08-07,0 +2020-08-08,0 +2020-08-09,0 +2020-08-10,0 +2020-08-11,1 +2020-08-12,0 +2020-08-13,0 +2020-08-14,0 +2020-08-15,0 +2020-08-16,0 +2020-08-17,0 +2020-08-18,0 +2020-08-19,0 +2020-08-20,0 +2020-08-21,0 +2020-08-22,0 +2020-08-23,1 +2020-08-24,0 +2020-08-25,0 +2020-08-26,0 +2020-08-27,0 +2020-08-28,0 +2020-08-29,0 +2020-08-30,0 +2020-08-31,0 +2020-09-01,1 +2020-09-02,0 +2020-09-03,0 +2020-09-04,0 +2020-09-05,1 +2020-09-06,0 +2020-09-07,0 +2020-09-08,0 +2020-09-09,0 +2020-09-10,0 +2020-09-11,1 +2020-09-12,0 +2020-09-13,0 +2020-09-14,0 +2020-09-15,0 +2020-09-16,1 +2020-09-17,0 +2020-09-18,0 +2020-09-19,0 +2020-09-20,0 +2020-09-21,0 +2020-09-22,0 +2020-09-23,0 +2020-09-24,0 +2020-09-25,0 +2020-09-26,1 +2020-09-27,0 +2020-09-28,0 +2020-09-29,0 +2020-09-30,1 +2020-10-01,0 +2020-10-02,0 +2020-10-03,0 +2020-10-04,0 +2020-10-05,0 +2020-10-06,0 +2020-10-07,1 +2020-10-08,0 +2020-10-09,0 +2020-10-10,0 +2020-10-11,0 +2020-10-12,1 +2020-10-13,0 +2020-10-14,0 +2020-10-15,0 +2020-10-16,0 +2020-10-17,1 +2020-10-18,0 +2020-10-19,0 +2020-10-20,0 +2020-10-21,0 +2020-10-22,0 +2020-10-23,0 +2020-10-24,0 +2020-10-25,1 +2020-10-26,0 +2020-10-27,0 +2020-10-28,0 +2020-10-29,0 +2020-10-30,0 +2020-10-31,0 +2020-11-01,0 +2020-11-02,1 +2020-11-03,0 +2020-11-04,0 +2020-11-05,0 +2020-11-06,0 +2020-11-07,0 +2020-11-08,0 +2020-11-09,0 +2020-11-10,2 +2020-11-11,0 +2020-11-12,1 +2020-11-13,0 +2020-11-14,0 +2020-11-15,0 +2020-11-16,0 +2020-11-17,0 +2020-11-18,0 +2020-11-19,1 +2020-11-20,0 +2020-11-21,0 +2020-11-22,0 +2020-11-23,0 +2020-11-24,0 +2020-11-25,0 +2020-11-26,0 +2020-11-27,0 +2020-11-28,0 +2020-11-29,0 +2020-11-30,0 +2020-12-01,0 +2020-12-02,0 +2020-12-03,0 +2020-12-04,0 +2020-12-05,0 +2020-12-06,0 +2020-12-07,0 +2020-12-08,0 +2020-12-09,0 +2020-12-10,0 +2020-12-11,0 +2020-12-12,0 +2020-12-13,0 +2020-12-14,1 +2020-12-15,0 +2020-12-16,0 +2020-12-17,0 +2020-12-18,0 +2020-12-19,0 +2020-12-20,0 +2020-12-21,0 +2020-12-22,0 +2020-12-23,0 +2020-12-24,0 +2020-12-25,1 +2020-12-26,0 +2020-12-27,0 +2020-12-28,0 +2020-12-29,0 +2020-12-30,0 +2020-12-31,0 +2021-01-01,0 +2021-01-02,0 +2021-01-03,0 +2021-01-04,0 +2021-01-05,0 +2021-01-06,0 +2021-01-07,0 +2021-01-08,1 +2021-01-09,0 +2021-01-10,0 +2021-01-11,0 +2021-01-12,0 +2021-01-13,0 +2021-01-14,0 +2021-01-15,0 +2021-01-16,0 +2021-01-17,0 +2021-01-18,0 +2021-01-19,0 +2021-01-20,1 +2021-01-21,1 +2021-01-22,0 +2021-01-23,0 +2021-01-24,0 +2021-01-25,0 +2021-01-26,0 +2021-01-27,0 +2021-01-28,0 +2021-01-29,0 +2021-01-30,0 +2021-01-31,0 +2021-02-01,0 +2021-02-02,21 +2021-02-03,0 +2021-02-04,0 +2021-02-05,0 +2021-02-06,1 +2021-02-07,0 +2021-02-08,0 +2021-02-09,0 +2021-02-10,0 +2021-02-11,0 +2021-02-12,0 +2021-02-13,0 +2021-02-14,0 +2021-02-15,0 +2021-02-16,0 +2021-02-17,0 +2021-02-18,0 +2021-02-19,0 +2021-02-20,0 +2021-02-21,0 +2021-02-22,0 +2021-02-23,0 +2021-02-24,0 +2021-02-25,0 +2021-02-26,0 +2021-02-27,1 +2021-02-28,0 +2021-03-01,0 +2021-03-02,0 +2021-03-03,0 +2021-03-04,0 +2021-03-05,0 +2021-03-06,1 +2021-03-07,0 +2021-03-08,0 +2021-03-09,0 +2021-03-10,0 +2021-03-11,0 +2021-03-12,2 +2021-03-13,0 +2021-03-14,0 +2021-03-15,0 +2021-03-16,0 +2021-03-17,0 +2021-03-18,0 +2021-03-19,1 +2021-03-20,2 +2021-03-21,2 +2021-03-22,0 +2021-03-23,0 +2021-03-24,2 +2021-03-25,1 +2021-03-26,0 +2021-03-27,0 +2021-03-28,0 +2021-03-29,0 +2021-03-30,1 +2021-03-31,0 +2021-04-01,0 +2021-04-02,0 +2021-04-03,0 +2021-04-04,1 +2021-04-05,0 +2021-04-06,2 +2021-04-07,0 +2021-04-08,1 +2021-04-09,0 +2021-04-10,0 +2021-04-11,0 +2021-04-12,0 +2021-04-13,1 +2021-04-14,0 +2021-04-15,0 +2021-04-16,0 +2021-04-17,0 +2021-04-18,1 +2021-04-19,0 +2021-04-20,0 +2021-04-21,0 +2021-04-22,0 +2021-04-23,0 +2021-04-24,0 +2021-04-25,0 +2021-04-26,1 +2021-04-27,0 +2021-04-28,0 +2021-04-29,0 +2021-04-30,0 +2021-05-01,0 +2021-05-02,0 +2021-05-03,0 +2021-05-04,0 +2021-05-05,0 +2021-05-06,0 +2021-05-07,0 +2021-05-08,0 +2021-05-09,0 +2021-05-10,0 +2021-05-11,0 +2021-05-12,20 +2021-05-13,0 +2021-05-14,0 +2021-05-15,1 +2021-05-16,0 +2021-05-17,0 +2021-05-18,0 +2021-05-19,0 +2021-05-20,0 +2021-05-21,0 +2021-05-22,0 +2021-05-23,1 +2021-05-24,0 +2021-05-25,0 +2021-05-26,1 +2021-05-27,0 +2021-05-28,0 +2021-05-29,0 +2021-05-30,0 +2021-05-31,0 +2021-06-01,1 +2021-06-02,0 +2021-06-03,0 +2021-06-04,0 +2021-06-05,0 +2021-06-06,1 +2021-06-07,0 +2021-06-08,0 +2021-06-09,1 +2021-06-10,0 +2021-06-11,0 +2021-06-12,0 +2021-06-13,1 +2021-06-14,0 +2021-06-15,0 +2021-06-16,0 +2021-06-17,0 +2021-06-18,0 +2021-06-19,0 +2021-06-20,0 +2021-06-21,0 +2021-06-22,0 +2021-06-23,18 +2021-06-24,0 +2021-06-25,0 +2021-06-26,0 +2021-06-27,0 +2021-06-28,0 +2021-06-29,0 +2021-06-30,0 +2021-07-01,1 +2021-07-02,0 +2021-07-03,0 +2021-07-04,18 +2021-07-05,0 +2021-07-06,0 +2021-07-07,0 +2021-07-08,0 +2021-07-09,1 +2021-07-10,0 +2021-07-11,1 +2021-07-12,0 +2021-07-13,1 +2021-07-14,0 +2021-07-15,0 +2021-07-16,0 +2021-07-17,0 +2021-07-18,0 +2021-07-19,0 +2021-07-20,0 +2021-07-21,1 +2021-07-22,0 +2021-07-23,0 +2021-07-24,1 +2021-07-25,0 +2021-07-26,1 +2021-07-27,0 +2021-07-28,0 +2021-07-29,0 +2021-07-30,0 +2021-07-31,0 +2021-08-01,0 +2021-08-02,0 +2021-08-03,1 +2021-08-04,0 +2021-08-05,1 +2021-08-06,0 +2021-08-07,0 +2021-08-08,0 +2021-08-09,1 +2021-08-10,0 +2021-08-11,0 +2021-08-12,0 +2021-08-13,0 +2021-08-14,0 +2021-08-15,0 +2021-08-16,0 +2021-08-17,0 +2021-08-18,1 +2021-08-19,0 +2021-08-20,2 +2021-08-21,0 +2021-08-22,0 +2021-08-23,0 +2021-08-24,0 +2021-08-25,0 +2021-08-26,0 +2021-08-27,1 +2021-08-28,0 +2021-08-29,0 +2021-08-30,0 +2021-08-31,0 +2021-09-01,0 +2021-09-02,0 +2021-09-03,0 +2021-09-04,1 +2021-09-05,0 +2021-09-06,0 +2021-09-07,1 +2021-09-08,1 +2021-09-09,0 +2021-09-10,0 +2021-09-11,0 +2021-09-12,0 +2021-09-13,0 +2021-09-14,2 +2021-09-15,0 +2021-09-16,1 +2021-09-17,0 +2021-09-18,0 +2021-09-19,0 +2021-09-20,0 +2021-09-21,0 +2021-09-22,0 +2021-09-23,0 +2021-09-24,0 +2021-09-25,0 +2021-09-26,0 +2021-09-27,0 +2021-09-28,0 +2021-09-29,0 +2021-09-30,0 +2021-10-01,0 +2021-10-02,0 +2021-10-03,1 +2021-10-04,0 +2021-10-05,0 +2021-10-06,0 +2021-10-07,0 +2021-10-08,1 +2021-10-09,1 +2021-10-10,0 +2021-10-11,0 +2021-10-12,0 +2021-10-13,0 +2021-10-14,0 +2021-10-15,0 +2021-10-16,0 +2021-10-17,0 +2021-10-18,0 +2021-10-19,0 +2021-10-20,0 +2021-10-21,0 +2021-10-22,0 +2021-10-23,0 +2021-10-24,0 +2021-10-25,1 +2021-10-26,6 +2021-10-27,0 +2021-10-28,2 +2021-10-29,0 +2021-10-30,0 +2021-10-31,0 +2021-11-01,0 +2021-11-02,0 +2021-11-03,1 +2021-11-04,0 +2021-11-05,0 +2021-11-06,0 +2021-11-07,0 +2021-11-08,0 +2021-11-09,1 +2021-11-10,0 +2021-11-11,0 +2021-11-12,0 +2021-11-13,0 +2021-11-14,0 +2021-11-15,0 +2021-11-16,0 +2021-11-17,0 +2021-11-18,0 +2021-11-19,0 +2021-11-20,0 +2021-11-21,0 +2021-11-22,1 +2021-11-23,1 +2021-11-24,0 +2021-11-25,0 +2021-11-26,0 +2021-11-27,0 +2021-11-28,0 +2021-11-29,0 +2021-11-30,0 +2021-12-01,0 +2021-12-02,0 +2021-12-03,0 +2021-12-04,0 +2021-12-05,0 +2021-12-06,0 +2021-12-07,0 +2021-12-08,0 +2021-12-09,0 +2021-12-10,1 +2021-12-11,0 +2021-12-12,0 +2021-12-13,1 +2021-12-14,0 +2021-12-15,0 +2021-12-16,0 +2021-12-17,0 +2021-12-18,1 +2021-12-19,1 +2021-12-20,0 +2021-12-21,0 +2021-12-22,0 +2021-12-23,0 +2021-12-24,1 +2021-12-25,0 +2021-12-26,0 +2021-12-27,1 +2021-12-28,0 +2021-12-29,0 +2021-12-30,0 +2021-12-31,0 +2022-01-01,0 +2022-01-02,0 +2022-01-03,0 +2022-01-04,0 +2022-01-05,0 +2022-01-06,0 +2022-01-07,0 +2022-01-08,3 +2022-01-09,0 +2022-01-10,0 +2022-01-11,0 +2022-01-12,1 +2022-01-13,0 +2022-01-14,1 +2022-01-15,0 +2022-01-16,0 +2022-01-17,0 +2022-01-18,0 +2022-01-19,0 +2022-01-20,0 +2022-01-21,0 +2022-01-22,0 +2022-01-23,1 +2022-01-24,0 +2022-01-25,0 +2022-01-26,0 +2022-01-27,0 +2022-01-28,0 +2022-01-29,0 +2022-01-30,0 +2022-01-31,0 +2022-02-01,0 +2022-02-02,1 +2022-02-03,0 +2022-02-04,2 +2022-02-05,0 +2022-02-06,0 +2022-02-07,0 +2022-02-08,0 +2022-02-09,0 +2022-02-10,0 +2022-02-11,0 +2022-02-12,0 +2022-02-13,0 +2022-02-14,0 +2022-02-15,0 +2022-02-16,0 +2022-02-17,0 +2022-02-18,0 +2022-02-19,0 +2022-02-20,0 +2022-02-21,0 +2022-02-22,0 +2022-02-23,0 +2022-02-24,0 +2022-02-25,0 +2022-02-26,0 +2022-02-27,2 diff --git a/test/output/downloads.svg b/test/output/downloads.svg new file mode 100644 index 0000000000..46e63867d8 --- /dev/null +++ b/test/output/downloads.svg @@ -0,0 +1,83 @@ + + + + + 0 + + + 2 + + + 4 + + + 6 + + + 8 + + + 10 + + + 12 + + + 14 + + + 16 + + + 18 + + + 20 + + + 22 + + + 24 + ↑ downloads + + + + 2018 + + + 2019 + + + 2020 + + + 2021 + + + 2022 + + + + + + + + + + + + \ No newline at end of file diff --git a/test/plots/downloads.js b/test/plots/downloads.js new file mode 100644 index 0000000000..ff9b3bc5f6 --- /dev/null +++ b/test/plots/downloads.js @@ -0,0 +1,13 @@ +import * as Plot from "@observablehq/plot"; +import * as d3 from "d3"; + +export default async function() { + const downloads = (await d3.csv("data/downloads.csv", d3.autoType)).filter(d => d.downloads > 0); + return Plot.plot({ + marks: [ + Plot.areaY(downloads, {x: "date", interval: d3.utcDay, y: "downloads", curve: "step", fill: "#ccc"}), + Plot.ruleY([0]), + Plot.lineY(downloads, {x: "date", interval: d3.utcDay, y: "downloads", curve: "step", strokeWidth: 1}) + ] + }); +} diff --git a/test/plots/index.js b/test/plots/index.js index c748254805..794e78b433 100644 --- a/test/plots/index.js +++ b/test/plots/index.js @@ -43,6 +43,7 @@ export {default as decathlon} from "./decathlon.js"; export {default as diamondsCaratPrice} from "./diamonds-carat-price.js"; export {default as diamondsCaratPriceDots} from "./diamonds-carat-price-dots.js"; export {default as documentationLinks} from "./documentation-links.js"; +export {default as downloads} from "./downloads.js"; export {default as driving} from "./driving.js"; export {default as empty} from "./empty.js"; export {default as emptyLegend} from "./empty-legend.js";