Skip to content
Snippets Groups Projects
Unverified Commit 7f19247f authored by Jesse Devaney's avatar Jesse Devaney Committed by GitHub
Browse files

Fix incorrect goal line plotting when using non-linear y-axis scales (log/pow) (#44320)

* refactor: de-duplicate variable usage

* fix incorrect goal-line plotting in pow and log y-axis scales

* add Loki variants to validate and enforce desired behavior

* update loki snapshots
parent ea9dfd1d
No related branches found
No related tags found
No related merge requests found
.loki/reference/chrome_laptop_static_viz_ComboChart_Goal_Line_Log_Y_Scale.png

37.6 KiB

.loki/reference/chrome_laptop_static_viz_ComboChart_Goal_Line_Pow_Y_Scale.png

37.5 KiB

......@@ -66,6 +66,20 @@ LineLogYScale.args = {
renderingContext,
};
export const GoalLineLogYScale = Template.bind({});
GoalLineLogYScale.args = {
rawSeries: data.goalLineLogYScale as any,
dashcardSettings: {},
renderingContext,
};
export const GoalLinePowYScale = Template.bind({});
GoalLinePowYScale.args = {
rawSeries: data.goalLinePowYScale as any,
dashcardSettings: {},
renderingContext,
};
export const LineLogYScaleNegative = Template.bind({});
LineLogYScaleNegative.args = {
rawSeries: data.lineLogYScaleNegative as any,
......
......@@ -59,7 +59,9 @@ import customYAxisRangeWithColumnScaling from "./custom-y-axis-range-with-column
import dataLabelsUnderTrendGoalLines41280 from "./data-labels-under-trend-goal-lines-41280.json";
import goalBetweenExtentAndChartBound from "./goal-between-extent-and-chart-bound.json";
import goalLineDisabled from "./goal-line-disabled.json";
import goalLineLogYScale from "./goal-line-log-y-scale.json";
import goalLineOutOfBounds37848 from "./goal-line-out-of-bounds-37848.json";
import goalLinePowYScale from "./goal-line-pow-y-scale.json";
import goalLineUnderSeries38824 from "./goal-line-under-series-38824.json";
import goalVerySmall from "./goal-very-small.json";
import histogramTicks45Degrees from "./histogram-ticks-45-degrees.json";
......@@ -114,6 +116,8 @@ export const data = {
lineLinearXScale,
lineLinearXScaleUnsorted,
lineLogYScale,
goalLineLogYScale,
goalLinePowYScale,
lineLogYScaleNegative,
lineShowDotsAuto,
lineShowDotsOn,
......
......@@ -35,21 +35,24 @@ export function getGoalLineSeriesOption(
return null;
}
const goalValue = settings["graph.goal_value"];
const scaleTransformedGoalValue =
chartModel.yAxisScaleTransforms.toEChartsAxisValue(
settings["graph.goal_value"],
);
const { fontSize } = renderingContext.theme.cartesian.goalLine.label;
return {
id: GOAL_LINE_SERIES_ID,
type: "custom",
data: [
[getFirstNonNullXValue(chartModel.dataset), settings["graph.goal_value"]],
[getFirstNonNullXValue(chartModel.dataset), scaleTransformedGoalValue],
],
z: Z_INDEXES.goalLine,
blur: {
opacity: 1,
},
renderItem: (params, api) => {
const [_x, y] = api.coord([null, goalValue]);
const [_x, y] = api.coord([null, scaleTransformedGoalValue]);
const coordSys =
params.coordSys as unknown as EChartsCartesianCoordinateSystem;
const xStart = coordSys.x;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment