ng2-charts

NG2-Charts Can't bind to 'datasets' since it isn't a known property of 'canvas'

北战南征 提交于 2019-12-05 08:29:30
问题 I am trying to use the basic example of NG2-Charts (http://valor-software.com/ng2-charts/) I copy pasted the HTML part <div style="display: block"> <canvas baseChart [datasets]="barChartData" [labels]="barChartLabels" [options]="barChartOptions" [legend]="barChartLegend" [chartType]="barChartType" (chartHover)="chartHovered($event)" (chartClick)="chartClicked($event)"></canvas> </div> and the TypeScript part private barChartOptions: any = { scaleShowVerticalLines: false, responsive: true };

Angular 2 ng2-charts doughnut text in the middle?

故事扮演 提交于 2019-12-04 02:39:42
I am using Doughnut chart from ng2-charts ( http://valor-software.com/ng2-charts/ ) in angular 2. I have been searching for an option to put a text in the middle without success. I already searched in ng-chart options as in chart.js (dependency). Do you know another way to achieve this in Angular 2 typescript? or there is something I am missing? You can do the following to place text in the center of doughnut chart. It worked for me HTML: <div style="display: block"> <canvas #mycanvas baseChart [data]="doughnutChartData" [labels]="doughnutChartLabels" [chartType]="doughnutChartType"

Dynamically Populate ng2 chart in Angular 4

删除回忆录丶 提交于 2019-12-03 21:59:17
I have written a sample application to fetch data from service in json format and bind it to the chart on UI. The problem is when ever I try to bind the data, it doesn't. I tried in many ways to bind data but was unsuccessfull. Functionality is as follows: Page 1: contains 2 dropdowns. 1 with Chart Type & 2nd with Sample Type. On selection of both dropdown values, I click on a button which triggers a function fetchData() in GlobalService. Below is getter & setter in GlobalService getChartData() { return this.chartData; } setChartData(response: any) { this.chartData = response.data; // console

WARNING in ./node_modules/ng2-charts/fesm5/ng2-charts.js 230:54-72 \"export 'ɵɵdefineInjectable' was not found in '@angular/core'

淺唱寂寞╮ 提交于 2019-12-03 09:58:15
I am using ng2-charts in Angular 7 app and having warning WARNING in ./node_modules/ng2-charts/fesm5/ng2-charts.js 230:54-72 "export 'ɵɵdefineInjectable' was not found in '@angular/core' error in VS Code error in browser What could be the reason and how to resolve it? ng2-charts v2.2.4 has this bug as lots of users are reporting that so down-grading to ng2-charts v2.2.3 is fine until it is fixed in the future releases. npm install ng2-charts@2.2.3 来源: https://stackoverflow.com/questions/56371427/warning-in-node-modules-ng2-charts-fesm5-ng2-charts-js-23054-72-export-%c9%b5%c9%b5de

Angular2 Update ng2-charts with labels

谁说胖子不能爱 提交于 2019-12-01 05:54:35
I am starting to work these days with Angular2 , and have a question with the framework ng2-charts . Here is my component.ts code : import { Component } from '@angular/core'; import { ChartsModule } from 'ng2-charts'; import { PredictionService } from './prediction.service' @Component({ selector: 'prediction-result-chart', templateUrl: './predictionResultChart.component.html' }) export class PredictionResultChartComponent{ public pieChartLabels:string[] = []; public pieChartData:number[] = []; public pieChartType:string = 'pie'; public JSONobject = {} constructor(private predictionService:

Angular2 Update ng2-charts with labels

丶灬走出姿态 提交于 2019-12-01 04:27:46
问题 I am starting to work these days with Angular2 , and have a question with the framework ng2-charts . Here is my component.ts code : import { Component } from '@angular/core'; import { ChartsModule } from 'ng2-charts'; import { PredictionService } from './prediction.service' @Component({ selector: 'prediction-result-chart', templateUrl: './predictionResultChart.component.html' }) export class PredictionResultChartComponent{ public pieChartLabels:string[] = []; public pieChartData:number[] = []

How to make Chart.js Bubble chart with ng2-chart?

自闭症网瘾萝莉.ら 提交于 2019-11-28 10:30:46
问题 Chart.js supports bubble charts, but the ng2-chart docs don't mention them. Is it possible to build a bubble chart with ng2-charts ? Any pointer to a working example would be great. note: cross-posted on github 回答1: I've had a look at the source code. As of version 1.1.0 (May 17 2016), bubble charts do not appear to be supported. 回答2: The npm package ng2-charts now supports bubble charts (as of version 2.0.0-beta.10 ) Here's the snippet from the demo app: <div style="display: block"> <canvas

ng2-charts update labels and data

爱⌒轻易说出口 提交于 2019-11-28 06:56:32
I'm trying to create dynamically a chart using ng2-chart, I get information from an angular 2 service, when I change only labels of chart it works and when I change data only it works, but When I change both just data are updated in the chart. have any one an explication for this strange behavior. my template : <canvas baseChart height="130" width="180" [data]="doughnutChartData" [labels]="doughnutChartLabels" [chartType]="doughnutChartType" (chartHover)="chartHovered($event)" (chartClick)="chartClicked($event)"></canvas> my class : export class PlDoughnutComponent implements OnInit {

ng2-charts update labels and data

为君一笑 提交于 2019-11-27 01:20:14
问题 I'm trying to create dynamically a chart using ng2-chart, I get information from an angular 2 service, when I change only labels of chart it works and when I change data only it works, but When I change both just data are updated in the chart. have any one an explication for this strange behavior. my template : <canvas baseChart height="130" width="180" [data]="doughnutChartData" [labels]="doughnutChartLabels" [chartType]="doughnutChartType" (chartHover)="chartHovered($event)" (chartClick)=