SquiggleChart accepts a height, and doesn't have a hover, because it was broken for mixed distributions

This commit is contained in:
Ozzie Gooen 2022-04-06 20:46:22 -04:00
parent 4d0a522e96
commit d5c183e7ee
3 changed files with 13 additions and 20 deletions

View File

@ -43,6 +43,7 @@ export interface SquiggleChartProps {
onEnvChange?(env: exportEnv): void; onEnvChange?(env: exportEnv): void;
/** CSS width of the element */ /** CSS width of the element */
width?: number; width?: number;
height?: number;
} }
export const SquiggleChart: React.FC<SquiggleChartProps> = ({ export const SquiggleChart: React.FC<SquiggleChartProps> = ({
@ -57,6 +58,7 @@ export const SquiggleChart: React.FC<SquiggleChartProps> = ({
environment = [], environment = [],
onEnvChange = () => {}, onEnvChange = () => {},
width = 500, width = 500,
height = 60,
}: SquiggleChartProps) => { }: SquiggleChartProps) => {
let samplingInputs: SamplingInputs = { let samplingInputs: SamplingInputs = {
sampleCount: sampleCount, sampleCount: sampleCount,
@ -92,6 +94,7 @@ export const SquiggleChart: React.FC<SquiggleChartProps> = ({
return ( return (
<SquiggleVegaChart <SquiggleVegaChart
width={width} width={width}
height={height}
data={{ con: values }} data={{ con: values }}
actions={false} actions={false}
/> />

View File

@ -55,6 +55,7 @@ let SquigglePlayground: FC<Props> = (props) => {
diagramStop={diagramStop} diagramStop={diagramStop}
diagramCount={diagramCount} diagramCount={diagramCount}
pointDistLength={pointDistLength} pointDistLength={pointDistLength}
height={150}
/> />
); );
return ( return (

View File

@ -1,8 +1,8 @@
{ {
"$schema": "https://vega.github.io/schema/vega/v5.json", "$schema": "https://vega.github.io/schema/vega/v5.json",
"description": "A basic area chart example.", "description": "A basic area chart example",
"width": 500, "width": 500,
"height": 200, "height": 100,
"padding": 5, "padding": 5,
"data": [ "data": [
{ {
@ -13,17 +13,6 @@
} }
], ],
"signals": [ "signals": [
{
"name": "mousex",
"description": "x position of mouse",
"update": "0",
"on": [
{
"events": "mousemove",
"update": "1-x()/width"
}
]
},
{ {
"name": "xscale", "name": "xscale",
"description": "The transform of the x scale", "description": "The transform of the x scale",
@ -93,6 +82,9 @@
{ {
"orient": "bottom", "orient": "bottom",
"scale": "xscale", "scale": "xscale",
"labelColor": "#666",
"tickColor": "#ddd",
"format": "~s",
"tickCount": 20 "tickCount": 20
} }
], ],
@ -103,11 +95,6 @@
"data": "con" "data": "con"
}, },
"encode": { "encode": {
"enter": {
"tooltip": {
"signal": "datum.cdf"
}
},
"update": { "update": {
"x": { "x": {
"scale": "xscale", "scale": "xscale",
@ -122,8 +109,7 @@
"value": 0 "value": 0
}, },
"fill": { "fill": {
"signal": "{gradient: 'linear', x1: 1, y1: 1, x2: 0, y2: 1, stops: [ {offset: 0.0, color: '#11ac8f'}, {offset: clamp(mousex, 0, 1), color: '#11ac8f'}, {offset: clamp(mousex, 0, 1), color: '#1b6fac'}, {offset: 1.0, color: '#1b6fac'} ] }", "signal": "{gradient: 'linear', x1: 1, y1: 1, x2: 0, y2: 1, stops: [ {offset: 0.0, color: '#4C78A8'}] }"
"color": "#000"
}, },
"interpolate": { "interpolate": {
"value": "monotone" "value": "monotone"
@ -186,6 +172,9 @@
"y": { "y": {
"scale": "yscale", "scale": "yscale",
"field": "y" "field": "y"
},
"fill": {
"value": "#1e4577"
} }
} }
} }