チャート:マーカー付きスプライン

サンプルは、マーカーとデータラベルを含むスプラインチャートを示しています。

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: 'ニューヨークの気候', legend: { position: chart.Position.Right }, chartType: chart.ChartType.SplineSymbols, dataLabel: { content: '{y}' }, tooltip: { content: '' }, bindingX: 'month', series: [ { binding: 'low', name: '平均最低気温' }, { binding: 'high', name: '平均最高気温' }, { binding: 'mean', name: '平均気温' } ], axisY: { title: '気温(℃)' }, itemsSource: getData(), palette: getRandomPalette() }); // let ani = new animation.ChartAnimation(linechart); ani.animationMode = animation.AnimationMode.Series; } // function getRandomPalette() { let palettes = Object.getOwnPropertyNames(chart.Palettes) .filter(prop => typeof chart.Palettes[prop] === "object" && prop !== 'prototype'); let rand = Math.floor(Math.random() * palettes.length); // return chart.Palettes[palettes[rand]]; } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexChart Spline with Symbols</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: '1月', mean: -5.2, high: -0.8, low: -9.7 }, { month: '2月', mean: -3.4, high: 1.4, low: -8.2 }, { month: '3月', mean: 1.7, high: 6.9, low: -3.5 }, { month: '4月', mean: 8.8, high: 14.6, low: 2.9 }, { month: '5月', mean: 14.6, high: 20.8, low: 8.4 }, { month: '6月', mean: 19.6, high: 25.5, low: 13.6 }, { month: '7月', mean: 22.1, high: 27.9, low: 16.3 }, { month: '8月', mean: 21.2, high: 26.9, low: 15.5 }, { month: '9月', mean: 16.6, high: 22.3, low: 10.9 }, { month: '10月', mean: 9.8, high: 15.4, low: 4.2 }, { month: '11月', mean: 4.3, high: 8.8, low: -0.3 }, { month: '12月', 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 * as chart from '@grapecity/wijmo.chart'; 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; palette: string[]; // constructor(@Inject(DataService) private dataService: DataService) { this.data = dataService.getData(); this.palette = this._getRandomPalette(); } // private _getRandomPalette() { let palettes = Object.getOwnPropertyNames(chart.Palettes) .filter(prop => typeof chart.Palettes[prop] === "object" && prop !== 'prototype'); let rand = Math.floor(Math.random() * palettes.length); // return chart.Palettes[palettes[rand]]; } } // @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 FlexChart Spline with Symbols</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" [header]="'ニューヨークの気候'" [tooltipContent]="''" [bindingX]="'month'" [chartType]="'SplineSymbols'" [palette]="palette"> <wj-flex-chart-legend [position]="'Right'"></wj-flex-chart-legend> <wj-flex-chart-data-label [content]="'{y}'"></wj-flex-chart-data-label> <wj-flex-chart-axis [wjProperty]="'axisY'" [title]="'気温(℃)'"></wj-flex-chart-axis> <wj-flex-chart-series [binding]="'low'" [name]="'平均最低気温'"></wj-flex-chart-series> <wj-flex-chart-series [binding]="'high'" [name]="'平均最高気温'"></wj-flex-chart-series> <wj-flex-chart-series [binding]="'mean'" [name]="'平均気温'"></wj-flex-chart-series> <wj-flex-chart-animation [animationMode]="'Series'"></wj-flex-chart-animation> </wj-flex-chart> </div> import { Injectable } from '@angular/core'; // @Injectable() export class DataService { getData() { return [ { month: '1月', mean: -5.2, high: -0.8, low: -9.7 }, { month: '2月', mean: -3.4, high: 1.4, low: -8.2 }, { month: '3月', mean: 1.7, high: 6.9, low: -3.5 }, { month: '4月', mean: 8.8, high: 14.6, low: 2.9 }, { month: '5月', mean: 14.6, high: 20.8, low: 8.4 }, { month: '6月', mean: 19.6, high: 25.5, low: 13.6 }, { month: '7月', mean: 22.1, high: 27.9, low: 16.3 }, { month: '8月', mean: 21.2, high: 26.9, low: 15.5 }, { month: '9月', mean: 16.6, high: 22.3, low: 10.9 }, { month: '10月', mean: 9.8, high: 15.4, low: 4.2 }, { month: '11月', mean: 4.3, high: 8.8, low: -0.3 }, { month: '12月', mean: -1.9, high: 2.1, low: -6 } ]; } } body { margin-bottom: 24px; } 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 wjCharts from '@grapecity/wijmo.chart'; import * as wjChartAnimate from '@grapecity/wijmo.react.chart.animation'; import { getData } from './data'; // class App extends React.Component { constructor(props) { super(props); this.initChart = (chart) => { chart.dataLabel.content = "{y}"; this.theChart = chart; }; this._getRandomPalette = () => { let palettes = Object.getOwnPropertyNames(wjCharts.Palettes) .filter(prop => typeof wjCharts.Palettes[prop] === "object" && prop !== 'prototype'); let rand = Math.floor(Math.random() * palettes.length); // return wjCharts.Palettes[palettes[rand]]; }; this.state = { data: getData(), palette: this._getRandomPalette() }; } render() { return <div className="container-fluid"> <wjChart.FlexChart header="ニューヨークの気候" tooltipContent="" bindingX="month" chartType="SplineSymbols" itemsSource={this.state.data} initialized={this.initChart} palette={this.state.palette}> <wjChart.FlexChartLegend position="Right"></wjChart.FlexChartLegend> <wjChart.FlexChartAxis wjProperty="axisY" title="気温(℃)"></wjChart.FlexChartAxis> <wjChart.FlexChartSeries binding="low" name="平均最低気温"></wjChart.FlexChartSeries> <wjChart.FlexChartSeries binding="high" name="平均最高気温"></wjChart.FlexChartSeries> <wjChart.FlexChartSeries binding="mean" name="平均気温"></wjChart.FlexChartSeries> <wjChartAnimate.FlexChartAnimation animationMode="Series"></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>GrapeCity Wijmo FlexChart Spline with Symbols</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: '1月', mean: -5.2, high: -0.8, low: -9.7 }, { month: '2月', mean: -3.4, high: 1.4, low: -8.2 }, { month: '3月', mean: 1.7, high: 6.9, low: -3.5 }, { month: '4月', mean: 8.8, high: 14.6, low: 2.9 }, { month: '5月', mean: 14.6, high: 20.8, low: 8.4 }, { month: '6月', mean: 19.6, high: 25.5, low: 13.6 }, { month: '7月', mean: 22.1, high: 27.9, low: 16.3 }, { month: '8月', mean: 21.2, high: 26.9, low: 15.5 }, { month: '9月', mean: 16.6, high: 22.3, low: 10.9 }, { month: '10月', mean: 9.8, high: 15.4, low: 4.2 }, { month: '11月', mean: 4.3, high: 8.8, low: -0.3 }, { month: '12月', mean: -1.9, high: 2.1, low: -6 } ]; } <template> <div class="container-fluid"> <wj-flex-chart :itemsSource="data" header="ニューヨークの気候" tooltipContent="" bindingX="month" chartType="SplineSymbols" :palette="palette"> <wj-flex-chart-legend position="Right"></wj-flex-chart-legend> <wj-flex-chart-data-label content="{y}"></wj-flex-chart-data-label> <wj-flex-chart-axis wjProperty="axisY" title="気温(℃)"></wj-flex-chart-axis> <wj-flex-chart-series binding="low" name="平均最低気温"></wj-flex-chart-series> <wj-flex-chart-series binding="high" name="平均最高気温"></wj-flex-chart-series> <wj-flex-chart-series binding="mean" name="平均気温"></wj-flex-chart-series> <wj-flex-chart-animation animationMode="Series"></wj-flex-chart-animation> </wj-flex-chart> </div> </template> <script> import '@grapecity/wijmo.styles/wijmo.css'; import 'bootstrap.css'; import Vue from 'vue'; import * as wjChart from '@grapecity/wijmo.chart'; import '@grapecity/wijmo.vue2.chart'; import '@grapecity/wijmo.vue2.chart.animation'; import { getData } from './data'; // new Vue({ el: '#app', data: { data: getData(), // Get random palette palette: (() => { let palettes = Object.getOwnPropertyNames(wjChart.Palettes) .filter(prop => typeof wjChart.Palettes[prop] === "object" && prop !== 'prototype'); let rand = Math.floor(Math.random() * palettes.length); // return wjChart.Palettes[palettes[rand]]; })() } }); </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 Spline with Symbols</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: '1月', mean: -5.2, high: -0.8, low: -9.7 }, { month: '2月', mean: -3.4, high: 1.4, low: -8.2 }, { month: '3月', mean: 1.7, high: 6.9, low: -3.5 }, { month: '4月', mean: 8.8, high: 14.6, low: 2.9 }, { month: '5月', mean: 14.6, high: 20.8, low: 8.4 }, { month: '6月', mean: 19.6, high: 25.5, low: 13.6 }, { month: '7月', mean: 22.1, high: 27.9, low: 16.3 }, { month: '8月', mean: 21.2, high: 26.9, low: 15.5 }, { month: '9月', mean: 16.6, high: 22.3, low: 10.9 }, { month: '10月', mean: 9.8, high: 15.4, low: 4.2 }, { month: '11月', mean: 4.3, high: 8.8, low: -0.3 }, { month: '12月', mean: -1.9, high: 2.1, low: -6 } ]; }