Merge pull request #242 from ddoice/feature/truncate-legend-dot-labels

Feature/truncate legend dot labels
This commit is contained in:
Shivam Mishra 2019-09-16 18:42:12 +05:30 committed by GitHub
commit 68d0d1f10e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -80,7 +80,8 @@ export default class AggregationChart extends BaseChart {
y, y,
5, 5,
this.colors[i], this.colors[i],
`${s.labels[i]}: ${d}` `${s.labels[i]}: ${d}`,
this.config.truncateLegends
); );
this.legendArea.appendChild(dot); this.legendArea.appendChild(dot);
count++; count++;

View File

@ -238,7 +238,9 @@ export function legendBar(x, y, size, fill='none', label, truncate=false) {
return group; return group;
} }
export function legendDot(x, y, size, fill='none', label) { export function legendDot(x, y, size, fill='none', label, truncate=false) {
label = truncate ? truncateString(label, LABEL_MAX_CHARS) : label;
let args = { let args = {
className: 'legend-dot', className: 'legend-dot',
cx: 0, cx: 0,