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