SUPPORT-8932: fix
This commit is contained in:
parent
9ca5c70ff7
commit
5ff1df5d2a
2 changed files with 17 additions and 20 deletions
|
|
@ -24,10 +24,6 @@ export class ErvuChartTooltip extends Control {
|
|||
|
||||
@Visible("false")
|
||||
public items: any[];
|
||||
@Visible("false")
|
||||
public bodyLines: string[][] = [];
|
||||
@Visible("false")
|
||||
public titleLines: string[] = [];
|
||||
|
||||
constructor(el: ElementRef, cd: ChangeDetectorRef) {
|
||||
super(el, cd)
|
||||
|
|
@ -46,11 +42,11 @@ export class ErvuChartTooltip extends Control {
|
|||
|
||||
public refreshContent() {
|
||||
const tooltipModel = this.tooltipModel;
|
||||
this.titleLines = tooltipModel.title || [];
|
||||
this.bodyLines = tooltipModel.body.map((bodyItem) => bodyItem.lines);
|
||||
const titleLines = tooltipModel.title || [];
|
||||
const bodyLines = tooltipModel.body.map((bodyItem) => bodyItem.lines);
|
||||
|
||||
this.items = this.bodyLines.map((body, i) => ({
|
||||
title: this.titleLines[i] || '',
|
||||
this.items = bodyLines.map((body, i) => ({
|
||||
title: titleLines[i] || '',
|
||||
body: body,
|
||||
color: this.tooltipModel.labelColors[i].backgroundColor
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -225,21 +225,22 @@ export class ErvuChartV2 extends Control implements Filterable {
|
|||
|
||||
chartOptions.plugins.legend = this.legend ? this.legend : {};
|
||||
chartOptions.plugins.tooltip = {
|
||||
enabled: !this.showTooltip,
|
||||
enabled: false,
|
||||
external: (context) => {
|
||||
if (!context || !this.chartTooltip) {
|
||||
this.visible = false;
|
||||
return;
|
||||
}
|
||||
const positionX = this.chart.canvas.offsetLeft;
|
||||
const positionY = this.chart.canvas.offsetTop;
|
||||
if (this.showTooltip) {
|
||||
if (!context || !this.chartTooltip) {
|
||||
return;
|
||||
}
|
||||
const positionX = this.chart.canvas.offsetLeft;
|
||||
const positionY = this.chart.canvas.offsetTop;
|
||||
|
||||
this.tooltipModel = context.tooltip;
|
||||
this.tooltipPosition = {
|
||||
'left': positionX + context.tooltip.caretX,
|
||||
'top': positionY + context.tooltip.caretY
|
||||
this.tooltipModel = context.tooltip;
|
||||
this.tooltipPosition = {
|
||||
'left': positionX + context.tooltip.caretX,
|
||||
'top': positionY + context.tooltip.caretY
|
||||
}
|
||||
this.cd.markForCheck();
|
||||
}
|
||||
this.cd.markForCheck();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue