Skip to content

Commit

Permalink
Fix update graph displayOnlySelectedCases. (#1696)
Browse files Browse the repository at this point in the history
  • Loading branch information
tealefristoe authored Dec 21, 2024
1 parent d71d76a commit e9e26dd
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,7 @@ export const HideShowMenuList = observer(function HideShowMenuList({tile}: IProp

const displayOnlySelectedCases = () => {
dataConfig?.applyModelChange(
() => {
dataConfig?.addNewHiddenCases(dataConfig?.unselectedCases ?? [])
dataConfig?.setDisplayOnlySelectedCases(true)
if (dataConfig?.selection.length > 0) {
graphModel?.rescale()
}
},
() => graphModel?.displayOnlySelectedCases(),
{
undoStringKey: "DG.Undo.displayOnlySelected",
redoStringKey: "DG.Redo.displayOnlySelected",
Expand All @@ -64,11 +58,7 @@ export const HideShowMenuList = observer(function HideShowMenuList({tile}: IProp

const showAllCases = () => {
dataConfig?.applyModelChange(
() => {
dataConfig?.clearHiddenCases()
dataConfig?.setDisplayOnlySelectedCases(false)
graphModel?.rescale()
},
() => graphModel?.showAllCases(),
{
undoStringKey: "DG.Undo.showAllCases",
redoStringKey: "DG.Redo.showAllCases",
Expand Down
6 changes: 5 additions & 1 deletion v3/src/components/graph/graph-component-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,11 @@ export const graphComponentHandler: DIComponentHandler = {

// Update odd features
if (backgroundColor != null) content.setPlotBackgroundColor(backgroundColor)
if (displayOnlySelectedCases != null) dataConfiguration.setDisplayOnlySelectedCases(displayOnlySelectedCases)
if (displayOnlySelectedCases) {
content.displayOnlySelectedCases()
} else if (displayOnlySelectedCases != null) {
content.showAllCases()
}
if (filterFormula != null) dataConfiguration.setFilterFormula(filterFormula)
if (hiddenCases != null) dataConfiguration.setHiddenCases(hiddenCases.map(id => toV3CaseId(id)))
if (pointColor != null) pointDescription.setPointColor(pointColor)
Expand Down
14 changes: 13 additions & 1 deletion v3/src/components/graph/models/graph-content-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,18 @@ export const GraphContentModel = DataDisplayContentModel
}
}))
.actions(self => ({
displayOnlySelectedCases() {
self.dataConfiguration.addNewHiddenCases(self.dataConfiguration.unselectedCases ?? [])
self.dataConfiguration.setDisplayOnlySelectedCases(true)
if (self.dataConfiguration.selection.length > 0) {
self.rescale()
}
},
showAllCases() {
self.dataConfiguration.clearHiddenCases()
self.dataConfiguration.setDisplayOnlySelectedCases(false)
self.rescale()
},
setBarCountAxis() {
const { maxOverAllCells, maxCellLength, primaryRole, secondaryRole } = self.dataConfiguration
const { binWidth, minValue, totalNumberOfBins } = self.binDetails()
Expand All @@ -663,7 +675,7 @@ export const GraphContentModel = DataDisplayContentModel
})
setNiceDomain([0, maxCellCaseCount], countAxis, {clampPosMinAtZero: true})
self.setAxis(secondaryPlace, countAxis)
},
}
}))
.actions(self => ({
setPointsFusedIntoBars(fuseIntoBars: boolean) {
Expand Down

0 comments on commit e9e26dd

Please sign in to comment.