スポンサーリンク

Ionic2でグラフ(2)

以下を試してみる

Ionic 2 and Chart.js (ng2-charts) an Example Bar Chart Project
https://learnionic2.com/2017/02/13/ionic-2-and-chart-js-ng2-charts-an-example-bar-chart-project/

上記を写経してみたい。

(環境)
Windows8.1
Node 6.9.1
cordova 6.5.0
Ionic 2.2.2
VisualStudioCode
Git 2.8.1

(1)ng2-chartとchart.jsのインストール

 

ionic start ionic2-charts blank –v2
cd ionic2-charts
npm install ng2-charts –save
npm install chart.js –save

 

image

image

(2)src/app/app.module.ts

image

(3)これ以外のコードは、以下のサイトを写経

https://learnionic2.com/2017/02/13/ionic-2-and-chart-js-ng2-charts-an-example-bar-chart-project/

src/pages/home/home.ts では、

import { Chart } from ‘chart.js’;

をimportする感じ。

ionic serve

image

image

わーい!すごーい!たーのしー!

スポンサーリンク