Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adjust line type as well as weight for time series #30949

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import {
extractExtraMetrics,
getOriginalSeries,
isDerivedSeries,
getTimeOffset,
} from '@superset-ui/chart-controls';
import type { EChartsCoreOption } from 'echarts/core';
import type { LineStyleOption } from 'echarts/types/src/util/types';
Expand Down Expand Up @@ -281,21 +280,15 @@ export default function transformProps(
const array = ensureIsArray(chartProps.rawFormData?.time_compare);
const inverted = invert(verboseMap);

const offsetLineWidths: { [key: string]: number } = {};
let patternIncrement = 0;

rawSeries.forEach(entry => {
const derivedSeries = isDerivedSeries(entry, chartProps.rawFormData);
const lineStyle: LineStyleOption = {};
if (derivedSeries) {
const offset = getTimeOffset(
entry,
ensureIsArray(chartProps.rawFormData?.time_compare),
)!;
if (!offsetLineWidths[offset]) {
offsetLineWidths[offset] = Object.keys(offsetLineWidths).length + 1;
}
lineStyle.type = 'dashed';
lineStyle.width = offsetLineWidths[offset];
patternIncrement += 1;
// use a combination of dash and dot for the line style
lineStyle.type = [(patternIncrement % 5) + 1, (patternIncrement % 3) + 1];
lineStyle.opacity = OpacityEnum.DerivedSeries;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,7 @@ export function transformSeries(
opacity: opacity * areaOpacity,
}
: undefined,
emphasis: {
// bold on hover as required since 5.3.0 to retain backwards feature parity:
// https://apache.github.io/echarts-handbook/en/basics/release-note/5-3-0/#removing-the-default-bolding-emphasis-effect-in-the-line-chart
// TODO: should consider only adding emphasis to currently hovered series
lineStyle: {
width: 'bolder',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@villebro is it ok to remove this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also removed the line boldness on hover because on dashed lines the animation is a bit distracting.

@eschutho I believe this was added to keep the hover behavior consistent with other chart types.

Copy link
Member Author

@eschutho eschutho Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you feel about us removing the bolder weight? It looks like the echarts community didn't like the look of it on the line chart, so they removed it. It just seems more distracting than anything on the line chart imo.

},
...emphasis,
},
emphasis,
showSymbol,
symbolSize: markerSize,
label: {
Expand Down
Loading