简体   繁体   English

如何在 ng-apexchart 中禁用工具提示

[英]How to disable tool-tip in ng-apexchart

I am integrating apex chart in my angular app, implementing apex line chart.我正在我的角度应用程序中集成顶点图表,实现顶点折线图。 I want to hide the tool-tip tried with option enabled: false.我想隐藏在启用选项的情况下尝试的工具提示:false。 but not working.但不工作。 even not able to set custom tool-tip to line chart.甚至无法将自定义工具提示设置为折线图。 when hover on series it is displaying some dashed vertical line, I need to hide the tool-tip or hide the dashed vertical line & create custom tool-tip.当悬停在系列上时,它会显示一些垂直虚线,我需要隐藏工具提示或隐藏垂直虚线并创建自定义工具提示。

any suggestion would be very helpful.任何建议都会非常有帮助。 Thank you.谢谢你。

 import { Component, ViewChild, OnInit } from '@angular/core'; import { ChartComponent, ApexAxisChartSeries, ApexChart, ApexXAxis, ApexDataLabels, ApexTitleSubtitle, ApexStroke, ApexGrid, ApexLegend, ApexTooltip, ApexYAxis, } from 'ng-apexcharts'; export interface ChartOptions { series: ApexAxisChartSeries; chart: ApexChart; xaxis: ApexXAxis; yaxis: ApexYAxis; dataLabels: ApexDataLabels; grid: ApexGrid; stroke: ApexStroke; title: ApexTitleSubtitle; legend: ApexLegend; tooltip: ApexTooltip; } @Component({ selector: 'app-line-chart', templateUrl: './line-chart.component.html', styleUrls: ['./line-chart.component.css'], }) export class LineChartComponent implements OnInit { @ViewChild('lineChart') lineChart: ChartComponent; public chartOptions: Partial<ChartOptions>; constructor() {} ngOnInit(): void { this.chartOptions = { series: [ { name: 'Desktops', data: [10, 41, 35, 51, 49, 62, 69, 91, 148], }, { name: 'Laptops', data: [22, 55, 66, 77, 88, 99, 90, 110, 170], }, ], chart: { height: 350, type: 'line', zoom: { enabled: false, }, toolbar: { tools: { download: false, }, }, }, dataLabels: { enabled: false, }, stroke: { curve: 'straight', }, grid: { row: { colors: ['#f3f3f3', 'transparent'], // takes an array which will be repeated on columns opacity: 0.5, }, }, yaxis: { tooltip: { enabled: false, }, }, xaxis: { categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep'], tooltip: { enabled: false, }, }, legend: { show: false, onItemClick: { toggleDataSeries: false, }, onItemHover: { highlightDataSeries: false, }, }, tooltip: { enabled: false, enabledOnSeries: undefined, marker: { show: false, } } }; } }
 <apx-chart [series]="chartOptions.series" [chart]="chartOptions.chart" [xaxis]="chartOptions.xaxis" [dataLabels]="chartOptions.dataLabels" [grid]="chartOptions.grid" [stroke]="chartOptions.stroke" [title]="chartOptions.title" #lineChart ></apx-chart>
截图

You are missing the tooltip attribute in your component您缺少组件中的工具提示属性

<apx-chart
  ...
  [tooltip]="chartOptions.tooltip"
  #lineChart
></apx-chart>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM