相关疑难解决方法(0)

NG2-Charts无法绑定到'数据集',因为它不是'canvas'的已知属性

我正在尝试使用NG2-Charts的基本示例(http://valor-software.com/ng2-charts/)

我复制粘贴HTML部分

  <div style="display: block">
    <canvas baseChart
        [datasets]="barChartData"
        [labels]="barChartLabels"
        [options]="barChartOptions"
        [legend]="barChartLegend"
        [chartType]="barChartType"
        (chartHover)="chartHovered($event)"
        (chartClick)="chartClicked($event)"></canvas>
  </div>
Run Code Online (Sandbox Code Playgroud)

和TypeScript部分

  private barChartOptions: any = {
    scaleShowVerticalLines: false,
    responsive: true
  };
  private barChartLabels: string[] = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
  private barChartType: string = 'bar';
  private barChartLegend: boolean = true;

  private barChartData: any[] = [
    { data: [65, 59, 80, 81, 56, 55, 40], label: 'Series A' },
    { data: [28, 48, 40, 19, 86, 27, 90], label: 'Series B' } …
Run Code Online (Sandbox Code Playgroud)

javascript charts chart.js ng2-charts angular

35
推荐指数
4
解决办法
2万
查看次数

ng2-charts - 无法绑定到"数据集",因为它不是"基础图表"的已知属性

版本:Cordova:6.3.1,Gulp CLI:1.2.2,离子框架:2.0.0-rc.0,Ionic CLI版本:2.1.0


我在ionic2应用程序中使用ng2-charts.

进口不受import {ChartsModule} from "ng2-charts"; 而是import {ChartsModule} from "ng2-charts/components/charts/charts;"因为这个(问题#440)

我的整个app.module.ts

import { NgModule } from '@angular/core';
import { IonicApp, IonicModule } from 'ionic-angular';
import { ChartsModule } from 'ng2-charts/components/charts/charts';

import { MyApp } from './app.component';
import { EventsPage } from '../pages/events/events.component';
import { ChartComponent } from '../pages/chart/chart.component';
import { APICaller } from '../services/APICaller.service';
import { EventDetailComponent } from '../pages/event-detail/event-detail.component';
import { ParticipantDetail } from '../pages/participant-detail/participant-detail.component';
import { ParticipantFeedComponent } from …
Run Code Online (Sandbox Code Playgroud)

ionic2 ng2-charts angular

7
推荐指数
1
解决办法
4353
查看次数

标签 统计

angular ×2

ng2-charts ×2

chart.js ×1

charts ×1

ionic2 ×1

javascript ×1