瀏覽代碼

refactor: let Aggregate chart manage legends

tags/v1.5.0
Shivam Mishra 5 年之前
父節點
當前提交
e0c1bde2ff
共有 1 個檔案被更改,包括 4 行新增2 行删除
  1. +4
    -2
      src/js/charts/AggregationChart.js

+ 4
- 2
src/js/charts/AggregationChart.js 查看文件

@@ -1,4 +1,5 @@
import BaseChart from './BaseChart';
import { truncateString } from '../utils/draw-utils';
import { legendDot } from '../utils/draw';
import { getExtraWidth } from '../utils/constants';

@@ -75,13 +76,14 @@ export default class AggregationChart extends BaseChart {
y += 20;
}
let x = barWidth * count + 5;
let label = this.config.truncateLegends ? truncateString(s.labels[i], barWidth/10) : s.labels[i];
let dot = legendDot(
x,
y,
5,
this.colors[i],
`${s.labels[i]}: ${d}`,
this.config.truncateLegends
`${label}: ${d}`,
false
);
this.legendArea.appendChild(dot);
count++;


Loading…
取消
儲存