チャート:じょうごチャート

じょうごチャートは、プロセス内の複数の段階に沿って値を表示します。

たとえば、じょうごチャートを使用して、販売パイプラインの各段階で販売見込み客の数を表示することができます。じょうごチャートは棒チャートに似ていますが、通常、値は徐々に減少します。

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import * as chart from '@grapecity/wijmo.chart'; import * as input from '@grapecity/wijmo.input'; import { getData } from './data'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { // create the chart let theChart = new chart.FlexChart('#theChart', { itemsSource: getData(), bindingX: 'stage', chartType: 'Funnel', options: { funnel: { neckWidth: .2, neckHeight: .4, type: 'rectangle' } }, series: [ { binding: 'count', name: '売上パイプライン' } ], dataLabel: { content: '{item.count}' }, palette: getRandomPalette() }); // // adjust parameters let theNeckWidth = new input.InputNumber('#neckWidth', { min: 0, max: 1, step: .1, format: 'p0', value: theChart.options.funnel.neckWidth, valueChanged: (s) => { theChart.options.funnel.neckWidth = s.value; theChart.refresh(true); } }); // let theNeckHeight = new input.InputNumber('#neckHeight', { min: 0, max: 1, step: .1, format: 'p0', value: theChart.options.funnel.neckHeight, valueChanged: (s) => { theChart.options.funnel.neckHeight = s.value; theChart.refresh(true); } }); // let theNeckStyle = new input.ComboBox('#neckStyle', { textChanged: (s) => { theChart.options.funnel.type = 'default,rectangle'.split(',')[s.selectedIndex]; theChart.refresh(true); }, itemsSource: ['デフォルト', '長方形'] }); } // 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 Funnel 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 class="form-group"> <label for="neckWidth">ネックの幅: </label> <div id="neckWidth"></div> </div> <div class="form-group"> <label for="neckHeight">ネックの高さ: </label> <div id="neckHeight"></div> </div> <div class="form-group"> <label for="neckStyle">ネックスタイル: </label> <div id="neckStyle"></div> </div> <div id="theChart"></div> </div> </body> </html> // create some random data export function getData() { return [ { stage: '潜在顧客', count: 750 }, { stage: '見込みあり', count: 520 }, { stage: '要分析', count: 200 }, { stage: '見積もり', count: 150 }, { stage: '商談', count: 100 }, { stage: '契約', count: 90 }, ]; } .wj-flexchart { height: 300px; } label { width: 150px; text-align: right; } body { margin-bottom: 24pt; } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import * as wjInput from '@grapecity/wijmo.input'; import * as wjChart from '@grapecity/wijmo.chart'; // import { Component, Inject, enableProdMode, AfterViewInit, ViewChild, NgModule } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserModule } from '@angular/platform-browser'; import { WjInputModule } from '@grapecity/wijmo.angular2.input'; import { WjChartModule } from '@grapecity/wijmo.angular2.chart'; import { DataService } from './app.data'; // @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent implements AfterViewInit { data: any[]; palette: any; // references control in the view @ViewChild('theChart') theChart: wjChart.FlexChart; // constructor(@Inject(DataService) private dataService: DataService) { this.data = dataService.getData(); this.palette = this._getRandomPalette(); } // ngAfterViewInit() { this.theChart.options = { funnel: { neckWidth: 0.2, neckHeight: 0.4, type: 'default' } }; } // widthChanged(input: wjInput.InputNumber) { this.theChart.options.funnel.neckWidth = input.value; this.theChart.refresh(); } // heightChanged(input: wjInput.InputNumber) { this.theChart.options.funnel.neckHeight = input.value; this.theChart.refresh(); } // textChanged(combo: wjInput.ComboBox) { this.theChart.options.funnel.type = 'default,rectangle'.split(',')[combo.selectedIndex]; this.theChart.refresh(); } // private _getRandomPalette() { 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]]; } } // @NgModule({ imports: [WjInputModule, WjChartModule, 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 Funnel 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"> <div class="form-group"> <label for="neckWidth">ネックの幅: </label> <wj-input-number #nw [min]="0" [max]="1" [step]="0.1" format="p0" [value]="0.2" (valueChanged)="widthChanged(nw)"></wj-input-number> </div> <div class="form-group"> <label for="neckHeight">ネックの高さ: </label> <wj-input-number #nh [min]="0" [max]="1" [step]="0.1" format="p0" [value]="0.4" (valueChanged)="heightChanged(nh)"></wj-input-number> </div> <div class="form-group"> <label for="neckStyle">ネックスタイル: </label> <wj-combo-box #cb (textChanged)="textChanged(cb)" [itemsSource]="['デフォルト', '長方形']"></wj-combo-box> </div> <wj-flex-chart #theChart [itemsSource]="data" bindingX="stage" chartType="Funnel" labelContent="{item.count}" [palette]="palette"> <wj-flex-chart-series binding="count" name="売上パイプライン"></wj-flex-chart-series> </wj-flex-chart> </div> import { Injectable } from '@angular/core'; // @Injectable() export class DataService { getData() { return [ { stage: '潜在顧客', count: 750 }, { stage: '見込みあり', count: 520 }, { stage: '要分析', count: 200 }, { stage: '見積もり', count: 150 }, { stage: '商談', count: 100 }, { stage: '契約', count: 90 }, ]; } } .wj-flexchart { height: 300px; } label { width: 100px; text-align: right; margin-right: 3px; } body { margin-bottom: 24pt; } 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 chart from '@grapecity/wijmo.chart'; import * as wjInput from '@grapecity/wijmo.react.input'; import * as wjChart from '@grapecity/wijmo.react.chart'; import { getData } from './data'; class App extends React.Component { constructor(props) { super(props); this.chartInitialized = (sender) => { sender.dataLabel.content = "{item.count}"; this.theChart = sender; // this.theChart.options = { funnel: { neckWidth: 0.2, neckHeight: 0.4, type: 'default' } }; }; this.widthChanged = (sender) => { this.theChart.options.funnel.neckWidth = sender.value; this.theChart.refresh(); }; this.heightChanged = (sender) => { this.theChart.options.funnel.neckHeight = sender.value; this.theChart.refresh(); }; this.textChanged = (sender) => { this.theChart.options.funnel.type = 'default,rectangle'.split(',')[sender.selectedIndex]; this.theChart.refresh(); }; this.state = { data: getData(), itemsSource: ['デフォルト', '長方形'], palette: (() => { // Get random palette 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]]; })() }; } render() { return <div className="container-fluid"> <div className="form-group"> <label htmlFor="neckWidth">ネックの幅: </label> <wjInput.InputNumber min={0} max={1} step={0.1} format="p0" value={0.2} valueChanged={this.widthChanged}> </wjInput.InputNumber> </div> <div className="form-group"> <label htmlFor="neckHeight">ネックの高さ: </label> <wjInput.InputNumber min={0} max={1} step={0.1} format="p0" value={0.4} valueChanged={this.heightChanged}> </wjInput.InputNumber> </div> <div className="form-group"> <label htmlFor="neckStyle">ネックスタイル: </label> <wjInput.ComboBox itemsSource={this.state.itemsSource} textChanged={this.textChanged}> </wjInput.ComboBox> </div> <wjChart.FlexChart bindingX="stage" itemsSource={this.state.data} palette={this.state.palette} chartType="Funnel" initialized={this.chartInitialized}> <wjChart.FlexChartSeries binding="count" name="売上パイプライン"> </wjChart.FlexChartSeries> </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 Funnel 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 id="app"></div> </body> </html> .wj-flexchart { height: 300px; } label { width: 150px; text-align: right; margin-right: 3px; } body { margin-bottom: 24pt; } export function getData() { return [ { stage: '潜在顧客', count: 750 }, { stage: '見込みあり', count: 520 }, { stage: '要分析', count: 200 }, { stage: '見積もり', count: 150 }, { stage: '商談', count: 100 }, { stage: '契約', count: 90 } ]; } <template> <div class="container-fluid"> <div class="form-group"> <label for="neckWidth">ネックの幅: </label> <wj-input-number :min=0 :max=1 :step=0.1 format="p0" :value=0.2 :valueChanged="widthChanged"></wj-input-number> </div> <div class="form-group"> <label for="neckHeight">ネックの高さ: </label> <wj-input-number :min=0 :max=1 :step=0.1 format="p0" :value=0.4 :valueChanged="heightChanged"></wj-input-number> </div> <div class="form-group"> <label for="neckStyle">ネックスタイル: </label> <wj-combo-box :textChanged="textChanged" :itemsSource="['デフォルト', '長方形']"></wj-combo-box> </div> <wj-flex-chart :itemsSource="data" bindingX="stage" chartType="Funnel" labelContent="{item.count}" :palette="palette" :initialized="chartInitialized"> <wj-flex-chart-series binding="count" name="売上パイプライン"></wj-flex-chart-series> </wj-flex-chart> </div> </template> <script> import '@grapecity/wijmo.styles/wijmo.css'; import 'bootstrap.css'; import Vue from 'vue'; import * as chart from '@grapecity/wijmo.chart'; import '@grapecity/wijmo.vue2.input'; import '@grapecity/wijmo.vue2.chart'; import { getData } from './data'; // new Vue({ el: '#app', data: { data: getData(), palette: (() => { // Get random palette 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]]; })() }, methods: { chartInitialized(sender) { this.theChart = sender; // this.theChart.options = { funnel: { neckWidth: 0.2, neckHeight: 0.4, type: 'default' } }; }, widthChanged(sender) { this.theChart.options.funnel.neckWidth = sender.value; this.theChart.refresh(); }, heightChanged(sender) { this.theChart.options.funnel.neckHeight = sender.value; this.theChart.refresh(); }, textChanged(sender) { this.theChart.options.funnel.type = 'default,rectangle'.split(',')[sender.selectedIndex]; this.theChart.refresh(); } } }); </script> <style> .container-fluid .wj-flexchart { height: 300px; } label { width: 150px; text-align: right; } body { margin-bottom: 24pt; } </style> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo FlexChart Funnel 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> // create some random data export function getData() { return [ { stage: '潜在顧客', count: 750 }, { stage: '見込みあり', count: 520 }, { stage: '要分析', count: 200 }, { stage: '見積もり', count: 150 }, { stage: '商談', count: 100 }, { stage: '契約', count: 90 } ]; }