Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
19151d1
fix: fixed Add Metrics to Tree Chart (#29158)
SBIN2010 Oct 22, 2024
35aaeb6
fix: clear modal after CSS templates is added
SBIN2010 Oct 22, 2024
db3afda
Revert "fix: clear modal after CSS templates is added"
SBIN2010 Oct 23, 2024
9eea2e6
fix: tree metrics exclude validator
SBIN2010 Nov 25, 2024
3930c95
Merge branch 'apache:master' into master
SBIN2010 Mar 11, 2025
b355212
Merge branch 'apache:master' into master
SBIN2010 Mar 18, 2025
7200d6c
Merge branch 'apache:master' into master
SBIN2010 Mar 20, 2025
3049a3d
Merge branch 'apache:master' into master
SBIN2010 Mar 25, 2025
247aef8
Merge branch 'apache:master' into master
SBIN2010 Apr 2, 2025
b4678ec
Merge branch 'apache:master' into master
SBIN2010 Apr 4, 2025
0ae844d
Merge branch 'apache:master' into master
SBIN2010 Jul 1, 2025
49fc529
Merge branch 'apache:master' into master
SBIN2010 Jul 10, 2025
601dde2
fix: revert #30679
SBIN2010 Mar 25, 2025
66823a5
Merge branch 'apache:master' into master
SBIN2010 Jul 12, 2025
4f59629
Merge branch 'apache:master' into master
SBIN2010 Jul 16, 2025
a7ce4e9
Merge branch 'apache:master' into master
SBIN2010 Jul 20, 2025
1bf4fdd
fix
SBIN2010 Jul 20, 2025
1241867
Merge branch 'apache:master' into master
SBIN2010 Jul 31, 2025
045cf6b
Merge branch 'apache:master' into master
SBIN2010 Aug 2, 2025
acdba8a
Merge branch 'apache:master' into master
SBIN2010 Aug 10, 2025
4fb89c2
Merge branch 'apache:master' into master
SBIN2010 Aug 15, 2025
f47d28b
Merge branch 'apache:master' into master
SBIN2010 Aug 18, 2025
3bdf337
Merge branch 'apache:master' into master
SBIN2010 Aug 19, 2025
780a5d6
Merge branch 'apache:master' into master
SBIN2010 Aug 24, 2025
3c339df
Merge branch 'apache:master' into master
SBIN2010 Aug 25, 2025
4cd6d0d
feat: add changes series lable
SBIN2010 Aug 25, 2025
4fdb7ba
fix: add type and test
SBIN2010 Aug 25, 2025
5791ad2
fix: change test
SBIN2010 Aug 26, 2025
0b208ec
fix: remarks in PR
SBIN2010 Sep 8, 2025
cc273ec
fix: remarks description
SBIN2010 Sep 15, 2025
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 @@ -58,41 +58,109 @@ const config: ControlPanelConfig = {
},
},
],
],
},
{
label: t('Series settings'),
expanded: true,
controlSetRows: [
[
<ControlSubSectionHeader>
{t('Series colors')}
{t('Series increase setting')}
</ControlSubSectionHeader>,
],
[
{
name: 'increase_color',
config: {
label: t('Increase'),
label: t('Increase color'),
type: 'ColorPickerControl',
default: { r: 90, g: 193, b: 137, a: 1 },
renderTrigger: true,
description: t(
'Select the color used for values that indicate an increase in the chart',
),
},
},
{
name: 'increase_label',
config: {
label: t('Increase label'),
type: 'TextControl',
renderTrigger: true,
description: t(
'Customize the label displayed for increasing values in the chart tooltips and legend.',
),
},
},
],
[
<ControlSubSectionHeader>
{t('Series decrease setting')}
</ControlSubSectionHeader>,
],
[
{
name: 'decrease_color',
config: {
label: t('Decrease'),
label: t('Decrease color'),
type: 'ColorPickerControl',
default: { r: 224, g: 67, b: 85, a: 1 },
renderTrigger: true,
description: t(
'Select the color used for values ​​that indicate a decrease in the chart.',
),
},
},
{
name: 'decrease_label',
config: {
label: t('Decrease label'),
type: 'TextControl',
renderTrigger: true,
description: t(
'Customize the label displayed for decreasing values in the chart tooltips and legend.',
),
},
},
],
[
<ControlSubSectionHeader>
{t('Series total setting')}
</ControlSubSectionHeader>,
],
[
{
name: 'total_color',
config: {
label: t('Total'),
label: t('Total color'),
type: 'ColorPickerControl',
default: { r: 102, g: 102, b: 102, a: 1 },
renderTrigger: true,
description: t(
'Select the color used for values that represent total bars in the chart',
),
},
},

{
name: 'total_label',
config: {
label: t('Total label'),
type: 'TextControl',
renderTrigger: true,
description: t(
'Customize the label displayed for total values in the chart tooltips, legend, and chart axis.',
),
},
},
],
[<ControlSubSectionHeader>{t('X Axis')}</ControlSubSectionHeader>],
],
},
{
label: t('X Axis'),
expanded: true,
controlSetRows: [
[
{
name: 'x_axis_label',
Expand Down Expand Up @@ -134,7 +202,12 @@ const config: ControlPanelConfig = {
},
},
],
[<ControlSubSectionHeader>{t('Y Axis')}</ControlSubSectionHeader>],
],
},
{
label: t('Y Axis'),
expanded: true,
controlSetRows: [
[
{
name: 'y_axis_label',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ function formatTooltip({
breakdownName,
defaultFormatter,
xAxisFormatter,
totalMark,
}: {
params: ICallbackDataParams[];
breakdownName?: string;
defaultFormatter: NumberFormatter | CurrencyFormatter;
xAxisFormatter: (value: number | string, index: number) => string;
totalMark: string;
}) {
const series = params.find(
param => param.seriesName !== ASSIST_MARK && param.data.value !== TOKEN,
Expand All @@ -66,7 +68,7 @@ function formatTooltip({
return '';
}

const isTotal = series?.seriesName === LEGEND.TOTAL;
const isTotal = series?.seriesName === totalMark;
if (!series) {
return NULL_STRING;
}
Expand All @@ -82,7 +84,7 @@ function formatTooltip({
defaultFormatter(series.data.originalValue),
]);
}
rows.push([TOTAL_MARK, defaultFormatter(series.data.totalSum)]);
rows.push([totalMark, defaultFormatter(series.data.totalSum)]);
return tooltipHtml(rows, title);
}

Expand All @@ -91,11 +93,13 @@ function transformer({
xAxis,
metric,
breakdown,
totalMark,
}: {
data: DataRecord[];
xAxis: string;
metric: string;
breakdown?: string;
totalMark: string;
}) {
// Group by series (temporary map)
const groupedData = data.reduce((acc, cur) => {
Expand All @@ -119,7 +123,7 @@ function transformer({
// Push total per period to the end of period values array
tempValue.push({
[xAxis]: key,
[breakdown]: TOTAL_MARK,
[breakdown]: totalMark,
[metric]: sum,
});
transformedData.push(...tempValue);
Expand All @@ -138,7 +142,7 @@ function transformer({
total += sum;
});
transformedData.push({
[xAxis]: TOTAL_MARK,
[xAxis]: totalMark,
[metric]: total,
});
}
Expand Down Expand Up @@ -179,11 +183,21 @@ export default function transformProps(
xAxisLabel,
yAxisFormat,
showValue,
totalLabel,
increaseLabel,
decreaseLabel,
} = formData;
const defaultFormatter = currencyFormat?.symbol
? new CurrencyFormatter({ d3Format: yAxisFormat, currency: currencyFormat })
: getNumberFormatter(yAxisFormat);

const totalMark = totalLabel || TOTAL_MARK;
const legendNames = {
INCREASE: increaseLabel || LEGEND.INCREASE,
DECREASE: decreaseLabel || LEGEND.DECREASE,
TOTAL: totalLabel || LEGEND.TOTAL,
};

const seriesformatter = (params: ICallbackDataParams) => {
const { data } = params;
const { originalValue } = data;
Expand All @@ -205,6 +219,7 @@ export default function transformProps(
breakdown: breakdownName,
xAxis: xAxisName,
metric: metricLabel,
totalMark,
});

const assistData: ISeriesData[] = [];
Expand All @@ -217,18 +232,18 @@ export default function transformProps(
transformedData.forEach((datum, index, self) => {
const totalSum = self.slice(0, index + 1).reduce((prev, cur, i) => {
if (breakdownName) {
if (cur[breakdownName] !== TOTAL_MARK || i === 0) {
if (cur[breakdownName] !== totalMark || i === 0) {
return prev + ((cur[metricLabel] as number) ?? 0);
}
} else if (cur[xAxisName] !== TOTAL_MARK) {
} else if (cur[xAxisName] !== totalMark) {
return prev + ((cur[metricLabel] as number) ?? 0);
}
return prev;
}, 0);

const isTotal =
(breakdownName && datum[breakdownName] === TOTAL_MARK) ||
datum[xAxisName] === TOTAL_MARK;
(breakdownName && datum[breakdownName] === totalMark) ||
datum[xAxisName] === totalMark;

const originalValue = datum[metricLabel] as number;
let value = originalValue;
Expand Down Expand Up @@ -270,9 +285,9 @@ export default function transformProps(
: 'transparent';

let opacity = 1;
if (legendState?.[LEGEND.INCREASE] === false && value > 0) {
if (legendState?.[legendNames.INCREASE] === false && value > 0) {
opacity = 0;
} else if (legendState?.[LEGEND.DECREASE] === false && value < 0) {
} else if (legendState?.[legendNames.DECREASE] === false && value < 0) {
opacity = 0;
}

Expand Down Expand Up @@ -301,7 +316,7 @@ export default function transformProps(
const xAxisData = transformedData.map(row => {
let column = xAxisName;
let value = row[xAxisName];
if (breakdownName && row[breakdownName] !== TOTAL_MARK) {
if (breakdownName && row[breakdownName] !== totalMark) {
column = breakdownName;
value = row[breakdownName];
}
Expand All @@ -316,8 +331,8 @@ export default function transformProps(
});

const xAxisFormatter = (value: number | string, index: number) => {
if (value === TOTAL_MARK) {
return TOTAL_MARK;
if (value === totalMark) {
return totalMark;
}
if (coltypeMapping[xAxisColumns[index]] === GenericDataType.Temporal) {
if (typeof value === 'string') {
Expand Down Expand Up @@ -370,7 +385,7 @@ export default function transformProps(
},
{
...seriesProps,
name: LEGEND.INCREASE,
name: legendNames.INCREASE,
label: {
...labelProps,
position: 'top',
Expand All @@ -382,7 +397,7 @@ export default function transformProps(
},
{
...seriesProps,
name: LEGEND.DECREASE,
name: legendNames.DECREASE,
label: {
...labelProps,
position: 'bottom',
Expand All @@ -394,7 +409,7 @@ export default function transformProps(
},
{
...seriesProps,
name: LEGEND.TOTAL,
name: legendNames.TOTAL,
label: {
...labelProps,
position: 'top',
Expand All @@ -417,7 +432,7 @@ export default function transformProps(
legend: {
show: showLegend,
selected: legendState,
data: [LEGEND.INCREASE, LEGEND.DECREASE, LEGEND.TOTAL],
data: [legendNames.INCREASE, legendNames.DECREASE, legendNames.TOTAL],
},
xAxis: {
data: xAxisData,
Expand Down Expand Up @@ -450,6 +465,7 @@ export default function transformProps(
breakdownName,
defaultFormatter,
xAxisFormatter,
totalMark,
}),
},
series: barSeries,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ export type EchartsWaterfallFormData = QueryFormData &
xTicksLayout?: WaterfallFormXTicksLayout;
yAxisLabel: string;
yAxisFormat: string;
increaseLabel?: string;
decreaseLabel?: string;
totalLabel?: string;
};

export const DEFAULT_FORM_DATA: Partial<EchartsWaterfallFormData> = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const showValueControl: ControlSetItem = {
name: 'show_value',
config: {
type: 'CheckboxControl',
label: t('Show Value'),
label: t('Show value'),
default: false,
renderTrigger: true,
description: t('Show series values on the chart'),
Expand Down
Loading
Loading