0
グラフにデータを表示するコードです。ここでの質問は、ユーザー入力ion-input
からのデータを、data: [80,88, 89]
のようなコーディングでプログラミングするのではなく、チャート形式で表示する方法です。私は解決策を探していましたが、既にデータが入っているソースコードしか見つかりませんでした。前もって感謝します。ユーザーからデータを取得してグラフに表示する方法Ionic 2
performanceReview.html
<ion-header>
<ion-navbar>
<ion-buttons left>
<button ion-button menuToggle>
<ion-icon name="menu"></ion-icon>
</button>
</ion-buttons>
<ion-title>Performance Review</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<div id="container" style="display: block;" ></div>
</ion-content>
performanceReview.ts
import { Component } from '@angular/core';
import { IonicPage } from 'ionic-angular';
import * as HighCharts from 'highcharts';
@IonicPage()
@Component({
selector: 'page-performanceReview',
templateUrl: 'performanceReview.html',})
export class PerformanceReviewPage {
constructor() {}
ionViewDidLoad() {
let myChart = HighCharts.chart('container', {
chart: {
type: 'bar'
},
title: {
text: 'Performance Review'
},
xAxis: {
categories: ['Test 1', 'Test 2', 'Final Exam']
},
yAxis: {
title: {
text: 'Performance Review'
}
},
series: [{
name: 'Science',
data: [80,88, 89]
}, {
name: 'Mathematics',
data: [95, 78, 89]
}]
});
}
}
https://ionicframework.com/docs/api/components/input/Input/ –
@ Jota.Toledoはい、私はイオン入力を使用する方法を知っています。私はイオン入力を使っていくつかのページを作った。しかし、私はチャートでそれを表示する方法を知らないです。今のところ、チャートはユーザー入力からではなく、コーディングからデータを取得します。 – rightside