Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Commit

Permalink
fix PR
Browse files Browse the repository at this point in the history
  • Loading branch information
iadibar committed Feb 18, 2024
1 parent fbdc891 commit 238ab8d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import { ChartType, chartTypeOptions, xAxisTypeOptions } from './components/dyna
import { CHARTS_EN } from './translate/en';

export const Charts: React.FC<IExperimentData> = (props: IExperimentData) => {
const { yAxiosOptions } = useDynamicChartData(props.data);
const { yAxisOptions } = useDynamicChartData(props.data);
const xDefaultOption: AttSelectOption = xAxisTypeOptions[0];
return (
<div className={styles.charts_content}>
<div className={styles.title}>{CHARTS_EN.TITLE}</div>
<div className={styles.charts_wrapper}>
{
yAxiosOptions?.map((item, index) => (
yAxisOptions?.map((item, index) => (
<div className={styles.chart}>
<DynamicChart chartData={props.data} xDefaultOption={xDefaultOption} yDefaultOption={item} chartDefaultType={getChartDefaultTypeByValue(item.value) as AttSelectOption} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface DynamicChartProps {
}
export const DynamicChart: React.FC<DynamicChartProps> = (props: DynamicChartProps) => {
const { chartData, xDefaultOption, yDefaultOption, chartDefaultType } = props;
const { yAxiosOptions } = useDynamicChartData(chartData);
const { yAxisOptions } = useDynamicChartData(chartData);
const [chartType, setChartType] = useState<AttSelectOption>(chartDefaultType);
const [xAxisValue, setXAxisValue] = useState<AttSelectOption>(xDefaultOption);
const [yAxisValue, setYAxisValue] = useState<AttSelectOption>(yDefaultOption);
Expand Down Expand Up @@ -71,7 +71,7 @@ export const DynamicChart: React.FC<DynamicChartProps> = (props: DynamicChartPro
id='yAxiosSelector'
className={styles.select_item}
placeholder={DYNAMIC_CHART_EN.SELECTORS.PLACEHOLDERS.Y_AXIOS}
options={yAxiosOptions}
options={yAxisOptions}
value={yAxisValue as AttSelectOption}
onChange={onYAxisValueChanged}
required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { AttSelectOption } from "../../../../../../../../../shared/components/at
import { ITestRunResult } from "../../../../../../../../../shared/models/test-run-result.interface";

export interface IUseDynamicChartData {
yAxiosOptions: AttSelectOption[];
yAxisOptions: AttSelectOption[];
}
export function useDynamicChartData(chartData: ITestRunResult): IUseDynamicChartData {
const [yAxiosOptions, setYAxiosOptions] = useState<AttSelectOption[]>([]);
const [yAxisOptions, setYAxisOptions] = useState<AttSelectOption[]>([]);

useEffect(() => {
const uniqueKeys = new Set<string>();
Expand All @@ -19,12 +19,12 @@ export function useDynamicChartData(chartData: ITestRunResult): IUseDynamicChart
}

if (uniqueKeys.size > 0) {
setYAxiosOptions(Array.from(uniqueKeys).map(key => ({ label: convertLabelByCapitalLetter(key), value: key })));
setYAxisOptions(Array.from(uniqueKeys).map(key => ({ label: convertLabelByCapitalLetter(key), value: key })));
}
}, [chartData]);

return {
yAxiosOptions,
yAxisOptions,
};
}

Expand Down

0 comments on commit 238ab8d

Please sign in to comment.