SUPPORT-8932: fix
This commit is contained in:
parent
07efd60020
commit
2bacd38a2f
2 changed files with 10 additions and 8 deletions
|
|
@ -6,6 +6,7 @@ import {
|
|||
SimpleChanges
|
||||
} from '@angular/core';
|
||||
import {Visible} from "@webbpm/base-package";
|
||||
import {TooltipModel} from "chart.js";
|
||||
|
||||
@Component({
|
||||
moduleId: module.id,
|
||||
|
|
@ -15,7 +16,7 @@ import {Visible} from "@webbpm/base-package";
|
|||
})
|
||||
export class ErvuChartTooltip implements OnChanges {
|
||||
@Input()
|
||||
public tooltipModel: any;
|
||||
public tooltipModel: TooltipModel<any>;
|
||||
@Input()
|
||||
public position: any;
|
||||
|
||||
|
|
@ -36,9 +37,9 @@ export class ErvuChartTooltip implements OnChanges {
|
|||
}
|
||||
|
||||
public refreshContent() {
|
||||
const tooltipModel = this.tooltipModel;
|
||||
const titleLines = tooltipModel.title || [];
|
||||
const bodyLines = tooltipModel.body.map((bodyItem) => bodyItem.lines);
|
||||
const tooltipModel: TooltipModel<any> = this.tooltipModel;
|
||||
const titleLines: string[] = tooltipModel.title || [];
|
||||
const bodyLines: any = tooltipModel.body.map((bodyItem) => bodyItem.lines);
|
||||
|
||||
this.items = bodyLines.map((body, i) => ({
|
||||
title: titleLines[i] || '',
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {
|
|||
ViewChild
|
||||
} from "@angular/core";
|
||||
|
||||
import {Chart as ChartJs, ChartData, ChartType, DefaultDataPoint} from "chart.js";
|
||||
import {Chart as ChartJs, ChartData, ChartType, DefaultDataPoint, TooltipModel} from "chart.js";
|
||||
import "chartjs-adapter-moment";
|
||||
import {
|
||||
AdvancedProperty,
|
||||
|
|
@ -96,17 +96,18 @@ export class ErvuChartV2 extends Control implements Filterable {
|
|||
public noDataStyle: string = "rgb(100,100,100)";
|
||||
|
||||
@ViewChild(ErvuChartTooltip)
|
||||
@Visible("false")
|
||||
public chartTooltip: ErvuChartTooltip;
|
||||
@Visible("false")
|
||||
public tooltipPosition: any;
|
||||
@Visible("false")
|
||||
public tooltipModel;
|
||||
public tooltipModel: TooltipModel<any>;
|
||||
|
||||
private chartRpcService: ChartV2RpcService;
|
||||
private filterMap: { [key: string]: Filter } = {};
|
||||
private loadEnabled: boolean = true;
|
||||
private filterDelegate: FilterDelegate;
|
||||
private chartConfig;
|
||||
private chartConfig: any;
|
||||
private plugins: ChartPlugin[] = [];
|
||||
|
||||
private noDataPlugin = {
|
||||
|
|
@ -227,7 +228,7 @@ export class ErvuChartV2 extends Control implements Filterable {
|
|||
|
||||
chartOptions.plugins.legend = this.legend ? this.legend : {};
|
||||
chartOptions.plugins.tooltip = {
|
||||
enabled: false,
|
||||
enabled: false, //Disables default tooltip from charjs (we'll use a custom tooltip)
|
||||
external: (context) => {
|
||||
if (this.showTooltip) {
|
||||
if (!context || !this.chartTooltip) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue