Angular 선형 계기 개요
Ignite UI for Angular 선형 게이지 구성 요소를 사용하면 선형 게이지 형태로 데이터를 시각화할 수 있습니다. IgxLinearGaugeComponent
는 값과 스케일 및 하나 이상의 범위를 비교한 간단하고 간결한 뷰를 제공합니다. 하나의 스케일, 하나의 눈금 표시 세트 및 하나의 레이블 세트를 지원합니다. 이 구성 요소에는 애니메이션 전환에 대한 기본 제공 지원도 있습니다. 이 애니메이션은 transitionDuration
속성을 설정하여 쉽게 사용자 정의할 수 있습니다. 선형 게이지 구성 요소의 기능에는 구성 가능한 방향 및 방향, 바늘과 같은 구성 가능한 시각적 요소 등이 있습니다.
Angular 선형 계기 예
다음 샘플은 동일한 IgxLinearGaugeComponent
에 여러 속성을 설정하여 이를 완전히 다른 선형 게이지로 변환하는 방법을 보여줍니다.
import { NgModule } from "@angular/core" ;
import { FormsModule } from "@angular/forms" ;
import { CommonModule } from "@angular/common" ;
import { BrowserModule } from "@angular/platform-browser" ;
import { BrowserAnimationsModule } from "@angular/platform-browser/animations" ;
import { AppComponent } from "./app.component" ;
import { IgxLinearGaugeModule } from "igniteui-angular-gauges" ;
import { IgxButtonModule } from "igniteui-angular" ;
@NgModule ({
bootstrap : [AppComponent],
declarations : [
AppComponent,
],
imports : [
BrowserModule,
BrowserAnimationsModule,
CommonModule,
FormsModule,
IgxLinearGaugeModule,
IgxButtonModule
],
providers : [],
schemas : []
})
export class AppModule {}
ts コピー import { AfterViewInit, Component, ViewChild } from "@angular/core" ;
import { IgxLinearGaugeComponent } from "igniteui-angular-gauges" ;
import { IgxLinearGraphRangeComponent } from "igniteui-angular-gauges" ;
import { LinearGraphNeedleShape } from "igniteui-angular-gauges" ;
@Component ({
standalone : false ,
selector : "app-root" ,
styleUrls : ["./app.component.scss" ],
templateUrl : "./app.component.html"
})
export class AppComponent implements AfterViewInit {
@ViewChild ("linearGauge" , { static : true })
public linearGauge: IgxLinearGaugeComponent;
private shouldAnimate: boolean = false ;
public ngAfterViewInit(): void {
this .AnimateToGauge3();
}
public AnimateToGauge3(): void {
if (this .shouldAnimate){
this .linearGauge.transitionDuration = 500 ;
}
this .linearGauge.minimumValue = 0 ;
this .linearGauge.maximumValue = 100 ;
this .linearGauge.value = 50 ;
this .linearGauge.interval = 10 ;
this .linearGauge.labelInterval = 10 ;
this .linearGauge.labelExtent = 0.05 ;
this .linearGauge.isNeedleDraggingEnabled = true ;
this .linearGauge.needleShape = LinearGraphNeedleShape.Needle;
this .linearGauge.needleBrush = "#79797a" ;
this .linearGauge.needleOutline = "#ffffffff" ;
this .linearGauge.needleStrokeThickness = 1 ;
this .linearGauge.needleOuterExtent = 0.9 ;
this .linearGauge.needleInnerExtent = 0.3 ;
this .linearGauge.minorTickCount = 5 ;
this .linearGauge.minorTickEndExtent = 0.10 ;
this .linearGauge.minorTickStartExtent = 0.20 ;
this .linearGauge.minorTickStrokeThickness = 1 ;
this .linearGauge.tickStartExtent = 0.25 ;
this .linearGauge.tickEndExtent = 0.05 ;
this .linearGauge.tickStrokeThickness = 2 ;
const range1 = new IgxLinearGraphRangeComponent();
range1.startValue = 0 ;
range1.endValue = 30 ;
const range2 = new IgxLinearGraphRangeComponent();
range2.startValue = 30 ;
range2.endValue = 70 ;
const range3 = new IgxLinearGraphRangeComponent();
range3.startValue = 70 ;
range3.endValue = 100 ;
this .linearGauge.rangeBrushes = [ "#9FB328" , "#438C47" , "#3F51B5" ];
this .linearGauge.rangeOutlines = [ "#9FB328" , "#438C47" , "#3F51B5" ];
this .linearGauge.ranges.clear();
this .linearGauge.ranges.add(range1);
this .linearGauge.ranges.add(range2);
this .linearGauge.ranges.add(range3);
for (let i = 0 ; i < this .linearGauge.ranges.count; i++) {
const range = this .linearGauge.ranges.item(i);
range.innerStartExtent = 0.075 ;
range.innerEndExtent = 0.075 ;
range.outerStartExtent = 0.65 ;
range.outerEndExtent = 0.65 ;
}
this .linearGauge.scaleStrokeThickness = 0 ;
this .linearGauge.scaleBrush = "#ffffff" ;
this .linearGauge.scaleOutline = "#dbdbdb" ;
this .linearGauge.scaleInnerExtent = 0.075 ;
this .linearGauge.scaleOuterExtent = 0.85 ;
this .linearGauge.scaleStartExtent = 0.05 ;
this .linearGauge.scaleEndExtent = 0.95 ;
this .linearGauge.backingBrush = "#ffffff" ;
this .linearGauge.backingOutline = "#d1d1d1" ;
this .linearGauge.backingStrokeThickness = 0 ;
this .shouldAnimate = true ;
}
public AnimateToGauge2(): void {
if (this .shouldAnimate) {
this .linearGauge.transitionDuration = 500 ;
}
this .linearGauge.minimumValue = 100 ;
this .linearGauge.maximumValue = 200 ;
this .linearGauge.value = 150 ;
this .linearGauge.interval = 20 ;
this .linearGauge.labelInterval = 20 ;
this .linearGauge.labelExtent = 0.05 ;
this .linearGauge.isNeedleDraggingEnabled = true ;
this .linearGauge.needleShape = LinearGraphNeedleShape.Triangle;
this .linearGauge.needleBrush = "#79797a" ;
this .linearGauge.needleOutline = "#ffffffff" ;
this .linearGauge.needleStrokeThickness = 1 ;
this .linearGauge.needleOuterExtent = 0.9 ;
this .linearGauge.needleInnerExtent = 0.3 ;
this .linearGauge.minorTickCount = 4 ;
this .linearGauge.minorTickEndExtent = 0.10 ;
this .linearGauge.minorTickStartExtent = 0.20 ;
this .linearGauge.minorTickStrokeThickness = 1 ;
this .linearGauge.tickStartExtent = 0.25 ;
this .linearGauge.tickEndExtent = 0.05 ;
this .linearGauge.tickStrokeThickness = 2 ;
const range1 = new IgxLinearGraphRangeComponent();
range1.startValue = 100 ;
range1.endValue = 125 ;
const range2 = new IgxLinearGraphRangeComponent();
range2.startValue = 125 ;
range2.endValue = 150 ;
const range3 = new IgxLinearGraphRangeComponent();
range3.startValue = 150 ;
range3.endValue = 175 ;
const range4 = new IgxLinearGraphRangeComponent();
range4.startValue = 175 ;
range4.endValue = 200 ;
this .linearGauge.rangeBrushes = ["#0078C8" , "#0099FF" , "#21A7FF" , "#4FB9FF" ];
this .linearGauge.rangeOutlines = ["#0078C8" , "#0099FF" , "#21A7FF" , "#4FB9FF" ];
this .linearGauge.ranges.clear();
this .linearGauge.ranges.add(range1);
this .linearGauge.ranges.add(range2);
this .linearGauge.ranges.add(range3);
this .linearGauge.ranges.add(range4);
for (let i = 0 ; i < this .linearGauge.ranges.count; i++) {
const range = this .linearGauge.ranges.item(i);
range.innerStartExtent = 0.075 ;
range.innerEndExtent = 0.075 ;
range.outerStartExtent = 0.65 ;
range.outerEndExtent = 0.65 ;
}
this .linearGauge.scaleStrokeThickness = 0 ;
this .linearGauge.scaleBrush = "#ffffff" ;
this .linearGauge.scaleOutline = "#dbdbdb" ;
this .linearGauge.scaleInnerExtent = 0.075 ;
this .linearGauge.scaleOuterExtent = 0.85 ;
this .linearGauge.scaleStartExtent = 0.05 ;
this .linearGauge.scaleEndExtent = 0.95 ;
this .linearGauge.backingBrush = "#ffffff" ;
this .linearGauge.backingOutline = "#d1d1d1" ;
this .linearGauge.backingStrokeThickness = 0 ;
this .shouldAnimate = true ;
}
public AnimateToGauge1(): void {
if (this .shouldAnimate) {
this .linearGauge.transitionDuration = 500 ;
}
this .linearGauge.minimumValue = 0 ;
this .linearGauge.maximumValue = 80 ;
this .linearGauge.value = 60 ;
this .linearGauge.interval = 20 ;
this .linearGauge.labelInterval = 20 ;
this .linearGauge.labelExtent = 0.05 ;
this .linearGauge.isNeedleDraggingEnabled = true ;
this .linearGauge.needleShape = LinearGraphNeedleShape.Trapezoid;
this .linearGauge.needleBrush = "#79797a" ;
this .linearGauge.needleOutline = "#ffffffff" ;
this .linearGauge.needleStrokeThickness = 1 ;
this .linearGauge.needleOuterExtent = 0.9 ;
this .linearGauge.needleInnerExtent = 0.3 ;
this .linearGauge.minorTickCount = 5 ;
this .linearGauge.minorTickEndExtent = 0.10 ;
this .linearGauge.minorTickStartExtent = 0.20 ;
this .linearGauge.minorTickStrokeThickness = 1 ;
this .linearGauge.tickStartExtent = 0.25 ;
this .linearGauge.tickEndExtent = 0.05 ;
this .linearGauge.tickStrokeThickness = 2 ;
const range1 = new IgxLinearGraphRangeComponent();
range1.startValue = 0 ;
range1.endValue = 40 ;
const range2 = new IgxLinearGraphRangeComponent();
range2.startValue = 40 ;
range2.endValue = 80 ;
this .linearGauge.rangeBrushes = [ "#a4bd29" , "#F86232" ];
this .linearGauge.rangeOutlines = [ "#a4bd29" , "#F86232" ];
this .linearGauge.ranges.clear();
this .linearGauge.ranges.add(range1);
this .linearGauge.ranges.add(range2);
for (let i = 0 ; i < this .linearGauge.ranges.count; i++) {
const range = this .linearGauge.ranges.item(i);
range.innerStartExtent = 0.075 ;
range.innerEndExtent = 0.075 ;
range.outerStartExtent = 0.65 ;
range.outerEndExtent = 0.65 ;
}
this .linearGauge.scaleStrokeThickness = 0 ;
this .linearGauge.scaleBrush = "#ffffff" ;
this .linearGauge.scaleOutline = "#dbdbdb" ;
this .linearGauge.scaleInnerExtent = 0.075 ;
this .linearGauge.scaleOuterExtent = 0.85 ;
this .linearGauge.scaleStartExtent = 0.05 ;
this .linearGauge.scaleEndExtent = 0.95 ;
this .linearGauge.backingBrush = "#ffffff" ;
this .linearGauge.backingOutline = "#d1d1d1" ;
this .linearGauge.backingStrokeThickness = 0 ;
this .shouldAnimate = true ;
}
}
ts コピー <div class ="container vertical" >
<div class ="options horizontal" >
<button (click )="AnimateToGauge1()"
class ="options-button" > Animation #1</button >
<button (click )="AnimateToGauge2()"
class ="options-button" > Animation #2</button >
<button (click )="AnimateToGauge3()"
class ="options-button" > Animation #3</button >
</div >
<div class ="container" >
<igx-linear-gauge
#linearGauge
height ="80px"
width ="400px"
minimumValue =0
maximumValue =100
value =50
interval =10
labelInterval =10
labelExtent =0.02
minorTickEndExtent =0.10,
minorTickStartExtent =0.20,
tickStartExtent =0.25,
tickEndExtent =0.05,
tickStrokeThickness =2,
needleShape ="Needle"
needleBrush ="#79797a"
needleOutline ="#79797a"
scaleStrokeThickness =0
scaleBrush ="#ffffff"
scaleOutline ="#d3d3d3"
backingBrush ="#ffffff"
backingOutline ="#d1d1d1"
backingStrokeThickness =0 >
</igx-linear-gauge >
</div >
</div >
html コピー
이 샘플이 마음에 드시나요? 전체 Ignite UI for Angular 툴킷에 액세스하고 몇 분 안에 나만의 앱을 구축해 보세요. 무료로 다운로드하세요.
종속성
Angular 게이지 구성 요소를 설치할 때 핵심 패키지도 설치해야 합니다.
npm install --save igniteui-angular-core
npm install --save igniteui-angular-gauges
cmd
컴포넌트 모듈
IgxLinearGaugeComponent
에는 다음 모듈이 필요합니다.
import { IgxLinearGaugeModule } from 'igniteui-angular-gauges' ;
@NgModule ({
imports : [
IgxLinearGaugeModule
]
})
export class AppModule {}
ts
용법
다음 코드는 바늘과 눈금의 세 가지 비교 범위를 포함하는 선형 게이지를 만드는 방법을 보여줍니다.
<igx-linear-gauge width ="700px"
height ="30px"
minimumValue = "5"
maximumValue = "55"
value = "43" >
<igx-linear-graph-range startValue ="0"
endValue ="15"
brush ="red" >
</igx-linear-graph-range >
<igx-linear-graph-range startValue ="15"
endValue ="30"
brush ="yellow" >
</igx-linear-graph-range >
<igx-linear-graph-range startValue ="30"
endValue ="55"
brush ="green" >
</igx-linear-graph-range >
</igx-linear-gauge >
html
바늘
이는 선형 게이지 구성 요소에 의해 표시되는 기본 측정값이며 막대로 시각화되거나 아래에 설명된 대로 거의 모든 모양을 표시하도록 사용자 정의할 수 있습니다.
<igx-linear-gauge
height ="80px" width ="400px"
minimumValue =0
maximumValue =100 interval =10
value =50
isNeedleDraggingEnabled =true
needleShape ="Custom"
needleBrush ="DodgerBlue"
needleOutline ="DodgerBlue"
needleStrokeThickness =1
needleBreadth =15
needleInnerExtent =0.35
needleOuterExtent =0.65
needleOuterPointExtent =0.8
needleInnerPointExtent =0.325
needleInnerPointWidth =0
needleOuterPointWidth =0.3
needleInnerBaseWidth =0
needleOuterBaseWidth =0.07 >
</igx-linear-gauge >
html
import { NgModule } from "@angular/core" ;
import { FormsModule } from "@angular/forms" ;
import { CommonModule } from "@angular/common" ;
import { BrowserModule } from "@angular/platform-browser" ;
import { BrowserAnimationsModule } from "@angular/platform-browser/animations" ;
import { AppComponent } from "./app.component" ;
import { IgxLinearGaugeModule } from "igniteui-angular-gauges" ;
@NgModule ({
bootstrap : [AppComponent],
declarations : [
AppComponent,
],
imports : [
BrowserModule,
BrowserAnimationsModule,
CommonModule,
FormsModule,
IgxLinearGaugeModule
],
providers : [],
schemas : []
})
export class AppModule {}
ts コピー import { Component, ViewChild } from "@angular/core" ;
import { IgxLinearGaugeComponent } from "igniteui-angular-gauges" ;
@Component ({
standalone : false ,
selector : "app-root" ,
styleUrls : ["./app.component.scss" ],
templateUrl : "./app.component.html"
})
export class AppComponent {
@ViewChild ("linearGauge" , { static : true })
public linearGauge: IgxLinearGaugeComponent;
}
ts コピー <div class ="container vertical" >
<igx-linear-gauge
#linearGauge
height ="80px" width ="400px"
minimumValue =0 value =50
maximumValue =100 interval =10
isNeedleDraggingEnabled =true
needleShape ="Custom"
needleBrush ="DodgerBlue"
needleOutline ="DodgerBlue"
needleStrokeThickness =1
needleBreadth =15
needleInnerExtent =0.35
needleOuterExtent =0.65
needleOuterPointExtent =0.8
needleInnerPointExtent =0.325
needleInnerPointWidth =0
needleOuterPointWidth =0.3
needleInnerBaseWidth =0
needleOuterBaseWidth =0.07
>
</igx-linear-gauge >
</div >
html コピー
하이라이트 바늘
선형 게이지는 두 번째 바늘을 표시하도록 수정할 수 있습니다. 이렇게 하면 주 바늘이 value
더 낮은 불투명도로 나타납니다. 이 기능을 사용하려면 먼저 오버레이로 설정한 highlightValueDisplayMode
다음 a highlightValue
를 적용합니다.
<igx-linear-gauge
#linearGauge
height ="80px"
width ="400px"
value =70
minimumValue =0
maximumValue =100
interval =10
labelInterval =10
labelExtent =0.025
labelsPreTerminal =0
labelsPostInitial =0
needleBrush ="Blue"
highlightValueDisplayMode ="Overlay"
highlightValue =25
isHighlightNeedleDraggingEnabled =true >
</igx-linear-gauge >
html
import { NgModule } from "@angular/core" ;
import { FormsModule } from "@angular/forms" ;
import { CommonModule } from "@angular/common" ;
import { BrowserModule } from "@angular/platform-browser" ;
import { BrowserAnimationsModule } from "@angular/platform-browser/animations" ;
import { AppComponent } from "./app.component" ;
import { IgxLinearGaugeModule } from "igniteui-angular-gauges" ;
@NgModule ({
bootstrap : [AppComponent],
declarations : [
AppComponent,
],
imports : [
BrowserModule,
BrowserAnimationsModule,
CommonModule,
FormsModule,
IgxLinearGaugeModule
],
providers : [],
schemas : []
})
export class AppModule {}
ts コピー import { Component, ViewChild } from "@angular/core" ;
import { IgxLinearGaugeComponent } from "igniteui-angular-gauges" ;
@Component ({
standalone : false ,
selector : "app-root" ,
styleUrls : ["./app.component.scss" ],
templateUrl : "./app.component.html"
})
export class AppComponent {
@ViewChild ("linearGauge" , { static : true })
public linearGauge: IgxLinearGaugeComponent;
}
ts コピー <div class ="container vertical" >
<igx-linear-gauge
#linearGauge
height ="80px"
width ="400px"
value =70
minimumValue =0
maximumValue =100
interval =10
labelInterval =10
labelExtent =0.025
labelsPreTerminal =0
labelsPostInitial =0
needleBrush ="Blue"
highlightValueDisplayMode ="Overlay"
highlightValue =25
isHighlightNeedleDraggingEnabled =true >
</igx-linear-gauge >
</div >
html コピー
범위
범위는 눈금에서 지정된 값 범위를 강조 표시하는 시각적 요소입니다. 그 목적은 성능 막대 측정값의 질적 상태를 시각적으로 전달하는 동시에 해당 상태 내에 있는 정도를 보여주는 것입니다.
<igx-linear-gauge
height ="80px" width ="400px"
minimumValue =0 value =50
maximumValue =100 interval =10
rangeBrushes ="#a4bd29, #F86232"
rangeOutlines ="#a4bd29, #F86232" >
<igx-linear-graph-range
startValue =0 endValue =50
innerStartExtent =0.075 innerEndExtent =0.075
outerStartExtent =0.25 outerEndExtent =0.4 >
</igx-linear-graph-range >
<igx-linear-graph-range
startValue =50 endValue =100
innerStartExtent =0.075 innerEndExtent =0.075
outerStartExtent =0.4 outerEndExtent =0.55 >
</igx-linear-graph-range >
</igx-linear-gauge >
html
import { NgModule } from "@angular/core" ;
import { FormsModule } from "@angular/forms" ;
import { CommonModule } from "@angular/common" ;
import { BrowserModule } from "@angular/platform-browser" ;
import { BrowserAnimationsModule } from "@angular/platform-browser/animations" ;
import { AppComponent } from "./app.component" ;
import { IgxLinearGaugeModule } from "igniteui-angular-gauges" ;
@NgModule ({
bootstrap : [AppComponent],
declarations : [
AppComponent,
],
imports : [
BrowserModule,
BrowserAnimationsModule,
CommonModule,
FormsModule,
IgxLinearGaugeModule
],
providers : [],
schemas : []
})
export class AppModule {}
ts コピー import { Component, ViewChild } from "@angular/core" ;
import { IgxLinearGaugeComponent } from "igniteui-angular-gauges" ;
@Component ({
standalone : false ,
selector : "app-root" ,
styleUrls : ["./app.component.scss" ],
templateUrl : "./app.component.html"
})
export class AppComponent {
@ViewChild ("linearGauge" , { static : true })
public linearGauge: IgxLinearGaugeComponent;
}
ts コピー <div class ="container vertical" >
<igx-linear-gauge
#linearGauge
height ="80px" width ="400px"
minimumValue =0 value =50
maximumValue =100 interval =10
rangeBrushes ="#a4bd29, #F86232"
rangeOutlines ="#a4bd29, #F86232" >
<igx-linear-graph-range
startValue =0 endValue =50
innerStartExtent =0.075 innerEndExtent =0.075
outerStartExtent =0.25 outerEndExtent =0.4 >
</igx-linear-graph-range >
<igx-linear-graph-range
startValue =50 endValue =100
innerStartExtent =0.075 innerEndExtent =0.075
outerStartExtent =0.4 outerEndExtent =0.55 >
</igx-linear-graph-range >
</igx-linear-gauge >
</div >
html コピー
눈금 표시
눈금 표시는 선형 게이지의 가독성을 높이기 위해 눈금을 간격으로 시각적으로 나누는 역할을 합니다.
주요 눈금 표시 – 주요 눈금 표시는 눈금의 기본 구분 기호로 사용됩니다. 나타나는 빈도, 범위 및 스타일은 해당 속성을 설정하여 제어할 수 있습니다.
보조 눈금 표시 – 보조 눈금 표시는 눈금의 가독성을 추가로 향상시키는 데 사용될 수 있고 주요 눈금과 유사한 방식으로 사용자 정의할 수 있는 보조 눈금 표시를 나타냅니다.
<igx-linear-gauge
height ="80px" width ="400px"
minimumValue =0 value =50
maximumValue =100
interval =10
tickBrush ="DodgerBlue"
ticksPreTerminal =0
ticksPostInitial =0
tickStrokeThickness =2
tickStartExtent =0.25
tickEndExtent =0.05
minorTickCount =4
minorTickBrush ="DarkViolet"
minorTickEndExtent =0.05
minorTickStartExtent =0.15
minorTickStrokeThickness =1 >
</igx-linear-gauge >
html
import { NgModule } from "@angular/core" ;
import { FormsModule } from "@angular/forms" ;
import { CommonModule } from "@angular/common" ;
import { BrowserModule } from "@angular/platform-browser" ;
import { BrowserAnimationsModule } from "@angular/platform-browser/animations" ;
import { AppComponent } from "./app.component" ;
import { IgxLinearGaugeModule } from "igniteui-angular-gauges" ;
@NgModule ({
bootstrap : [AppComponent],
declarations : [
AppComponent,
],
imports : [
BrowserModule,
BrowserAnimationsModule,
CommonModule,
FormsModule,
IgxLinearGaugeModule
],
providers : [],
schemas : []
})
export class AppModule {}
ts コピー import { Component, ViewChild } from "@angular/core" ;
import { IgxLinearGaugeComponent } from "igniteui-angular-gauges" ;
@Component ({
standalone : false ,
selector : "app-root" ,
styleUrls : ["./app.component.scss" ],
templateUrl : "./app.component.html"
})
export class AppComponent {
@ViewChild ("linearGauge" , { static : true })
public linearGauge: IgxLinearGaugeComponent;
}
ts コピー <div class ="container vertical" >
<igx-linear-gauge
#linearGauge
height ="80px" width ="400px"
minimumValue =0 value =50
maximumValue =100 interval =10
tickBrush ="DodgerBlue"
ticksPreTerminal =0
ticksPostInitial =0
tickStrokeThickness =2
tickStartExtent =0.25
tickEndExtent =0.05
minorTickCount =4
minorTickBrush ="DarkViolet"
minorTickEndExtent =0.05
minorTickStartExtent =0.15
minorTickStrokeThickness =1 >
</igx-linear-gauge >
</div >
html コピー
레이블
레이블은 척도의 측정값을 나타냅니다.
<igx-linear-gauge
height ="80px" width ="400px"
minimumValue =0 value =50
maximumValue =100 interval =10
labelInterval =10
labelExtent =0.025
labelsPreTerminal =0
labelsPostInitial =0
fontBrush ="DodgerBlue"
font ="11px Verdana" >
</igx-linear-gauge >
html
import { NgModule } from "@angular/core" ;
import { FormsModule } from "@angular/forms" ;
import { CommonModule } from "@angular/common" ;
import { BrowserModule } from "@angular/platform-browser" ;
import { BrowserAnimationsModule } from "@angular/platform-browser/animations" ;
import { AppComponent } from "./app.component" ;
import { IgxLinearGaugeModule } from "igniteui-angular-gauges" ;
@NgModule ({
bootstrap : [AppComponent],
declarations : [
AppComponent,
],
imports : [
BrowserModule,
BrowserAnimationsModule,
CommonModule,
FormsModule,
IgxLinearGaugeModule
],
providers : [],
schemas : []
})
export class AppModule {}
ts コピー import { Component, ViewChild } from "@angular/core" ;
import { IgxLinearGaugeComponent } from "igniteui-angular-gauges" ;
@Component ({
standalone : false ,
selector : "app-root" ,
styleUrls : ["./app.component.scss" ],
templateUrl : "./app.component.html"
})
export class AppComponent {
@ViewChild ("linearGauge" , { static : true })
public linearGauge: IgxLinearGaugeComponent;
}
ts コピー <div class ="container vertical" >
<igx-linear-gauge
#linearGauge
height ="80px" width ="400px"
minimumValue =0 value =50
maximumValue =100 interval =10
labelInterval =10
labelExtent =0.025
labelsPreTerminal =0
labelsPostInitial =0
fontBrush ="DodgerBlue"
font ="11px Verdana"
>
</igx-linear-gauge >
</div >
html コピー
역행
뒷면 요소는 선형 게이지 구성 요소의 배경과 테두리를 나타냅니다. 이는 항상 렌더링되는 첫 번째 요소이며 레이블 및 눈금 표시와 같은 나머지 모든 요소는 그 위에 오버레이됩니다.
<igx-linear-gauge
height ="80px" width ="400px"
minimumValue =0 value =50
maximumValue =100 interval =10
backingBrush ="#bddcfc"
backingOutline ="DodgerBlue"
backingStrokeThickness =4
backingInnerExtent =0
backingOuterExtent =1 >
</igx-linear-gauge >
html
import { NgModule } from "@angular/core" ;
import { FormsModule } from "@angular/forms" ;
import { CommonModule } from "@angular/common" ;
import { BrowserModule } from "@angular/platform-browser" ;
import { BrowserAnimationsModule } from "@angular/platform-browser/animations" ;
import { AppComponent } from "./app.component" ;
import { IgxLinearGaugeModule } from "igniteui-angular-gauges" ;
@NgModule ({
bootstrap : [AppComponent],
declarations : [
AppComponent,
],
imports : [
BrowserModule,
BrowserAnimationsModule,
CommonModule,
FormsModule,
IgxLinearGaugeModule
],
providers : [],
schemas : []
})
export class AppModule {}
ts コピー import { Component, ViewChild } from "@angular/core" ;
import { IgxLinearGaugeComponent } from "igniteui-angular-gauges" ;
@Component ({
standalone : false ,
selector : "app-root" ,
styleUrls : ["./app.component.scss" ],
templateUrl : "./app.component.html"
})
export class AppComponent {
@ViewChild ("linearGauge" , { static : true })
public linearGauge: IgxLinearGaugeComponent;
}
ts コピー <div class ="container vertical" >
<igx-linear-gauge
#linearGauge
height ="80px" width ="400px"
minimumValue =0 value =50
maximumValue =100 interval =10
backingBrush ="#bddcfc"
backingOutline ="DodgerBlue"
backingStrokeThickness =4
backingInnerExtent =0
backingOuterExtent =1 >
</igx-linear-gauge >
</div >
html コピー
규모
눈금은 선형 게이지의 전체 값 범위를 강조하는 시각적 요소입니다. 눈금의 모양과 모양을 사용자 정의할 수 있습니다. isScaleInverted
속성을 사용하여 반전할 수도 있으며 모든 레이블은 왼쪽에서 오른쪽이 아닌 오른쪽에서 왼쪽으로 렌더링됩니다.
<igx-linear-gauge
height ="80px" width ="400px"
minimumValue =0 value =50
maximumValue =100 interval =10
isScaleInverted =false
scaleBrush ="DodgerBlue"
scaleOutline ="DarkViolet"
scaleStrokeThickness =1
scaleInnerExtent =0.05
scaleOuterExtent =0.65
scaleStartExtent =0.05
scaleEndExtent =0.95 >
</igx-linear-gauge >
html
import { NgModule } from "@angular/core" ;
import { FormsModule } from "@angular/forms" ;
import { CommonModule } from "@angular/common" ;
import { BrowserModule } from "@angular/platform-browser" ;
import { BrowserAnimationsModule } from "@angular/platform-browser/animations" ;
import { AppComponent } from "./app.component" ;
import { IgxLinearGaugeModule } from "igniteui-angular-gauges" ;
@NgModule ({
bootstrap : [AppComponent],
declarations : [
AppComponent,
],
imports : [
BrowserModule,
BrowserAnimationsModule,
CommonModule,
FormsModule,
IgxLinearGaugeModule
],
providers : [],
schemas : []
})
export class AppModule {}
ts コピー import { Component, ViewChild } from "@angular/core" ;
import { IgxLinearGaugeComponent } from "igniteui-angular-gauges" ;
@Component ({
standalone : false ,
selector : "app-root" ,
styleUrls : ["./app.component.scss" ],
templateUrl : "./app.component.html"
})
export class AppComponent {
@ViewChild ("linearGauge" , { static : true })
public linearGauge: IgxLinearGaugeComponent;
}
ts コピー <div class ="container vertical" >
<igx-linear-gauge
#linearGauge
height ="80px" width ="400px"
minimumValue =0 value =50
maximumValue =100 interval =10
isScaleInverted =false
scaleBrush ="DodgerBlue"
scaleOutline ="Red"
scaleStrokeThickness =2
scaleInnerExtent =0.05
scaleOuterExtent =0.65
scaleStartExtent =0.05
scaleEndExtent =0.95 >
</igx-linear-gauge >
</div >
html コピー
요약
편의를 위해 위의 모든 코드 조각은 아래의 하나의 코드 블록으로 결합되어 프로젝트에 쉽게 복사하고 모든 기능과 시각적 개체가 활성화된 선형 게이지를 볼 수 있습니다.
<igx-linear-gauge
height ="80px" width ="400px"
minimumValue =0
maximumValue =100
labelInterval =10
labelExtent =0.025
labelsPreTerminal =0
labelsPostInitial =0
fontBrush ="Black"
font ="11px Verdana"
interval =10
tickBrush ="Black"
ticksPreTerminal =0
ticksPostInitial =0
tickStrokeThickness =2
tickStartExtent =0.25
tickEndExtent =0.05
minorTickCount =4
minorTickBrush ="Black"
minorTickEndExtent =0.05
minorTickStartExtent =0.15
minorTickStrokeThickness =1
value =50
isNeedleDraggingEnabled =true
needleShape ="Custom"
needleBrush ="Black"
needleOutline ="Black"
needleStrokeThickness =1
needleBreadth =15
needleInnerExtent =0.35
needleOuterExtent =0.65
needleOuterPointExtent =0.8
needleInnerPointExtent =0.325
needleInnerPointWidth =0
needleOuterPointWidth =0.3
needleInnerBaseWidth =0
needleOuterBaseWidth =0.07
isScaleInverted =false
scaleBrush ="Gray"
scaleOutline ="Gray"
scaleStrokeThickness =1
scaleInnerExtent =0.05
scaleOuterExtent =0.65
scaleStartExtent =0.05
scaleEndExtent =0.95
backingBrush ="#cecece"
backingOutline ="#cecece"
backingStrokeThickness =4
backingInnerExtent =0
backingOuterExtent =1
rangeBrushes ="#C62828, #F96232, #FF9800"
rangeOutlines ="#C62828, #F96232, #FF9800" >
<igx-linear-graph-range
startValue =0 endValue =50
innerStartExtent =0.075 innerEndExtent =0.075
outerStartExtent =0.25 outerEndExtent =0.4 >
</igx-linear-graph-range >
<igx-linear-graph-range
startValue =50 endValue =100
innerStartExtent =0.075 innerEndExtent =0.075
outerStartExtent =0.4 outerEndExtent =0.55 >
</igx-linear-graph-range >
</igx-linear-gauge >
html
API 참조
다음은 위 섹션에서 언급된 API 멤버 목록입니다.
추가 리소스
다음 주제에서 다른 유형의 게이지에 대한 자세한 정보를 찾을 수 있습니다.