Skip to content

Commit

Permalink
Adds logs to graph parent visibility and show measures toggle
Browse files Browse the repository at this point in the history
Adds logs for graph background and point color change
  • Loading branch information
eireland committed Jul 31, 2024
1 parent 5acfabb commit a6b7d75
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,35 @@ export const DisplayItemFormatControl = observer(function PointFormatControl(pro
const categoriesRef = useRef<string[] | undefined>()
categoriesRef.current = dataConfiguration?.categoryArrayForAttrRole('legend')

const handleBackgroundColorChange = (color: string) => {
setPlotBackgroundColor && setPlotBackgroundColor(color)
displayItemDescription.applyModelChange(() => {}, {
log: "Changed background color"
})
}
const handleBackgroundTransparency = (checked: boolean) => {
setIsTransparent && setIsTransparent(checked)
displayItemDescription.applyModelChange(() => {}, {
log: `Made plot background ${checked ? "transparent" : "opaque"}`
})
}


const handlePointColorChange = (color: string) => {
displayItemDescription.setPointColor(color)
displayItemDescription.applyModelChange(() => {}, {
log: "Changed point color"
})
}

const catPointColorSettingArr: ReactElement[] = []
categoriesRef.current?.forEach(cat => {
catPointColorSettingArr.push(
<Flex direction="row" key={cat} className="palette-row color-picker-row cat-color-picker">
<FormLabel className="form-label color-picker">{cat}</FormLabel>
<Input type="color" className="color-picker-thumb categorical"
value={dataConfiguration?.getLegendColorForCategory(cat) || missingColor}
onChange={e => displayItemDescription.setPointColor(e.target.value)}/>
onChange={e => handlePointColorChange(e.target.value)}/>
</Flex>
)
})
Expand All @@ -50,13 +71,13 @@ export const DisplayItemFormatControl = observer(function PointFormatControl(pro
<Flex className="palette-row color-picker-row">
<FormLabel className="form-label color-picker">{t("DG.Inspector.backgroundColor")}</FormLabel>
<Input type="color" className="color-picker-thumb" value={plotBackgroundColor}
onChange={e => setPlotBackgroundColor(e.target.value)}/>
onChange={e => handleBackgroundColorChange(e.target.value)}/>
</Flex>
</FormControl>
<FormControl>
<Checkbox
mt="6px" isChecked={isTransparent}
onChange={e => setIsTransparent(e.target.checked)}>
onChange={e => handleBackgroundTransparency(e.target.checked)}>
{t("DG.Inspector.graphTransparency")}
</Checkbox>
</FormControl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ export const HideShowMenuList = observer(function HideShowMenuList({tile}: IProp

dataConfig?.applyModelChange(
() => graphModel?.setShowParentToggles(!graphModel?.showParentToggles),
{ undoStringKey, redoStringKey }
{ undoStringKey, redoStringKey,
log: graphModel?.showParentToggles ? "Enable NumberToggle" : "Disable NumberToggle"
}
)
}

Expand All @@ -85,7 +87,9 @@ export const HideShowMenuList = observer(function HideShowMenuList({tile}: IProp
: ["DG.Undo.enableMeasuresForSelection", "DG.Redo.enableMeasuresForSelection"]
dataConfig?.applyModelChange(
() => graphModel?.setShowMeasuresForSelection(!graphModel?.showMeasuresForSelection),
{ undoStringKey, redoStringKey }
{ undoStringKey, redoStringKey,
log: graphModel?.showMeasuresForSelection ? "Enable MeasuresForSelection" : "Disable MeasuresForSelection"
}
)
}

Expand Down

0 comments on commit a6b7d75

Please sign in to comment.