瀏覽代碼

Merge pull request #309 from SaiFi0102/AggregateChart-Formatter

fix(AggregationChart): Formatter not being applied
tags/1.5.3
Shivam Mishra 4 年之前
committed by GitHub
父節點
當前提交
f644e19a5b
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. +3
    -1
      src/js/charts/AggregationChart.js

+ 3
- 1
src/js/charts/AggregationChart.js 查看文件

@@ -11,6 +11,7 @@ export default class AggregationChart extends BaseChart {
configure(args) {
super.configure(args);

this.config.formatTooltipY = args.tooltipOptions.formatTooltipY;
this.config.maxSlices = args.maxSlices || 20;
this.config.maxLegendPoints = args.maxLegendPoints || 20;
}
@@ -77,12 +78,13 @@ export default class AggregationChart extends BaseChart {
}
let x = barWidth * count + 5;
let label = this.config.truncateLegends ? truncateString(s.labels[i], barWidth/10) : s.labels[i];
let formatted = this.config.formatTooltipY ? this.config.formatTooltipY(d) : d;
let dot = legendDot(
x,
y,
5,
this.colors[i],
`${label}: ${d}`,
`${label}: ${formatted}`,
false
);
this.legendArea.appendChild(dot);


Loading…
取消
儲存