Skip to content

Commit

Permalink
fix(sankey): provide missing label value in formatter #18212
Browse files Browse the repository at this point in the history
  • Loading branch information
TommysLee committed Mar 23, 2023
1 parent b84493a commit fdda025
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/chart/sankey/SankeyView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ class SankeyView extends ChartView {
{
labelFetcher: seriesModel,
labelDataIndex: node.dataIndex,
labelValue: layout.value,
defaultText: node.id
}
);
Expand Down
6 changes: 3 additions & 3 deletions src/label/labelStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ interface SetLabelStyleOpt<TLabelDataIndex> extends TextCommonParams {
};
labelDataIndex?: TLabelDataIndex;
labelDimIndex?: number;
labelValue?: number;

/**
* Inject a setter of text for the text animation case.
Expand Down Expand Up @@ -135,6 +136,7 @@ function getLabelText<TLabelDataIndex>(
const labelFetcher = opt.labelFetcher;
const labelDataIndex = opt.labelDataIndex;
const labelDimIndex = opt.labelDimIndex;
const labelValue = opt.labelValue;
const normalModel = stateModels.normal;
let baseText;
if (labelFetcher) {
Expand All @@ -143,9 +145,7 @@ function getLabelText<TLabelDataIndex>(
null,
labelDimIndex,
normalModel && normalModel.get('formatter'),
interpolatedValue != null ? {
interpolatedValue: interpolatedValue
} : null
{interpolatedValue: retrieve2(interpolatedValue, labelValue)}
);
}
if (baseText == null) {
Expand Down
98 changes: 98 additions & 0 deletions test/sankey-labelValue.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fdda025

Please sign in to comment.