概览

每个Wijmo仪表由控制模板中定义的以下元素组成:

  • Face:“面部”是表示仪表背景的范围。面范围的“min”和“max”属性对应于仪表控件的“min”和“max”属性,并限制仪表可以显示的值。
  • Pointer:“指针”是指示仪表当前值的范围。指针范围的“max”属性对应于仪表的“value”属性。
  • Ranges:除了“面部”和“指针”范围之外,仪表可能还包含显示测量范围内区域的其他范围(如“坏”,“平均”和“良好”)。根据“showRanges”属性的设置,这些附加范围可能始终显示,或用于根据当前仪表值确定“指针”的颜色。
  • Thumb:Thumb是一个圆圈,显示在“指针”范围的末尾。使用'thumbSize'属性设置thumb元素的大小。
  • Tickmarks:可以在脸部显示标记以帮助用户阅读标尺。它们的可见性和位置由'showTicks','tickSpacing'和'step'属性控制。
  • Text Values:仪表可以将“min”,“max”和“value”属性的值显示为文本。使用'showText'属性确定应显示哪些值。使用'getText'属性自定义仪表上显示的文本。

将鼠标移到量表上以突出显示每个元素:

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'), 'Face'); tt.setTooltip(host.querySelector('.wj-pointer'), 'Pointer'); tt.setTooltip(host.querySelector('.wj-thumb'), 'Thumb'); tt.setTooltip(host.querySelector('.wj-ranges'), 'Ranges'); tt.setTooltip(host.querySelector('.wj-ticks'), 'Tickmarks'); tt.setTooltip(host.querySelector('.wj-value'), 'Text: Value'); tt.setTooltip(host.querySelector('.wj-min'), 'Text: Min'); tt.setTooltip(host.querySelector('.wj-max'), 'Text: 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.setTooltip(host.querySelector('.wj-face'), 'Face'); tt.setTooltip(host.querySelector('.wj-pointer'), 'Pointer'); tt.setTooltip(host.querySelector('.wj-thumb'), 'Thumb'); tt.setTooltip(host.querySelector('.wj-ranges'), 'Ranges'); tt.setTooltip(host.querySelector('.wj-ticks'), 'Tickmarks'); tt.setTooltip(host.querySelector('.wj-value'), 'Text: Value'); tt.setTooltip(host.querySelector('.wj-min'), 'Text: Min'); tt.setTooltip(host.querySelector('.wj-max'), 'Text: 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; } <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 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'), 'Face'); tt.setTooltip(host.querySelector('.wj-pointer'), 'Pointer'); tt.setTooltip(host.querySelector('.wj-thumb'), 'Thumb'); tt.setTooltip(host.querySelector('.wj-ranges'), 'Ranges'); tt.setTooltip(host.querySelector('.wj-ticks'), 'Tickmarks'); tt.setTooltip(host.querySelector('.wj-value'), 'Text: Value'); tt.setTooltip(host.querySelector('.wj-min'), 'Text: Min'); tt.setTooltip(host.querySelector('.wj-max'), 'Text: Max'); } } }) new Vue({ render: h => h(App) }).$mount('#app'); </script> <style> .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; } </style> <!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> 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 { constructor(props) { super(props); } setTooltips(s) { // add some tooltips let tt = new wijmo.Tooltip(), host = s.hostElement; // tt.setTooltip(host.querySelector('.wj-face'), 'Face'); tt.setTooltip(host.querySelector('.wj-pointer'), 'Pointer'); tt.setTooltip(host.querySelector('.wj-thumb'), 'Thumb'); tt.setTooltip(host.querySelector('.wj-ranges'), 'Ranges'); tt.setTooltip(host.querySelector('.wj-ticks'), 'Tickmarks'); tt.setTooltip(host.querySelector('.wj-value'), 'Text: Value'); tt.setTooltip(host.querySelector('.wj-min'), 'Text: Min'); tt.setTooltip(host.querySelector('.wj-max'), 'Text: Max'); } 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="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>); } } 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> .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; }