Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/marks/auto.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,10 @@ export function auto(data, options) {

// If zero-ness is not specified, default based on whether the resolved mark
// type will include a zero baseline. TODO Move this to autoSpec.
if (xZero === undefined) xZero = transform !== binX && (mark === barX || mark === areaX || mark === rectX);
if (yZero === undefined) yZero = transform !== binY && (mark === barY || mark === areaY || mark === rectY);
if (xZero === undefined)
xZero = X && transform !== binX && (mark === barX || mark === areaX || mark === rectX || mark === ruleY);
if (yZero === undefined)
yZero = Y && transform !== binY && (mark === barY || mark === areaY || mark === rectY || mark === ruleX);

// In the case of filled marks (particularly bars and areas) the frame and
// rules should come after the mark; in the case of stroked marks
Expand Down
124 changes: 124 additions & 0 deletions test/output/autoRuleZero.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions test/plots/autoplot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ export async function autoRectColorReducer() {
return Plot.auto(penguins, {x: "culmen_length_mm", color: {value: "island", reduce: "mode"}}).plot();
}

export async function autoRuleZero() {
const athletes = await d3.csv<any>("data/athletes.csv", d3.autoType);
return Plot.auto(athletes, {x: "date_of_birth", y: {value: "height", reduce: "mean"}, mark: "rule"}).plot();
}

export async function autoLineColor() {
const aapl = await d3.csv<any>("data/aapl.csv", d3.autoType);
return Plot.auto(aapl, {x: "Date", y: "Close", color: "Close"}).plot();
Expand Down