タブパネル:Wijmoコントロールのホスト

TabPanelはタブ内でWijmoコントロールをホストできます。タブを切り替えると、TabPanelはタブでホストされているコントロールを自動的に更新します。

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; import * as wjNav from '@grapecity/wijmo.nav'; import * as wjGrid from '@grapecity/wijmo.grid'; import * as wjChart from '@grapecity/wijmo.chart'; import * as wjGauge from '@grapecity/wijmo.gauge'; import { getData } from './data'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { var theTabPanel = new wjNav.TabPanel('#theTabPanel'); // var theGrid = new wjGrid.FlexGrid('#theGrid', { autoGenerateColumns: false, columns: [ { binding: 'country', header: '国' }, { binding: 'downloads', header: 'DL数', width: 80 }, { binding: 'sales', header: '売上', width: 80 }, { binding: 'expenses', header: '費用', width: 80 }, ], itemsSource: getData() }); // var theChart = new wjChart.FlexChart('#theChart', { itemsSource: getData(), bindingX: 'country', series: [ { binding: 'sales', name: '売上' }, { binding: 'expenses', name: '費用' }, { binding: 'downloads', name: 'DL数' } ] }); // var theRadialGauge = new wjGauge.RadialGauge('#theRadialGauge', { min: 0, max: 100, value: 75, isReadOnly: false }); // var theLinearGauge = new wjGauge.LinearGauge('#theLinearGauge', { min: 0, max: 100, value: 75, isReadOnly: false }); } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>GrapeCity Wijmo TabPanel Hosting GC Controls</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="theTabPanel"> <div> <a>FlexGrid</a> <div> <div id="theGrid"></div> </div> </div> <div> <a>FlexChart</a> <div> <div id="theChart"></div> </div> </div> <div> <a>Gauges</a> <div> <div id="theRadialGauge"></div> <div id="theLinearGauge"></div> </div> </div> </div> </div> </body> </html> export function getData() { var countries = 'アメリカ,ドイツ,イギリス,日本,イタリア,ギリシャ'.split(','), data = []; for (var i = 0; i < countries.length; i++) { data.push({ country: countries[i], sales: Math.random() * 10000, expenses: Math.random() * 5000, downloads: Math.round(Math.random() * 20000), }); } return data; } .wj-tabpane { padding: 12px; } .wj-tabpanel .wj-gauge { width: 300px; margin: auto auto; } 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 { WjNavModule } from '@grapecity/wijmo.angular2.nav'; import { WjGridModule } from '@grapecity/wijmo.angular2.grid'; import { WjChartModule } from '@grapecity/wijmo.angular2.chart'; import { WjGaugeModule } from '@grapecity/wijmo.angular2.gauge'; 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: [WjNavModule, WjGridModule, WjChartModule, WjGaugeModule, 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 TabPanel Hosting GCControls</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-tab-panel> <wj-tab> <a>FlexGrid</a> <div> <wj-flex-grid [itemsSource]="data"> <wj-flex-grid-column binding="country" header="国"></wj-flex-grid-column> <wj-flex-grid-column binding="downloads" header="DL数" [width]="80"></wj-flex-grid-column> <wj-flex-grid-column binding="sales" header="売上" [width]="80"></wj-flex-grid-column> <wj-flex-grid-column binding="expenses" header="費用" [width]="80"></wj-flex-grid-column> </wj-flex-grid> </div> </wj-tab> <wj-tab> <a>FlexChart</a> <div> <wj-flex-chart [itemsSource]="data" [bindingX]="'country'"> <wj-flex-chart-series [name]="'売上'" [binding]="'sales'"></wj-flex-chart-series> <wj-flex-chart-series [name]="'費用'" [binding]="'expenses'"></wj-flex-chart-series> <wj-flex-chart-series [name]="'DL数'" [binding]="'downloads'"></wj-flex-chart-series> </wj-flex-chart> </div> </wj-tab> <wj-tab> <a>Gauges</a> <div style="overflow:hidden"> <wj-radial-gauge style="display:block" [value]="75" [min]="0" [isReadOnly]="false" [max]="100"> </wj-radial-gauge> <wj-linear-gauge style="display:block" [value]="75" [min]="0" [isReadOnly]="false" [max]="100"> </wj-linear-gauge> </div> </wj-tab> </wj-tab-panel> </div> import { Injectable } from '@angular/core'; @Injectable() export class DataService { getData() { var countries = 'アメリカ,ドイツ,イギリス,日本,イタリア,ギリシャ'.split(','), data = []; for (var i = 0; i < countries.length; i++) { data.push({ country: countries[i], sales: Math.random() * 10000, expenses: Math.random() * 5000, downloads: Math.round(Math.random() * 20000), }); } return data; } } .wj-tabpane { padding: 12px; } .wj-tabpanel .wj-gauge { width: 300px; margin: auto auto; }