-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Show connect by feature value in tooltip #301
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d99ba28
d95a416
6715f86
f36e0b4
a3010af
01413a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,6 +44,7 @@ import { | |
| getShowConnectLines, | ||
| getFilteredConnectByCategoryValues, | ||
| getLineMovingAverageWindow, | ||
| getConnectByFeature, | ||
| } from "../../state/selection/selectors"; | ||
| import { MainPlotSettings, SelectedPointData, TickConversion } from "../../state/selection/types"; | ||
| import { | ||
|
|
@@ -103,16 +104,24 @@ export const handleNullValues = ( | |
| }; | ||
|
|
||
| export const getPlotlyCustomData = createSelector( | ||
| [getFilteredCellData], | ||
| (filteredCellData: DataForPlot): PlotlyCustomData[] => { | ||
| [getFilteredCellData, getShowConnectLines, getConnectByFeature], | ||
| ( | ||
| filteredCellData: DataForPlot, | ||
| showConnectByLines: boolean, | ||
| connectByFeature: string | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are the potential values of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's the string key of any feature in the currently-loaded dataset! |
||
| ): PlotlyCustomData[] => { | ||
| const thumbnailPaths = filteredCellData.labels.thumbnailPaths; | ||
| const srcPaths = filteredCellData.labels.sourcePaths; | ||
| const indices = filteredCellData.indices; | ||
| const connectByFeatureValues = showConnectByLines | ||
| ? filteredCellData.values[connectByFeature] | ||
| : undefined; | ||
| return map(indices, (cellIndex, i) => { | ||
| return { | ||
| index: cellIndex, | ||
| thumbnailPath: thumbnailPaths[i], | ||
| srcPath: srcPaths?.[i], | ||
| connectByFeature: connectByFeatureValues?.[i], | ||
| }; | ||
|
ShrimpCryptid marked this conversation as resolved.
|
||
| }); | ||
| } | ||
|
|
@@ -549,26 +558,30 @@ const makeNumberAxis = (): TickConversion => { | |
| }; | ||
| }; | ||
|
|
||
| const getFeatureTickConversion = ( | ||
| featureKey: string, | ||
| featureDefs: MeasuredFeatureDef[] | ||
| ): TickConversion => { | ||
| const feature = find(featureDefs, { key: featureKey }); | ||
| if (feature && feature.discrete) { | ||
| return makeNumberToTextConversion(feature.options); | ||
| } | ||
| return makeNumberAxis(); | ||
| }; | ||
|
Comment on lines
+561
to
+570
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved repeated logic out of |
||
|
|
||
| export const getXTickConversion = createSelector( | ||
| [getPlotByOnX, getMeasuredFeaturesDefs], | ||
| (plotByOnX, measuredFeaturesDefs: MeasuredFeatureDef[]): TickConversion => { | ||
| const feature = findFeature(measuredFeaturesDefs, plotByOnX); | ||
| if (feature && feature.discrete) { | ||
| return makeNumberToTextConversion(feature.options); | ||
| } | ||
| return makeNumberAxis(); | ||
| } | ||
| getFeatureTickConversion | ||
| ); | ||
|
|
||
| export const getYTickConversion = createSelector( | ||
| [getPlotByOnY, getMeasuredFeaturesDefs], | ||
| (plotByOnY, measuredFeaturesDefs: MeasuredFeatureDef[]): TickConversion => { | ||
| const feature = find(measuredFeaturesDefs, { key: plotByOnY }); | ||
| if (feature && feature.discrete) { | ||
| return makeNumberToTextConversion(feature.options); | ||
| } | ||
| return makeNumberAxis(); | ||
| } | ||
| getFeatureTickConversion | ||
| ); | ||
|
|
||
| export const getConnectByFeatureTickConversion = createSelector( | ||
| [getConnectByFeature, getMeasuredFeaturesDefs], | ||
| getFeatureTickConversion | ||
| ); | ||
|
|
||
| export const getDataForOverlayCard = createSelector( | ||
|
|
@@ -630,6 +643,14 @@ export const getYDisplayName = createSelector( | |
| } | ||
| ); | ||
|
|
||
| export const getConnectByFeatureDisplayName = createSelector( | ||
| [getConnectByFeature, getMeasuredFeaturesDefs], | ||
| (connectByFeature, featureDefs): string => { | ||
| const feature = findFeature(featureDefs, connectByFeature); | ||
| return feature?.displayName ?? connectByFeature; | ||
| } | ||
| ); | ||
|
|
||
| function formatAxisValue( | ||
| value: number | string | undefined, | ||
| isCategorical: boolean, | ||
|
|
@@ -666,3 +687,16 @@ export const getFormattedHoveredYValue = createSelector( | |
| ); | ||
| } | ||
| ); | ||
|
|
||
| export const getFormattedHoveredConnectByFeatureValue = createSelector( | ||
| [ | ||
| getHoveredPointData, | ||
| getCategoricalFeatureKeys, | ||
| getConnectByFeature, | ||
| getConnectByFeatureTickConversion, | ||
| ], | ||
| (hoveredPointData, categoricalFeatures, connectByKey, tickConversion): string => { | ||
| const value = hoveredPointData?.connectByFeatureValue ?? undefined; | ||
| return formatAxisValue(value, includes(categoricalFeatures, connectByKey), tickConversion); | ||
| } | ||
| ); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,6 +68,8 @@ export interface SelectedGroupDatum { | |
| export interface PlotlyCustomData { | ||
| thumbnailPath: string; | ||
| index: number; | ||
| srcPath?: string; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
| connectByFeatureValue?: number | null; | ||
| } | ||
|
|
||
| export enum DataType { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated rendering for the feature values at the bottom of this popover