Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Render violin plots #495

Draft
wants to merge 2 commits into
base: feature/restrict-scatter-hover
Choose a base branch
from
Draft
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
26 changes: 25 additions & 1 deletion src/components/Tabs/ScatterPlotTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,9 @@
trackIds: number[],
markerConfig: Partial<PlotMarker> & { outliers?: Partial<PlotMarker>; outOfRange?: Partial<PlotMarker> } = {},
overrideColor?: Color,
allowHover = true
allowHover = true,
spreadXAxisPx = 0,

Check failure on line 494 in src/components/Tabs/ScatterPlotTab.tsx

View workflow job for this annotation

GitHub Actions / static-checks

'spreadXAxisPx' is declared but its value is never read.

Check failure on line 494 in src/components/Tabs/ScatterPlotTab.tsx

View workflow job for this annotation

GitHub Actions / static-checks

'spreadXAxisPx' is assigned a value but never used. Allowed unused vars must match /^_/u
spreadYAxisPx = 0

Check failure on line 495 in src/components/Tabs/ScatterPlotTab.tsx

View workflow job for this annotation

GitHub Actions / static-checks

'spreadYAxisPx' is declared but its value is never read.

Check failure on line 495 in src/components/Tabs/ScatterPlotTab.tsx

View workflow job for this annotation

GitHub Actions / static-checks

'spreadYAxisPx' is assigned a value but never used. Allowed unused vars must match /^_/u
): Partial<PlotData>[] => {
if (selectedFeatureKey === null || dataset === null || !xAxisFeatureKey || !yAxisFeatureKey) {
return [];
Expand Down Expand Up @@ -624,6 +626,8 @@
color: bucket.color,
size: 4,
...bucket.marker,
angle: 90,
standoff: Math.floor(Math.random() * 100 + 3),
},
hoverinfo: allowHover ? "text" : "skip",
hovertemplate: allowHover ? getHoverTemplate(dataset, xAxisFeatureKey, yAxisFeatureKey) : undefined,
Expand Down Expand Up @@ -694,6 +698,26 @@
selectedTrack === null
);

const isXAxisCategorical = dataset.isFeatureCategorical(xAxisFeatureKey);
const isYAxisCategorical = dataset.isFeatureCategorical(yAxisFeatureKey);
if (isXAxisCategorical && isYAxisCategorical) {
// Both axes are categorical; render a bubble plot
// TODO: Use standoff + angle to vary points
} else if (isXAxisCategorical || isYAxisCategorical) {
// Render a violin plot + add scatter along opposite axis
// TODO: Color violines by categorical color w/ some transparency
traces.push({
type: "violin",
x: xData,
y: yData,
jitter: 0.1,
marker: {
size: 4,
},
});
} else {

Check failure on line 718 in src/components/Tabs/ScatterPlotTab.tsx

View workflow job for this annotation

GitHub Actions / static-checks

Empty block statement
}

const xHistogram: Partial<Plotly.PlotData> = {
x: xData,
name: "x density",
Expand Down
Loading