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 = (
labelClickedHandler: (labelIndex: number) => void,
): ColumnType<DataSetProps> => ({
render: (label: string, _, index): JSX.Element => (
render: (label, record): JSX.Element => (
<Label
label={label}
labelIndex={index}
labelIndex={record.index}
labelClickedHandler={labelClickedHandler}
/>
),

View File

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

View File

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