Skip to content

Commit

Permalink
Merge pull request #452 from allen-cell-animated/fix/scatterplot-on-s…
Browse files Browse the repository at this point in the history
…tartup

feat: Scatterplot tab plots currently selected feature if no axes are selected
  • Loading branch information
ShrimpCryptid authored Oct 1, 2024
2 parents e97fa10 + 9ac5242 commit d05bdbc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/components/Tabs/ScatterPlotTab.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button, Tooltip } from "antd";
import { MenuItemType } from "antd/es/menu/hooks/useItems";
import Plotly, { PlotData, PlotMarker } from "plotly.js-dist-min";
import React, { memo, ReactElement, useContext, useEffect, useRef, useState, useTransition } from "react";
import React, { memo, ReactElement, useContext, useEffect, useMemo, useRef, useState, useTransition } from "react";
import styled from "styled-components";
import { Color, ColorRepresentation, HexColorString } from "three";

Expand Down Expand Up @@ -128,6 +128,15 @@ export default memo(function ScatterPlotTab(props: ScatterPlotTabProps): ReactEl
const colorRampMin = useDebounce(props.colorRampMin, 100);
const colorRampMax = useDebounce(props.colorRampMax, 100);

useMemo(() => {
if (props.scatterPlotConfig.xAxis === null && props.scatterPlotConfig.yAxis === null && props.selectedFeatureKey) {
props.updateScatterPlotConfig({
yAxis: props.selectedFeatureKey,
xAxis: SCATTERPLOT_TIME_FEATURE.key,
});
}
}, [props.selectedFeatureKey]);

// Trigger render spinner when playback starts, but only if the render is being delayed.
// If a render is allowed to happen (such as in the current-track- or current-frame-only
// range types), `isRendering` will be set to false immediately and the spinner will be hidden again.
Expand Down

0 comments on commit d05bdbc

Please sign in to comment.