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