Skip to content

Commit

Permalink
fix(chart): all kind of line chart should not show aggrete name but f…
Browse files Browse the repository at this point in the history
…ormatted content

issue running-elephant#196, running-elephant#197
  • Loading branch information
Cuiyansong committed Nov 11, 2021
1 parent c91232c commit 6c2e7a4
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
getColorizeGroupSeriesColumns,
getColumnRenderName,
getCustomSortableColumns,
getExtraSeriesDataFormat,
getExtraSeriesRowData,
getNameTextStyle,
getReference,
Expand Down Expand Up @@ -188,6 +189,7 @@ class BasicLineChart extends Chart {
stack: this.isStack ? 'total' : undefined,
data: dataColumns.map(dc => ({
...getExtraSeriesRowData(dc),
...getExtraSeriesDataFormat(aggConfig?.format),
name: getColumnRenderName(aggConfig),
value: dc[getValueByColumnKey(aggConfig)],
})),
Expand Down Expand Up @@ -236,6 +238,7 @@ class BasicLineChart extends Chart {
const target = v.find(col => col[xAxisColumnName] === d);
return {
...getExtraSeriesRowData(target),
...getExtraSeriesDataFormat(aggConfig?.format),
name: getColumnRenderName(aggConfig),
value: target?.[getValueByColumnKey(aggConfig)] || 0,
};
Expand Down Expand Up @@ -398,10 +401,10 @@ class BasicLineChart extends Chart {
position,
...font,
formatter: params => {
const { name, value, data } = params;
const { value, data } = params;
const formattedValue = toFormattedValue(value, data.format);
const labels: string[] = [];
labels.push(`${name}: ${formattedValue}`);
labels.push(formattedValue);
return labels.join('\n');
},
},
Expand Down

0 comments on commit 6c2e7a4

Please sign in to comment.