diff --git a/src/marks/auto.js b/src/marks/auto.js index b7f31e3dc1..dbfd4e69fc 100644 --- a/src/marks/auto.js +++ b/src/marks/auto.js @@ -13,7 +13,7 @@ import {group, groupX, groupY} from "../transforms/group.js"; import {marks} from "../mark.js"; import {ascending} from "d3"; -export function auto(data, {x, y, color, size, fx, fy, mark} = {}) { +export function auto(data, {x, y, color, size, fx, fy, mark, ...otherOptions} = {}) { // Allow x and y and other dimensions to be specified as shorthand field names // (but note that they can also be specified as a {transform} object such as // Plot.identity). @@ -205,7 +205,7 @@ export function auto(data, {x, y, color, size, fx, fy, mark} = {}) { // (particularly dots and lines) they should come before the mark. const frames = fx != null || fy != null ? frame({strokeOpacity: 0.1}) : null; const rules = [xZero ? ruleX([0]) : null, yZero ? ruleY([0]) : null]; - mark = mark(data, options); + mark = mark(data, {...otherOptions, ...options}); return colorMode === "stroke" ? marks(frames, rules, mark) : marks(frames, mark, rules); } diff --git a/test/output/autoLineOtherOptions.svg b/test/output/autoLineOtherOptions.svg new file mode 100644 index 0000000000..5e24b2c76b --- /dev/null +++ b/test/output/autoLineOtherOptions.svg @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + 60 + 70 + 80 + 90 + 100 + 110 + 120 + 130 + 140 + 150 + 160 + 170 + 180 + 190 + + + ↑ Close + + + + + + + + + + 2014 + 2015 + 2016 + 2017 + 2018 + + + + + \ No newline at end of file diff --git a/test/plots/autoplot.js b/test/plots/autoplot.js index afea90c234..5d911c28bb 100644 --- a/test/plots/autoplot.js +++ b/test/plots/autoplot.js @@ -41,6 +41,11 @@ export async function autoLine() { return Plot.auto(aapl, {x: "Date", y: "Close"}).plot(); } +export async function autoLineOtherOptions() { + const aapl = await d3.csv("data/aapl.csv", d3.autoType); + return Plot.auto(aapl, {x: "Date", y: "Close", strokeWidth: 3, ariaDescription: "Price of Apple, 2013–2018"}).plot(); +} + export async function autoArea() { const aapl = await d3.csv("data/aapl.csv", d3.autoType); return Plot.auto(aapl, {x: "Date", y: "Close", mark: "area"}).plot();