fix: full view chart label and checkbox issue (#3879)

This commit is contained in:
Rajat Dabade 2023-11-02 20:32:01 +05:30 committed by GitHub
parent 2d60805b28
commit 71e487dc0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 8 deletions

View File

@ -6,10 +6,10 @@ import Label from './Label';
export const getLabel = ( export const getLabel = (
labelClickedHandler: (labelIndex: number) => void, labelClickedHandler: (labelIndex: number) => void,
): ColumnType<DataSetProps> => ({ ): ColumnType<DataSetProps> => ({
render: (label: string, _, index): JSX.Element => ( render: (label, record): JSX.Element => (
<Label <Label
label={label} label={label}
labelIndex={index} labelIndex={record.index}
labelClickedHandler={labelClickedHandler} labelClickedHandler={labelClickedHandler}
/> />
), ),

View File

@ -20,10 +20,10 @@ export const getGraphManagerTableColumns = ({
width: 50, width: 50,
dataIndex: ColumnsKeyAndDataIndex.Index, dataIndex: ColumnsKeyAndDataIndex.Index,
key: ColumnsKeyAndDataIndex.Index, key: ColumnsKeyAndDataIndex.Index,
render: (_: string, __: DataSetProps, index: number): JSX.Element => ( render: (_: string, record: DataSetProps): JSX.Element => (
<CustomCheckBox <CustomCheckBox
data={data} data={data}
index={index} index={record.index}
checkBoxOnChangeHandler={checkBoxOnChangeHandler} checkBoxOnChangeHandler={checkBoxOnChangeHandler}
graphVisibilityState={graphVisibilityState} graphVisibilityState={graphVisibilityState}
/> />

View File

@ -59,20 +59,21 @@ function WidgetGraphComponent({
[data, name], [data, name],
); );
const [graphsVisibilityStates, setGraphsVisibilityStates] = useState<
boolean[]
>(localStoredVisibilityStates);
useEffect(() => { useEffect(() => {
if (!lineChartRef.current) return; if (!lineChartRef.current) return;
localStoredVisibilityStates.forEach((state, index) => { localStoredVisibilityStates.forEach((state, index) => {
lineChartRef.current?.toggleGraph(index, state); lineChartRef.current?.toggleGraph(index, state);
}); });
setGraphsVisibilityStates(localStoredVisibilityStates);
}, [localStoredVisibilityStates]); }, [localStoredVisibilityStates]);
const { setLayouts, selectedDashboard, setSelectedDashboard } = useDashboard(); const { setLayouts, selectedDashboard, setSelectedDashboard } = useDashboard();
const [graphsVisibilityStates, setGraphsVisibilityStates] = useState<
boolean[]
>(localStoredVisibilityStates);
const { featureResponse } = useSelector<AppState, AppReducer>( const { featureResponse } = useSelector<AppState, AppReducer>(
(state) => state.app, (state) => state.app,
); );