Skip to content

Commit

Permalink
[FIX] chart: useless return value of line chart runtime
Browse files Browse the repository at this point in the history
The helper `createLineOrScatterChartRuntime` was returning some data
other than the chart runtime. This was needed for Scatter Charts in
a previous version of the code, but is not needed anymore.

This commit removes those useless random values, that were (wrongly)
tested and (uselessly) snapshoted.

closes #5013

Task: 4153935
Signed-off-by: Rémi Rahir (rar) <[email protected]>
  • Loading branch information
hokolomopo committed Oct 11, 2024
1 parent 398d495 commit 970957b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 365 deletions.
19 changes: 4 additions & 15 deletions src/helpers/figures/charts/chart_common_line_scatter.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ChartConfiguration, ChartDataset, LegendOptions } from "chart.js";
import { ChartDataset, LegendOptions } from "chart.js";
import { DeepPartial } from "chart.js/dist/types/utils";
import { BACKGROUND_CHART_COLOR, LINE_FILL_TRANSPARENCY } from "../../../constants";
import { toJsDate, toNumber } from "../../../functions/helpers";
import { Color, Format, Getters, Locale, Range } from "../../../types";
import { Getters, Locale, Range } from "../../../types";
import {
AxisType,
ChartJSRuntime,
DatasetValues,
LabelValues,
TrendConfiguration,
} from "../../../types/chart/chart";
import { getChartTimeOptions, timeFormatLuxonCompatible } from "../../chart_date";
Expand Down Expand Up @@ -193,14 +193,7 @@ export function getTrendDatasetForLineChart(
export function createLineOrScatterChartRuntime(
chart: LineChart | ScatterChart,
getters: Getters
): {
chartJsConfig: ChartConfiguration;
background: Color;
dataSetsValues: DatasetValues[];
labelValues: LabelValues;
dataSetFormat: Format | undefined;
labelFormat: Format | undefined;
} {
): ChartJSRuntime {
const axisType = getChartAxisType(chart, getters);
const labelValues = getChartLabelValues(getters, chart.dataSets, chart.labelRange);
let labels = axisType === "linear" ? labelValues.values : labelValues.formattedValues;
Expand Down Expand Up @@ -399,9 +392,5 @@ export function createLineOrScatterChartRuntime(
return {
chartJsConfig: config,
background: chart.background || BACKGROUND_CHART_COLOR,
dataSetsValues,
labelValues,
dataSetFormat: leftAxisFormat,
labelFormat,
};
}
Loading

0 comments on commit 970957b

Please sign in to comment.