基本折线图

该示例显示了具有多个彩色线系列和工具提示的基本方案

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; import * as chart from '@grapecity/wijmo.chart'; import * as animation from '@grapecity/wijmo.chart.animation'; import { getData } from './data'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { let linechart = new chart.FlexChart('#chart', { header: 'Temperature of New York', legend: { position: chart.Position.Bottom }, chartType: chart.ChartType.Line, bindingX: 'month', series: [{ binding: 'low', name: 'Average Low' }, { binding: 'high', name: 'Average High' }, { binding: 'mean', name: 'Daily Mean' }], axisY: { title: 'Temperature(°C)' }, itemsSource: getData(), palette: ['rgba(42,159,214,1)', 'rgba(119,179,0,1)', 'rgba(153,51,204,1)', 'rgba(255,136,0,1)', 'rgba(204,0,0,1)', 'rgba(0,204,163,1)', 'rgba(61,109,204,1)', 'rgba(82,82,82,1)', 'rgba(0,0,0,1)'] }); // let ani = new animation.ChartAnimation(linechart); ani.animationMode = animation.AnimationMode.Point; } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexChart Basic Line Chart</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div class="container-fluid"> <div id="chart"></div> </div> </body> </html> // The climate of New York // https://en.wikipedia.org/wiki/Climate_of_New_York export function getData() { return [ { month: 'Jan', mean: -5.2, high: -0.8, low: -9.7 }, { month: 'Feb', mean: -3.4, high: 1.4, low: -8.2 }, { month: 'Mar', mean: 1.7, high: 6.9, low: -3.5 }, { month: 'Apr', mean: 8.8, high: 14.6, low: 2.9 }, { month: 'May', mean: 14.6, high: 20.8, low: 8.4 }, { month: 'Jun', mean: 19.6, high: 25.5, low: 13.6 }, { month: 'Jul', mean: 22.1, high: 27.9, low: 16.3 }, { month: 'Aug', mean: 21.2, high: 26.9, low: 15.5 }, { month: 'Sep', mean: 16.6, high: 22.3, low: 10.9 }, { month: 'Oct', mean: 9.8, high: 15.4, low: 4.2 }, { month: 'Nov', mean: 4.3, high: 8.8, low: -0.3 }, { month: 'Dec', mean: -1.9, high: 2.1, low: -6 } ]; } body { margin-bottom: 24px; } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import { Component, Inject, enableProdMode, NgModule } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserModule } from '@angular/platform-browser'; import { WjChartModule } from '@grapecity/wijmo.angular2.chart'; import { WjChartAnimationModule } from '@grapecity/wijmo.angular2.chart.animation'; import { DataService } from './app.data'; // @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { data: any; // constructor(@Inject(DataService) private dataService: DataService) { this.data = dataService.getData(); } } // @NgModule({ imports: [WjChartModule, WjChartAnimationModule, BrowserModule], declarations: [AppComponent], providers: [DataService], bootstrap: [AppComponent] }) export class AppModule { } // enableProdMode(); // Bootstrap application with hash style navigation and global services. platformBrowserDynamic().bootstrapModule(AppModule); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexGrid Basic Line Chart</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Polyfills --> <script src="node_modules/core-js/client/shim.min.js"></script> <script src="node_modules/zone.js/dist/zone.min.js"></script> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.js"></script> <script src="systemjs.config.js"></script> <script> // workaround to load 'rxjs/operators' from the rxjs bundle System.import('rxjs').then(function (m) { System.set(SystemJS.resolveSync('rxjs/operators'), System.newModule(m.operators)); System.import('./src/app.component'); }); </script> </head> <body> <app-component></app-component> </body> </html> <div class="container-fluid"> <wj-flex-chart [itemsSource]="data" [bindingX]="'month'" [chartType]="'Line'" [header]="'Temperature of New York'" [palette]="['rgba(42,159,214,1)', 'rgba(119,179,0,1)', 'rgba(153,51,204,1)', 'rgba(255,136,0,1)', 'rgba(204,0,0,1)', 'rgba(0,204,163,1)', 'rgba(61,109,204,1)', 'rgba(82,82,82,1)', 'rgba(0,0,0,1)']"> <wj-flex-chart-legend [position]="'Bottom'"></wj-flex-chart-legend> <wj-flex-chart-axis [wjProperty]="'axisY'" [title]="'Temperature(°C)'"></wj-flex-chart-axis> <wj-flex-chart-series [binding]="'low'" [name]="'Average Low'"></wj-flex-chart-series> <wj-flex-chart-series [binding]="'high'" [name]="'Average High'"></wj-flex-chart-series> <wj-flex-chart-series [binding]="'mean'" [name]="'Daily Mean'"></wj-flex-chart-series> <wj-flex-chart-animation [animationMode]="'Point'"></wj-flex-chart-animation> </wj-flex-chart> </div> import { Injectable } from '@angular/core'; // @Injectable() export class DataService { getData() { return [ { month: 'Jan', mean: -5.2, high: -0.8, low: -9.7 }, { month: 'Feb', mean: -3.4, high: 1.4, low: -8.2 }, { month: 'Mar', mean: 1.7, high: 6.9, low: -3.5 }, { month: 'Apr', mean: 8.8, high: 14.6, low: 2.9 }, { month: 'May', mean: 14.6, high: 20.8, low: 8.4 }, { month: 'Jun', mean: 19.6, high: 25.5, low: 13.6 }, { month: 'Jul', mean: 22.1, high: 27.9, low: 16.3 }, { month: 'Aug', mean: 21.2, high: 26.9, low: 15.5 }, { month: 'Sep', mean: 16.6, high: 22.3, low: 10.9 }, { month: 'Oct', mean: 9.8, high: 15.4, low: 4.2 }, { month: 'Nov', mean: 4.3, high: 8.8, low: -0.3 }, { month: 'Dec', mean: -1.9, high: 2.1, low: -6 } ]; } } body { margin-bottom: 24px; } <template> <div class="container-fluid"> <wj-flex-chart :itemsSource="data" bindingX="month" chartType="Line" header="Temperature of New York" :palette="['rgba(42,159,214,1)', 'rgba(119,179,0,1)', 'rgba(153,51,204,1)', 'rgba(255,136,0,1)', 'rgba(204,0,0,1)', 'rgba(0,204,163,1)', 'rgba(61,109,204,1)', 'rgba(82,82,82,1)', 'rgba(0,0,0,1)']"> <wj-flex-chart-legend position="Bottom"></wj-flex-chart-legend> <wj-flex-chart-axis wjProperty="axisY" title="Temperature(°C)"></wj-flex-chart-axis> <wj-flex-chart-series binding="low" name="Average Low"></wj-flex-chart-series> <wj-flex-chart-series binding="high" name="Average High"></wj-flex-chart-series> <wj-flex-chart-series binding="mean" name="Daily Mean"></wj-flex-chart-series> <wj-flex-chart-animation animationMode="Point"></wj-flex-chart-animation> </wj-flex-chart> </div> </template> <script> import '@grapecity/wijmo.styles/wijmo.css'; import 'bootstrap.css'; import Vue from 'vue'; import '@grapecity/wijmo.vue2.chart'; import '@grapecity/wijmo.vue2.chart.animation'; import { getData } from './data'; // new Vue({ el: '#app', data: { data: getData() } }); </script> <style> body { margin-bottom: 24px; } </style> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexChart Basic Line Chart</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app.vue'); </script> </head> <body> <div id="app"></div> </body> </html> // The climate of New York // https://en.wikipedia.org/wiki/Climate_of_New_York export function getData() { return [ { month: 'Jan', mean: -5.2, high: -0.8, low: -9.7 }, { month: 'Feb', mean: -3.4, high: 1.4, low: -8.2 }, { month: 'Mar', mean: 1.7, high: 6.9, low: -3.5 }, { month: 'Apr', mean: 8.8, high: 14.6, low: 2.9 }, { month: 'May', mean: 14.6, high: 20.8, low: 8.4 }, { month: 'Jun', mean: 19.6, high: 25.5, low: 13.6 }, { month: 'Jul', mean: 22.1, high: 27.9, low: 16.3 }, { month: 'Aug', mean: 21.2, high: 26.9, low: 15.5 }, { month: 'Sep', mean: 16.6, high: 22.3, low: 10.9 }, { month: 'Oct', mean: 9.8, high: 15.4, low: 4.2 }, { month: 'Nov', mean: 4.3, high: 8.8, low: -0.3 }, { month: 'Dec', mean: -1.9, high: 2.1, low: -6 } ]; } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './app.css'; // import * as React from 'react'; import * as ReactDOM from 'react-dom'; // import * as wjChart from '@grapecity/wijmo.react.chart'; import * as wjChartAnimate from '@grapecity/wijmo.react.chart.animation'; import { getData } from './data'; // class App extends React.Component { constructor(props) { super(props); this.state = { data: getData(), palette: ['rgba(42,159,214,1)', 'rgba(119,179,0,1)', 'rgba(153,51,204,1)', 'rgba(255,136,0,1)', 'rgba(204,0,0,1)', 'rgba(0,204,163,1)', 'rgba(61,109,204,1)', 'rgba(82,82,82,1)', 'rgba(0,0,0,1)'] }; } ; render() { return <div className="container-fluid"> <wjChart.FlexChart itemsSource={this.state.data} bindingX="month" chartType="Line" header="Temperature of New York" palette={this.state.palette}> <wjChart.FlexChartLegend position="Bottom"></wjChart.FlexChartLegend> <wjChart.FlexChartAxis wjProperty="axisY" title="Temperature(°C)"></wjChart.FlexChartAxis> <wjChart.FlexChartSeries binding="low" name="Average Low"></wjChart.FlexChartSeries> <wjChart.FlexChartSeries binding="high" name="Average High"></wjChart.FlexChartSeries> <wjChart.FlexChartSeries binding="mean" name="Daily Mean"></wjChart.FlexChartSeries> <wjChartAnimate.FlexChartAnimation animationMode="Point"></wjChartAnimate.FlexChartAnimation> </wjChart.FlexChart> </div>; } } ReactDOM.render(<App />, document.getElementById('app')); <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>AutoComplete</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="systemjs.config.js"></script> <script> System.import('./src/app'); </script> </head> <body> <div id="app"></div> </body> </html> body { margin-bottom: 24px; } export function getData() { return [ { month: 'Jan', mean: -5.2, high: -0.8, low: -9.7 }, { month: 'Feb', mean: -3.4, high: 1.4, low: -8.2 }, { month: 'Mar', mean: 1.7, high: 6.9, low: -3.5 }, { month: 'Apr', mean: 8.8, high: 14.6, low: 2.9 }, { month: 'May', mean: 14.6, high: 20.8, low: 8.4 }, { month: 'Jun', mean: 19.6, high: 25.5, low: 13.6 }, { month: 'Jul', mean: 22.1, high: 27.9, low: 16.3 }, { month: 'Aug', mean: 21.2, high: 26.9, low: 15.5 }, { month: 'Sep', mean: 16.6, high: 22.3, low: 10.9 }, { month: 'Oct', mean: 9.8, high: 15.4, low: 4.2 }, { month: 'Nov', mean: 4.3, high: 8.8, low: -0.3 }, { month: 'Dec', mean: -1.9, high: 2.1, low: -6 } ]; }