Open micobarac opened 4 years ago
I tried adding dependencies to polyfills.ts:
polyfills.ts
import 'chart.js'; import 'hammerjs'; import 'chartjs-plugin-zoom';
Then, I initiated a chart in Angular:
Angular
// Initiate chart this.chart = new Chart(this.chartRef); this.chart.chartType = 'line'; this.chart.chartLegend = true; this.chart.chartOptions = { responsive: true, maintainAspectRatio: false, title: { display: true, position: 'left', text: this.translateService.get('Performance.ChartTitle') }, scales: { yAxes: [ { ticks: { beginAtZero: true } } ] }, plugins: { zoom: { pan: { enabled: true, mode: 'x', speed: 10, threshold: 10 } } } };
But, when I try panning the chart, I get the tons of these errors:
I tried adding plugins property to the chart:
plugins
import * as zoom from 'chartjs-plugin-zoom'; this.chart.chartPlugins = [zoom];
Then in HTML:
HTML
<canvas #chartRef baseChart [datasets]="chart.chartData" [labels]="chart.chartDataLabels" [options]="chart.chartOptions" [plugins]="chart.chartPlugins" [legend]="chart.chartLegend" [chartType]="chart.chartType" (chartHover)="chart.onChartHover($event)" (chartClick)="chart.onChartClick($event)"></canvas>
But, it looks like the zoom plugin cannot get the required plugin options and the errors remain.
Hi.. Have you got any solution of this?
I tried adding dependencies to
polyfills.ts
:Then, I initiated a chart in
Angular
:But, when I try panning the chart, I get the tons of these errors:
I tried adding
plugins
property to the chart:Then in
HTML
:But, it looks like the zoom plugin cannot get the required plugin options and the errors remain.