フォーカススタイル

「wj-state-focused」擬似クラスを使用して、フォーカスを含むゲージに特殊効果を追加することができます。

このサンプルでは、ゲージにフォーカスがあるときにサムの外観をカスタマイズします。

import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; import * as gauge from '@grapecity/wijmo.gauge'; // document.readyState === 'complete' ? init() : window.onload = init; // function init() { // create the gauges let linear = new gauge.LinearGauge('#linear', { isReadOnly: false, hasShadow: false, thumbSize: 12, value: 50, face: { thickness: 0.25 }, pointer: { thickness: 0.25 } }); // let radial = new gauge.RadialGauge('#radial', { isReadOnly: false, hasShadow: false, showText: 'Value', thumbSize: 6, value: 50, face: { thickness: 0.05 }, pointer: { thickness: 0.05 } }); } <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Gauge Focus Styling</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="linear"></div> <div id="radial"></div> </div> </body> </html> .wj-gauge { width: 50%; margin: 20px auto; } .wj-gauge .wj-face path { fill: #fefefe; stroke: #e0e0e0; } .wj-gauge.wj-state-focused .wj-pointer { fill: red; } .wj-gauge.wj-state-focused circle.wj-pointer { stroke-width: 4px; stroke: red; } .wj-radialgauge { height: 120px; } import 'bootstrap.css'; import '@grapecity/wijmo.styles/wijmo.css'; import './styles.css'; // import { Component, enableProdMode, NgModule } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule } from '@angular/forms'; import { WjGaugeModule } from '@grapecity/wijmo.angular2.gauge'; // @Component({ selector: 'app-component', templateUrl: 'src/app.component.html' }) export class AppComponent { } // @NgModule({ imports: [WjGaugeModule, BrowserModule, FormsModule], 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 Focus Styling</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-linear-gauge [isReadOnly]="false" [hasShadow]="false" [thumbSize]="12" [value]="50"> <wj-range [wjProperty]="'face'" [thickness]="0.25"></wj-range> <wj-range [wjProperty]="'pointer'" [thickness]="0.25"></wj-range> </wj-linear-gauge> <wj-radial-gauge [isReadOnly]="false" [hasShadow]="false" [showText]="'Value'" [thumbSize]="6" [value]="50"> <wj-range [wjProperty]="'face'" [thickness]="0.05"></wj-range> <wj-range [wjProperty]="'pointer'" [thickness]="0.05"></wj-range> </wj-radial-gauge> </div> .wj-gauge { width: 50%; margin: 20px auto; } .wj-gauge .wj-face path { fill: #fefefe; stroke: #e0e0e0; } .wj-gauge.wj-state-focused .wj-pointer { fill: red; } .wj-gauge.wj-state-focused circle.wj-pointer { stroke-width: 4px; stroke: red; } .wj-radialgauge { height: 120px; } 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'; class App extends React.Component { render() { return (<div className="container-fluid"> <wjGauge.LinearGauge isReadOnly={false} hasShadow={false} thumbSize={12} value={50}> <wjGauge.Range wjProperty="face" thickness={0.25}></wjGauge.Range> <wjGauge.Range wjProperty="pointer" thickness={0.25}></wjGauge.Range> </wjGauge.LinearGauge> <wjGauge.RadialGauge isReadOnly={false} hasShadow={false} showText="Value" thumbSize={6} value={50}> <wjGauge.Range wjProperty="face" thickness={0.05}></wjGauge.Range> <wjGauge.Range wjProperty="pointer" thickness={0.05}></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>Gauge Focus Styling</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%; margin: 20px auto; } .container-fluid .wj-gauge .wj-face path { fill: #fefefe; stroke: #e0e0e0; } .container-fluid .wj-gauge.wj-state-focused .wj-pointer { fill: red; } .container-fluid .wj-gauge.wj-state-focused circle.wj-pointer { stroke-width: 4px; stroke: red; } .container-fluid .wj-radialgauge { height: 120px; } <template> <div class="container-fluid"> <wj-linear-gauge :isReadOnly=false :hasShadow=false :thumbSize=12 :value=50> <wj-range wjProperty="face" :thickness=0.25></wj-range> <wj-range wjProperty="pointer" :thickness=0.25></wj-range> </wj-linear-gauge> <wj-radial-gauge :isReadOnly=false :hasShadow=false showText="Value" :thumbSize=6 :value=50> <wj-range wjProperty="face" :thickness=0.05></wj-range> <wj-range wjProperty="pointer" :thickness=0.05></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' }) new Vue({ render: h => h(App) }).$mount('#app'); </script> <style> .container-fluid .wj-gauge { width: 50%; margin: 20px auto; } .container-fluid .wj-gauge .wj-face path { fill: #fefefe; stroke: #e0e0e0; } .container-fluid .wj-gauge.wj-state-focused .wj-pointer { fill: red; } .container-fluid .wj-gauge.wj-state-focused circle.wj-pointer { stroke-width: 4px; stroke: red; } .container-fluid .wj-radialgauge { height: 120px; } </style> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Gauge Focus Styling</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>