bring back the stems

This commit is contained in:
Conor Barnes 2022-08-24 21:13:50 -03:00
parent a99ee96f5c
commit a9e43ee7cf
3 changed files with 28 additions and 4 deletions

View File

@ -95,7 +95,7 @@ const DateDistributionChart: React.FC<DistributionChartProps> = (props) => {
name: "default", name: "default",
continuous: [], continuous: [],
discrete: [ discrete: [
{ dateTime: new Date().getTime() - 1000000, y: 0.3 }, { dateTime: new Date().getTime() - 1000000, y: 0.2 },
{ dateTime: new Date().getTime(), y: 0.5 }, { dateTime: new Date().getTime(), y: 0.5 },
{ dateTime: new Date().getTime() + 1000000, y: 0.7 }, { dateTime: new Date().getTime() + 1000000, y: 0.7 },
], ],

View File

@ -24,10 +24,33 @@ export const timeXScale: TimeScale = {
nice: false, nice: false,
domain: { data: "domain", field: "dateTime" }, domain: { data: "domain", field: "dateTime" },
}; };
export const timeYScale: TimeScale = {
export const linearYScale: LinearScale = {
name: "yscale", name: "yscale",
type: "time", type: "linear",
range: "height", range: "height",
zero: true,
domain: { data: "domain", field: "y" },
};
export const logXScale: LogScale = {
name: "xscale",
type: "log",
range: "width",
zero: false,
base: 10,
nice: false,
clamp: true,
domain: { data: "domain", field: "x" },
};
export const expYScale: PowScale = {
name: "yscale",
type: "pow",
exponent: 0.1,
range: "height",
zero: true,
nice: false,
domain: { data: "domain", field: "y" }, domain: { data: "domain", field: "y" },
}; };
@ -86,7 +109,7 @@ export function buildDateVegaSpec(
], ],
scales: [ scales: [
xScale, xScale,
timeYScale, expY ? expYScale : linearYScale,
{ {
name: "color", name: "color",
type: "ordinal", type: "ordinal",

View File

@ -25,6 +25,7 @@ export const linearXScale: LinearScale = {
nice: false, nice: false,
domain: { data: "domain", field: "x" }, domain: { data: "domain", field: "x" },
}; };
export const linearYScale: LinearScale = { export const linearYScale: LinearScale = {
name: "yscale", name: "yscale",
type: "linear", type: "linear",