ゲージ:ゲージ要素

すべてのWijmoゲージは、コントロールテンプレートで定義されている、フェイス、ポインタ、範囲、サム、目盛り、テキストの要素で構成されています。

ゲージの上にマウスを移動すると、各要素が強調表示されます。

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; import * as wjGauge from '@grapecity/wijmo.gauge'; import * as wjCore from '@grapecity/wijmo'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { // create the gauge let radial = new wjGauge.RadialGauge('#radial', { isReadOnly: false, hasShadow: false, showText: 'All', startAngle: -30, sweepAngle: 240, value: 50, showRanges: true, showTicks: true, tickSpacing: 10, ranges: [ { min: 0, max: 30, color: 'red', thickness: .5 }, { min: 30, max: 50, color: 'orange', thickness: .5 }, { min: 50, max: 70, color: 'gold', thickness: .5 }, { min: 70, max: 100, color: 'green', thickness: .5 } ], pointer: { thickness: .15 }, thumbSize: 20 }); // // add some tooltips let tt = new wjCore.Tooltip(), host = radial.hostElement; // tt.setTooltip(host.querySelector('.wj-face'), 'フェイス'); tt.setTooltip(host.querySelector('.wj-pointer'), 'ポインタ'); tt.setTooltip(host.querySelector('.wj-thumb'), 'サム'); tt.setTooltip(host.querySelector('.wj-ranges'), '範囲'); tt.setTooltip(host.querySelector('.wj-ticks'), '目盛り'); tt.setTooltip(host.querySelector('.wj-value'), 'テキスト: 値'); tt.setTooltip(host.querySelector('.wj-min'), 'テキスト: 最小値'); tt.setTooltip(host.querySelector('.wj-max'), 'テキスト: 最大値'); } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Gauge Elements</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="radial"></div> </div> </body> </html> .wj-gauge { width: 50%; height: 150px; margin: 20px auto; padding: 12px; background: rgba(0, 0, 0, .02); box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); } .wj-gauge .wj-pointer { fill: black; } .wj-gauge .wj-face, .wj-gauge .wj-pointer, .wj-gauge .wj-thumb, .wj-gauge .wj-ranges, .wj-gauge .wj-ticks, .wj-gauge .wj-value, .wj-gauge .wj-min, .wj-gauge .wj-max { opacity: .25; } .wj-gauge .wj-face:hover, .wj-gauge .wj-pointer:hover, .wj-gauge .wj-thumb:hover, .wj-gauge .wj-ranges:hover, .wj-gauge .wj-ticks:hover, .wj-gauge .wj-value:hover, .wj-gauge .wj-min:hover, .wj-gauge .wj-max:hover { opacity: 1; } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import * as wijmo from '@grapecity/wijmo'; import * as gauge from '@grapecity/wijmo.gauge'; // import { Component, enableProdMode, 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 { WjGaugeModule } from '@grapecity/wijmo.angular2.gauge'; // @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { setTooltips(g: gauge.RadialGauge) { // add some tooltips let tt = new wijmo.Tooltip(), host = g.hostElement; tt.showAtMouse = true; tt.setTooltip(host.querySelector('.wj-face'), 'フェイス'); tt.setTooltip(host.querySelector('.wj-pointer'), 'ポインタ'); tt.setTooltip(host.querySelector('.wj-thumb'), 'サム'); tt.setTooltip(host.querySelector('.wj-ranges'), '範囲'); tt.setTooltip(host.querySelector('.wj-ticks'), '目盛り'); tt.setTooltip(host.querySelector('.wj-value'), 'テキスト: 値'); tt.setTooltip(host.querySelector('.wj-min'), 'テキスト: 最小値'); tt.setTooltip(host.querySelector('.wj-max'), 'テキスト: 最大値'); } } // @NgModule({ imports: [WjGaugeModule, WjInputModule, BrowserModule], declarations: [AppComponent], 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>Gauge Elements</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-radial-gauge #radial [isReadOnly]="false" [hasShadow]="false" [showText]="'All'" [startAngle]="-30" [sweepAngle]="240" [value]="50" [showRanges]="true" [showTicks]="true" [tickSpacing]="10" [thumbSize]="20" (initialized)="setTooltips(radial)"> <wj-range [wjProperty]="'pointer'" [thickness]="0.15"></wj-range> <wj-range [min]="0" [max]="30" [color]="'red'" [thickness]="0.5"></wj-range> <wj-range [min]="30" [max]="50" [color]="'orange'" [thickness]="0.5"></wj-range> <wj-range [min]="50" [max]="70" [color]="'gold'" [thickness]="0.5"></wj-range> <wj-range [min]="70" [max]="100" [color]="'green'" [thickness]="0.5"></wj-range> </wj-radial-gauge> </div> .wj-gauge { width: 50%; height: 150px; margin: 20px auto; padding: 12px; background: rgba(0, 0, 0, .02); box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); } .wj-gauge .wj-pointer { fill: black; } .wj-gauge .wj-face, .wj-gauge .wj-pointer, .wj-gauge .wj-thumb, .wj-gauge .wj-ranges, .wj-gauge .wj-ticks, .wj-gauge .wj-value, .wj-gauge .wj-min, .wj-gauge .wj-max { opacity: .25; } .wj-gauge .wj-face:hover, .wj-gauge .wj-pointer:hover, .wj-gauge .wj-thumb:hover, .wj-gauge .wj-ranges:hover, .wj-gauge .wj-ticks:hover, .wj-gauge .wj-value:hover, .wj-gauge .wj-min:hover, .wj-gauge .wj-max:hover { opacity: 1; } import './app.css'; import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; // import * as React from 'react'; import * as ReactDOM from 'react-dom'; // import * as wjGauge from '@grapecity/wijmo.react.gauge'; import * as wijmo from '@grapecity/wijmo'; class App extends React.Component { render() { return <div className="container-fluid"> <wjGauge.RadialGauge isReadOnly={false} hasShadow={false} showText="All" startAngle={-30} sweepAngle={240} value={50} showRanges={true} showTicks={true} tickSpacing={10} thumbSize={20} initialized={this.setTooltips}> <wjGauge.Range wjProperty="pointer" thickness={0.15}></wjGauge.Range> <wjGauge.Range min={0} max={30} color="red" thickness={0.5}></wjGauge.Range> <wjGauge.Range min={30} max={50} color="orange" thickness={0.5}></wjGauge.Range> <wjGauge.Range min={50} max={70} color="gold" thickness={0.5}></wjGauge.Range> <wjGauge.Range min={70} max={100} color="green" thickness={0.5}></wjGauge.Range> </wjGauge.RadialGauge> </div>; } setTooltips(s) { // add some tooltips let tt = new wijmo.Tooltip(), host = s.hostElement; // tt.setTooltip(host.querySelector('.wj-face'), 'フェイス'); tt.setTooltip(host.querySelector('.wj-pointer'), 'ポインタ'); tt.setTooltip(host.querySelector('.wj-thumb'), 'サム'); tt.setTooltip(host.querySelector('.wj-ranges'), '範囲'); tt.setTooltip(host.querySelector('.wj-ticks'), '目盛り'); tt.setTooltip(host.querySelector('.wj-value'), 'テキスト: 値'); tt.setTooltip(host.querySelector('.wj-min'), 'テキスト: 最小値'); tt.setTooltip(host.querySelector('.wj-max'), 'テキスト: 最大値'); } } 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>Gauge Elements</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> .container-fluid .wj-gauge { width: 50%; height: 150px; margin: 20px auto; padding: 12px; background: rgba(0, 0, 0, .02); box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23); } .container-fluid .wj-gauge .wj-pointer { fill: black; } .container-fluid .wj-gauge .wj-face, .container-fluid .wj-gauge .wj-pointer, .container-fluid .wj-gauge .wj-thumb, .container-fluid .wj-gauge .wj-ranges, .container-fluid .wj-gauge .wj-ticks, .container-fluid .wj-gauge .wj-value, .container-fluid .wj-gauge .wj-min, .container-fluid .wj-gauge .wj-max { opacity: .25; } .container-fluid .wj-gauge .wj-face:hover, .container-fluid .wj-gauge .wj-pointer:hover, .container-fluid .wj-gauge .wj-thumb:hover, .container-fluid .wj-gauge .wj-ranges:hover, .container-fluid .wj-gauge .wj-ticks:hover, .container-fluid .wj-gauge .wj-value:hover, .container-fluid .wj-gauge .wj-min:hover, .container-fluid .wj-gauge .wj-max:hover { opacity: 1; } <template> <div class="container-fluid"> <wj-radial-gauge :isReadOnly=false :hasShadow=false showText="All" :startAngle=-30 :sweepAngle=240 :value=50 :showRanges=true :showTicks=true :tickSpacing=10 :thumbSize=20 :initialized="setTooltips"> <wj-range wjProperty="pointer" :thickness=0.15></wj-range> <wj-range :min=0 :max=30 color="red" :thickness=0.5></wj-range> <wj-range :min=30 :max=50 color="orange" :thickness=0.5></wj-range> <wj-range :min=50 :max=70 color="gold" :thickness=0.5></wj-range> <wj-range :min=70 :max=100 color="green" :thickness=0.5></wj-range> </wj-radial-gauge> </div> </template> <script> import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import 'src/app.css'; import Vue from 'vue'; import '@grapecity/wijmo.vue2.gauge'; let App = Vue.extend({ name: 'app', methods: { setTooltips: function(s,e) { // add some tooltips let tt = new wijmo.Tooltip(), host = s.hostElement; // tt.setTooltip(host.querySelector('.wj-face'), 'フェイス'); tt.setTooltip(host.querySelector('.wj-pointer'), 'ポインタ'); tt.setTooltip(host.querySelector('.wj-thumb'), 'サム'); tt.setTooltip(host.querySelector('.wj-ranges'), '範囲'); tt.setTooltip(host.querySelector('.wj-ticks'), '目盛り'); tt.setTooltip(host.querySelector('.wj-value'), 'テキスト: 値'); tt.setTooltip(host.querySelector('.wj-min'), 'テキスト: 最小値'); tt.setTooltip(host.querySelector('.wj-max'), 'テキスト: 最大値'); } } }) new Vue({ render: h => h(App) }).$mount('#app'); </script> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Gauge Elements</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>