ng2-charts

ng2-chart tooltip position change option?

假装没事ソ 提交于 2021-01-28 06:40:23
问题 I am trying to build a Doughnut Chart using ng2-chart Angular2 directives for Chart.js. This chart.js has default option for tooltip positioning, I want to make tooltip to show outside the chart. Is there a way to make it possible? public doughnutChartOptions = { responsive: true, tooltips:{ mode: 'nearest', } } I expect something like tooltip to be displayed outside the chart, Instead of showing inside the chart; top, bottom and to sides. 回答1: You can use custom property on tooltip like this

Pause horizontal scrolling in chart.js for real time data

扶醉桌前 提交于 2020-12-13 12:07:33
问题 I am working on chart.js plugin with real time chart so i want to pause scrolling chart but when i calling pause dynamically its not working. pausestart:boolean; plugins: { streaming: { onRefresh: function(chart: any) { chart.data.datasets.forEach(function(dataset: any) { dataset.data.push({ x: Date.now(), y: Math.random() }); }); }, duration: 12000, refresh: 100, delay: 1000, frameRate: 60, pause: this.pausestart } } i am setting pausestart initially false after click on pause button set it

Pause horizontal scrolling in chart.js for real time data

心不动则不痛 提交于 2020-12-13 12:05:05
问题 I am working on chart.js plugin with real time chart so i want to pause scrolling chart but when i calling pause dynamically its not working. pausestart:boolean; plugins: { streaming: { onRefresh: function(chart: any) { chart.data.datasets.forEach(function(dataset: any) { dataset.data.push({ x: Date.now(), y: Math.random() }); }); }, duration: 12000, refresh: 100, delay: 1000, frameRate: 60, pause: this.pausestart } } i am setting pausestart initially false after click on pause button set it

Correct config location of chartjs-plugin-annotation with ng2-charts?

五迷三道 提交于 2020-12-13 03:12:36
问题 I'm using ng2-charts to draw a bar chart in my Angular application. At some point I had to add static lines to my charts, and I decided to use chartjs-plugin-annotation . Connecting these two libraries together is not well documented, but after some googling I was eventually able to get it working. Here is a minimalistic demo. Yet while it works well on stackblitz, the IDE on my local machine complains that annotation is not expected by ChartOptions interface: public barChartOptions:

Correct config location of chartjs-plugin-annotation with ng2-charts?

一个人想着一个人 提交于 2020-12-13 03:11:22
问题 I'm using ng2-charts to draw a bar chart in my Angular application. At some point I had to add static lines to my charts, and I decided to use chartjs-plugin-annotation . Connecting these two libraries together is not well documented, but after some googling I was eventually able to get it working. Here is a minimalistic demo. Yet while it works well on stackblitz, the IDE on my local machine complains that annotation is not expected by ChartOptions interface: public barChartOptions:

Correct config location of chartjs-plugin-annotation with ng2-charts?

旧巷老猫 提交于 2020-12-13 03:11:13
问题 I'm using ng2-charts to draw a bar chart in my Angular application. At some point I had to add static lines to my charts, and I decided to use chartjs-plugin-annotation . Connecting these two libraries together is not well documented, but after some googling I was eventually able to get it working. Here is a minimalistic demo. Yet while it works well on stackblitz, the IDE on my local machine complains that annotation is not expected by ChartOptions interface: public barChartOptions:

How update option without reload chart (ng2-chart)

前提是你 提交于 2020-08-08 05:54:54
问题 I need to update option in the chart and I need to show the chart with new option. I WANT that the chart IS NOT RELOAD this is my ts. @ViewChild(BaseChartDirective) chart: any; lineChartOptions: any = { responsive: true, zoom:{ // Boolean to enable zooming enabled: false, sensitivity: 0.5, // Enable drag-to-zoom behavior drag: true, // Zooming directions. Remove the appropriate direction to disable // Eg. 'y' would only allow zooming in the y direction mode: 'xy', rangeMin: { // Format of min

Trying to apply a gradient on my ng2-charts chart : createLinearGradient is not a function

回眸只為那壹抹淺笑 提交于 2020-06-27 04:49:32
问题 I'm trying to apply a linear gradient on my canvas chart with ng2-charts I'm getting this error : DashboardComponent.html:278 ERROR TypeError: this.canvas.createLinearGradient is not a function My component : @ViewChildren('chart') canvas: CanvasRenderingContext2D; ngAfterViewInit() { this.getUserXps(this.id); let gradient = this.canvas.createLinearGradient(0, 0, 0, 0); console.log(this.canvas); gradient.addColorStop(0, 'green'); gradient.addColorStop(1, 'blue'); this.lineChartColor[0]