Descripción general de React Bullet Graph
El componente de gráfico de viñetas React permite una vista lineal y concisa de las medidas comparadas con una escala.
El componente de gráfico de viñetas Ignite UI for React le brinda la capacidad de crear presentaciones de datos atractivas, reemplazando los medidores y medidores que se utilizan en los tableros con gráficos de barras simples pero directos y claros. Un gráfico de viñetas es una de las formas más efectivas y eficientes de presentar el progreso hacia los objetivos, rangos buenos/mejores/mejores, o comparar múltiples mediciones en el menor espacio horizontal o vertical posible.
React Ejemplo de gráfico de viñetas
El siguiente ejemplo demuestra cómo configurar varias propiedades en el mismo IgrBulletGraph
puede transformarlo en un gráfico de viñetas completamente diferente.
import React from 'react' ;
import ReactDOM from 'react-dom/client' ;
import './index.css' ;
import { IgrBulletGraph } from "@infragistics/igniteui-react-gauges" ;
import { IgrBulletGraphModule } from "@infragistics/igniteui-react-gauges" ;
import { IgrLinearGraphRange } from "@infragistics/igniteui-react-gauges" ;
IgrBulletGraphModule.register();
export default class BulletGraphAnimation extends React.Component {
public gauge: IgrBulletGraph;
private shouldAnimate: boolean = false ;
constructor (props: any ) {
super (props);
this .onGaugeRef = this .onGaugeRef.bind(this );
this .onAnimateToGauge1 = this .onAnimateToGauge1.bind(this );
this .onAnimateToGauge2 = this .onAnimateToGauge2.bind(this );
this .onAnimateToGauge3 = this .onAnimateToGauge3.bind(this );
}
public onGaugeRef(component: IgrBulletGraph) {
if (!component) { return ; }
this .gauge = component;
this .onAnimateToGauge3(null );
}
public render (): JSX .Element {
return (
<div className ="container sample" >
<div className ="options horizontal" >
<button onClick ={this.onAnimateToGauge1} className ="options-button" > Gauge Animation #1 </button >
<button onClick ={this.onAnimateToGauge2} className ="options-button" > Gauge Animation #2 </button >
<button onClick ={this.onAnimateToGauge3} className ="options-button" > Gauge Animation #3 </button >
</div >
<IgrBulletGraph
ref ={this.onGaugeRef}
height ="80px"
width ="100%"
minimumValue ={0}
maximumValue ={120}
valueBrush ="#4286f4"
value ={70}
targetValueBrush ="#4286f4"
targetValue ={90}
targetValueBreadth ={10}
interval ={10}
labelInterval ={10}
labelExtent ={0.02}
rangeBrushes ="#FF9800, #F96232, #C62828"
rangeOutlines ="#FF9800, #F96232, #C62828"
scaleBackgroundThickness ={0}
scaleBackgroundBrush ="#dbdbdb"
scaleBackgroundOutline ="gray" />
</div >
);
}
public onAnimateToGauge3 = (e: any ) => {
if (this .shouldAnimate){
this .gauge.transitionDuration = 1000 ;
}
this .gauge.minimumValue = 0 ;
this .gauge.maximumValue = 120 ;
this .gauge.value = 70 ;
this .gauge.interval = 10 ;
this .gauge.labelInterval = 10 ;
this .gauge.labelExtent = 0.02 ;
this .gauge.valueInnerExtent = 0.5 ;
this .gauge.valueOuterExtent = 0.7 ;
this .gauge.valueBrush = "#000000" ;
this .gauge.targetValueBrush = "#000000" ;
this .gauge.targetValueBreadth = 10 ;
this .gauge.targetValue = 90 ;
this .gauge.minorTickCount = 5 ;
this .gauge.minorTickEndExtent = 0.10 ;
this .gauge.minorTickStartExtent = 0.20 ;
this .gauge.tickStartExtent = 0.20 ;
this .gauge.tickEndExtent = 0.05 ;
this .gauge.tickStrokeThickness = 2 ;
const range1 = new IgrLinearGraphRange({});
range1.startValue = 0 ;
range1.endValue = 40 ;
const range2 = new IgrLinearGraphRange({});
range2.startValue = 40 ;
range2.endValue = 80 ;
const range3 = new IgrLinearGraphRange({});
range3.startValue = 80 ;
range3.endValue = 120 ;
this .gauge.rangeBrushes = [ "#FF9800" , "#F96232" , "#C62828" ];
this .gauge.rangeOutlines = [ "#FF9800" , "#F96232" , "#C62828" ];
this .gauge.ranges.clear();
this .gauge.ranges.add(range1);
this .gauge.ranges.add(range2);
this .gauge.ranges.add(range3);
for (let i = 0 ; i < this.gauge.ranges.count; i++) {
const range = this.gauge.ranges.item(i);
range.innerStartExtent = 0.2;
range.innerEndExtent = 0.2;
range.outerStartExtent = 0.95;
range.outerEndExtent = 0.95;
}
// setting extent of gauge scale
this.gauge.scaleBackgroundThickness = 0.5;
this.gauge.scaleBackgroundBrush = "#dbdbdb";
this.gauge.scaleBackgroundOutline = "gray";
this.gauge.scaleStartExtent = 0.05;
this.gauge.scaleEndExtent = 0.95;
this.gauge.scaleBackgroundThickness = 0;
// setting appearance of backing fill and outline
this.gauge.backingBrush = "#f7f7f7";
this.gauge.backingOutline = "#d1d1d1";
this.gauge.backingStrokeThickness = 0;
this.shouldAnimate = true;
}
public onAnimateToGauge2 = (e: any) => {
if (!this .gauge) { return ; }
if (this .shouldAnimate){
this .gauge.transitionDuration = 1000 ;
}
this .gauge.minimumValue = 100 ;
this .gauge.maximumValue = 200 ;
this .gauge.value = 120 ;
this .gauge.interval = 10 ;
this .gauge.labelInterval = 10 ;
this .gauge.labelExtent = 0.02 ;
this .gauge.valueInnerExtent = 0.5 ;
this .gauge.valueOuterExtent = 0.7 ;
this .gauge.valueBrush = "#000000" ;
this .gauge.targetValueBrush = "#000000" ;
this .gauge.targetValueBreadth = 10 ;
this .gauge.targetValue = 180 ;
this .gauge.minorTickCount = 5 ;
this .gauge.minorTickEndExtent = 0.10 ;
this .gauge.minorTickStartExtent = 0.20 ;
this .gauge.tickStartExtent = 0.20 ;
this .gauge.tickEndExtent = 0.05 ;
this .gauge.tickStrokeThickness = 2 ;
const range1 = new IgrLinearGraphRange({});
range1.startValue = 100 ;
range1.endValue = 125 ;
const range2 = new IgrLinearGraphRange({});
range2.startValue = 125 ;
range2.endValue = 150 ;
const range3 = new IgrLinearGraphRange({});
range3.startValue = 150 ;
range3.endValue = 175 ;
const range4 = new IgrLinearGraphRange({});
range4.startValue = 175 ;
range4.endValue = 200 ;
this .gauge.rangeBrushes = [ "#0078C8" , "#0099FF" , "#21A7FF" , "#4FB9FF" ];
this .gauge.rangeOutlines = [ "#0078C8" , "#0099FF" , "#21A7FF" , "#4FB9FF" ];
this .gauge.ranges.clear();
this .gauge.ranges.add(range1);
this .gauge.ranges.add(range2);
this .gauge.ranges.add(range3);
this .gauge.ranges.add(range4);
for (let i = 0 ; i < this.gauge.ranges.count; i++) {
const range = this.gauge.ranges.item(i);
range.innerStartExtent = 0.2;
range.innerEndExtent = 0.2;
range.outerStartExtent = 0.95;
range.outerEndExtent = 0.95;
}
// setting extent of gauge scale
this.gauge.scaleBackgroundThickness = 0.5;
this.gauge.scaleBackgroundBrush = "#dbdbdb";
this.gauge.scaleBackgroundOutline = "gray";
this.gauge.scaleStartExtent = 0.05;
this.gauge.scaleEndExtent = 0.95;
this.gauge.scaleBackgroundThickness = 0;
// setting appearance of backing fill and outline
this.gauge.backingBrush = "#f7f7f7";
this.gauge.backingOutline = "#d1d1d1";
this.gauge.backingStrokeThickness = 0;
this.shouldAnimate = true;
}
public onAnimateToGauge1 = (e: any) => {
if (!this .gauge) { return ; }
if (this .shouldAnimate){
this .gauge.transitionDuration = 1000 ;
}
this .gauge.minimumValue = 0 ;
this .gauge.maximumValue = 80 ;
this .gauge.value = 70 ;
this .gauge.interval = 20 ;
this .gauge.labelInterval = 20 ;
this .gauge.labelExtent = 0.02 ;
this .gauge.valueInnerExtent = 0.5 ;
this .gauge.valueOuterExtent = 0.7 ;
this .gauge.valueBrush = "#000000" ;
this .gauge.targetValueBrush = "#000000" ;
this .gauge.targetValueBreadth = 10 ;
this .gauge.targetValue = 60 ;
this .gauge.minorTickCount = 5 ;
this .gauge.minorTickEndExtent = 0.10 ;
this .gauge.minorTickStartExtent = 0.20 ;
this .gauge.tickStartExtent = 0.20 ;
this .gauge.tickEndExtent = 0.05 ;
this .gauge.tickStrokeThickness = 2 ;
const range1 = new IgrLinearGraphRange({});
range1.startValue = 0 ;
range1.endValue = 40 ;
const range2 = new IgrLinearGraphRange({});
range2.startValue = 40 ;
range2.endValue = 80 ;
this .gauge.rangeBrushes = [ "#a4bd29" , "#F86232" ];
this .gauge.rangeOutlines = [ "#a4bd29" , "#F86232" ];
this .gauge.ranges.clear();
this .gauge.ranges.add(range1);
this .gauge.ranges.add(range2);
for (let i = 0 ; i < this.gauge.ranges.count; i++) {
const range = this.gauge.ranges.item(i);
range.innerStartExtent = 0.2;
range.innerEndExtent = 0.2;
range.outerStartExtent = 0.95;
range.outerEndExtent = 0.95;
}
// setting extent of gauge scale
this.gauge.scaleBackgroundThickness = 0.5;
this.gauge.scaleBackgroundBrush = "#dbdbdb";
this.gauge.scaleBackgroundOutline = "gray";
this.gauge.scaleStartExtent = 0.05;
this.gauge.scaleEndExtent = 0.95;
this.gauge.scaleBackgroundThickness = 0;
// setting appearance of backing fill and outline
this.gauge.backingBrush = "#f7f7f7";
this.gauge.backingOutline = "#d1d1d1";
this.gauge.backingStrokeThickness = 0;
this.shouldAnimate = true;
}
}
// rendering above class to the React DOM
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render( <BulletGraphAnimation /> );
tsx コピー
¿Te gusta este ejemplo? Obtén acceso a nuestro kit de herramientas completo Ignite UI for React y comienza a crear tus propias aplicaciones en minutos. Descárgalo gratis.
El gráfico de viñetas admite una escala, un conjunto de marcas y un conjunto de etiquetas. El componente de gráfico de viñetas también tiene soporte integrado para transiciones animadas. Esta animación se puede personalizar fácilmente configurando la propiedad transitionDuration
. Las características del gráfico de viñetas incluyen orientación y dirección configurables, elementos visuales configurables como la aguja y más.
dependencias
Al instalar el paquete de medidores, también se debe instalar el paquete central.
npm install --save igniteui-react-core
npm install --save igniteui-react-gauges
cmd
Módulos de componentes
IgrBulletGraph
requiere los siguientes módulos:
import { IgrBulletGraphModule } from 'igniteui-react-gauges' ;
IgrBulletGraphModule.register();
ts
Uso
El siguiente código explica cómo crear un componente de gráfico de viñetas y configurar una barra de rendimiento, un marcador de medida comparativa y tres rangos comparativos en la escala.
<IgrBulletGraph height ="100"
width ="300"
minimumValue ={5}
maximumValue ={55}
value ={35}
targetValue ={43} >
<IgrLinearGraphRange startValue ={0}
endValue ={15}
brush ="#828181" />
<IgrLinearGraphRange StartValue ={15}
endValue ={30}
brush ="#AAAAAA" />
<IgrLinearGraphRange StartValue ={30}
bndValue ={55}
brush ="#D0D0D0" />
</IgrBulletGraph >
tsx
Medidas comparativas
El gráfico de viñetas puede mostrar dos medidas: valor de rendimiento y valor objetivo.
El valor de rendimiento es la medida principal que muestra el componente y se visualiza como una barra que se extiende a lo largo de todo el gráfico. El valor objetivo es una medida con la que se compara el valor del rendimiento. Se muestra como un pequeño bloque que corre perpendicular a la orientación de la barra de rendimiento.
<IgrBulletGraph
value ={50}
valueBrush ="DodgerBlue"
valueStrokeThickness ={1}
valueInnerExtent ={0.5}
valueOuterExtent ={0.65}
targetValue ={80}
targetValueBreadth ={10}
targetValueBrush ="LimeGreen"
targetValueOutline ="LimeGreen"
targetValueStrokeThickness ={1}
targetValueInnerExtent ={0.3}
targetValueOuterExtent ={0.85}
height ="80px" width ="400px"
minimumValue ={0} value ={50}
maximumValue ={100} />
tsx
import React from 'react' ;
import ReactDOM from 'react-dom/client' ;
import './index.css' ;
import { IgrBulletGraph } from "@infragistics/igniteui-react-gauges" ;
import { IgrBulletGraphModule } from "@infragistics/igniteui-react-gauges" ;
IgrBulletGraphModule.register();
export default class BulletGraphMeasures extends React.Component {
public render (): JSX .Element {
return (
<div className ="container sample" >
<IgrBulletGraph
height ="80px"
width ="100%"
minimumValue ={0}
maximumValue ={100}
value ={50}
valueBrush ="DodgerBlue"
valueStrokeThickness ={1}
valueInnerExtent ={0.5}
valueOuterExtent ={0.65}
targetValue ={80}
targetValueBreadth ={10}
targetValueBrush ="LimeGreen"
targetValueOutline ="LimeGreen"
targetValueStrokeThickness ={1}
targetValueInnerExtent ={0.3}
targetValueOuterExtent ={0.85}
scaleBackgroundBrush = "#e5e5e5"
scaleBackgroundOutline = "#e5e5e5"
backingBrush = "#f7f7f7"
backingOutline = "#bfbfbf"
tickStrokeThickness = {1.5} />
</div >
);
}
}
const root = ReactDOM.createRoot (document.getElementById('root' ));
root.render (<BulletGraphMeasures /> );
tsx コピー
Valor destacado
El valor de rendimiento del gráfico de viñetas se puede modificar aún más para mostrar el progreso representado como un valor resaltado. Esto hará que aparezca value
con una opacidad más baja. Un buen ejemplo es si value
es 50 y highlightValue
se establece en 25. Esto representaría un rendimiento del 50%, independientemente de cuál sea el valor de targetValue
. Para habilitar esto, primero establezca highlightValueDisplayMode
en Superposición y, a continuación, aplique a highlightValue
a algo inferior a value
.
<IgrBulletGraph
height ="80px"
width ="100%"
value ={70}
targetValue ={90}
interval ={10}
minimumValue ={0}
maximumValue ={100}
labelInterval ={10}
labelExtent ={0.025}
labelsPreTerminal ={0}
labelsPostInitial ={0}
highlightValueDisplayMode ="Overlay"
highlightValue ={25} />
tsx
import React from 'react' ;
import ReactDOM from 'react-dom/client' ;
import './index.css' ;
import { IgrBulletGraph } from "@infragistics/igniteui-react-gauges" ;
import { IgrBulletGraphModule } from "@infragistics/igniteui-react-gauges" ;
IgrBulletGraphModule.register();
export default class BulletGraphHighlightNeedle extends React.Component {
public render (): JSX .Element {
return (
<div className ="container sample" >
<IgrBulletGraph
height ="80px"
width ="100%"
value ={70}
targetValue ={90}
interval ={10}
minimumValue ={0}
maximumValue ={100}
labelInterval ={10}
labelExtent ={0.025}
labelsPreTerminal ={0}
labelsPostInitial ={0}
highlightValueDisplayMode ="Overlay"
highlightValue ={25} />
</div >
);
}
}
const root = ReactDOM.createRoot (document.getElementById('root' ));
root.render (<BulletGraphHighlightNeedle /> );
tsx コピー
Rangos comparativos
Los rangos son elementos visuales que resaltan un rango específico de valores en una escala. Su propósito es comunicar visualmente el estado cualitativo de la barra de medición de desempeño, ilustrando al mismo tiempo el grado en que se encuentra dentro de ese estado.
<IgrBulletGraph
height ="80px" width ="400px"
minimumValue ={0} value ={80} interval ={10}
maximumValue ={100} targetValue ={90}
rangeBrushes ="#C62828, #F96232, #FF9800"
rangeOutlines ="#C62828, #F96232, #FF9800" >
<IgrLinearGraphRange
startValue ={0} endValue ={40}
innerStartExtent ={0.075} innerEndExtent ={0.075}
outerStartExtent ={0.95} outerEndExtent ={0.95} />
<IgrLinearGraphRange
startValue ={40} endValue ={70}
innerStartExtent ={0.075} innerEndExtent ={0.075}
outerStartExtent ={0.95} outerEndExtent ={0.95} />
<IgrLinearGraphRange
startValue ={70} endValue ={100}
innerStartExtent ={0.075} innerEndExtent ={0.075}
outerStartExtent ={0.95} outerEndExtent ={0.95} />
</IgrBulletGraph >
tsx
import React from 'react' ;
import ReactDOM from 'react-dom/client' ;
import './index.css' ;
import { IgrBulletGraph } from "@infragistics/igniteui-react-gauges" ;
import { IgrLinearGraphRange } from "@infragistics/igniteui-react-gauges" ;
import { IgrBulletGraphModule } from "@infragistics/igniteui-react-gauges" ;
IgrBulletGraphModule.register();
export default class BulletGraphRanges extends React.Component {
public render (): JSX .Element {
return (
<div className ="container sample" >
<IgrBulletGraph
height ="80px"
width ="100%"
minimumValue ={0} value ={80} interval ={10}
maximumValue ={100} targetValue ={90}
rangeBrushes ="#C62828, #F96232, #FF9800"
rangeOutlines ="#C62828, #F96232, #FF9800" >
<IgrLinearGraphRange name ="range1"
startValue ={0} endValue ={40}
innerStartExtent ={0.075} innerEndExtent ={0.075}
outerStartExtent ={0.95} outerEndExtent ={0.95} />
<IgrLinearGraphRange name ="range2"
startValue ={40} endValue ={70}
innerStartExtent ={0.075} innerEndExtent ={0.075}
outerStartExtent ={0.95} outerEndExtent ={0.95} />
<IgrLinearGraphRange name ="range3"
startValue ={70} endValue ={100}
innerStartExtent ={0.075} innerEndExtent ={0.075}
outerStartExtent ={0.95} outerEndExtent ={0.95} />
</IgrBulletGraph >
</div >
);
}
}
const root = ReactDOM.createRoot (document.getElementById('root' ));
root.render (<BulletGraphRanges /> );
tsx コピー
Marcas de verificación
Las marcas sirven como una división visual de la escala en intervalos para aumentar la legibilidad del gráfico de viñetas.
Marcas de graduación principales: las marcas de graduación principales se utilizan como delimitadores principales en la escala. La frecuencia con la que aparecen, su extensión y estilo se pueden controlar estableciendo sus propiedades correspondientes.
Marcas de graduación menores: las marcas de graduación menores representan marcas de graduación auxiliares, que pueden usarse para mejorar aún más la legibilidad de la escala y se pueden personalizar de manera similar a las principales.
<IgrBulletGraph
height ="80px" width ="400px"
minimumValue ={0} value ={70}
maximumValue ={100} targetValue ={90}
interval ={10}
tickBrush ="DodgerBlue"
ticksPreTerminal ={0}
ticksPostInitial ={0}
tickStrokeThickness ={2}
tickStartExtent ={0.2}
tickEndExtent ={0.075}
minorTickCount ={4}
minorTickBrush ="DarkViolet"
minorTickEndExtent ={0.1}
minorTickStartExtent ={0.2}
minorTickStrokeThickness ={1} />
tsx
import React from 'react' ;
import ReactDOM from 'react-dom/client' ;
import './index.css' ;
import { IgrBulletGraph } from "@infragistics/igniteui-react-gauges" ;
import { IgrBulletGraphModule } from "@infragistics/igniteui-react-gauges" ;
IgrBulletGraphModule.register();
export default class BulletGraphTickmarks extends React.Component {
public render (): JSX .Element {
return (
<div className ="container sample" >
<IgrBulletGraph
height ="80px"
width ="100%"
minimumValue ={0} value ={70} interval ={10}
maximumValue ={100} targetValue ={90}
tickBrush ="DodgerBlue"
ticksPreTerminal ={0}
ticksPostInitial ={0}
tickStrokeThickness ={2}
tickStartExtent ={0.2}
tickEndExtent ={0.075}
minorTickCount ={4}
minorTickBrush ="DarkViolet"
minorTickEndExtent ={0.1}
minorTickStartExtent ={0.2}
minorTickStrokeThickness ={1} />
</div >
);
}
}
const root = ReactDOM.createRoot (document.getElementById('root' ));
root.render (<BulletGraphTickmarks /> );
tsx コピー
Etiquetas
Las etiquetas indican las medidas de la báscula.
<IgrBulletGraph
height ="80px" width ="400px"
minimumValue ={0} value ={70} interval ={10}
maximumValue ={100} targetValue ={90}
labelInterval ={10}
labelExtent ={0.025}
labelsPreTerminal ={0}
labelsPostInitial ={0}
fontBrush ="DodgerBlue"
font ="11px Verdana" />
tsx
import React from 'react' ;
import ReactDOM from 'react-dom/client' ;
import './index.css' ;
import { IgrBulletGraph } from "@infragistics/igniteui-react-gauges" ;
import { IgrBulletGraphModule } from "@infragistics/igniteui-react-gauges" ;
IgrBulletGraphModule.register();
export default class BulletGraphLabels extends React.Component {
public render (): JSX .Element {
return (
<div className ="container sample" >
<IgrBulletGraph
height ="80px"
width ="100%"
minimumValue ={0} value ={70} interval ={10}
maximumValue ={100} targetValue ={90}
labelInterval ={10}
labelExtent ={0.025}
labelsPreTerminal ={0}
labelsPostInitial ={0}
fontBrush ="DodgerBlue"
font ="11px Verdana" />
</div >
);
}
}
const root = ReactDOM.createRoot (document.getElementById('root' ));
root.render (<BulletGraphLabels /> );
tsx コピー
Apoyo
El elemento de respaldo representa el fondo y el borde del componente del gráfico de viñetas. Siempre es el primer elemento representado y el resto de elementos, como etiquetas y marcas, se superponen encima.
<IgrBulletGraph
height ="80px" width ="400px"
minimumValue ={0} value ={70} interval ={10}
maximumValue ={100} targetValue ={90}
backingBrush ="#bddcfc"
backingOutline ="DodgerBlue"
backingStrokeThickness ={4}
backingInnerExtent ={0}
backingOuterExtent ={1} />
tsx
import React from 'react' ;
import ReactDOM from 'react-dom/client' ;
import './index.css' ;
import { IgrBulletGraph } from "@infragistics/igniteui-react-gauges" ;
import { IgrBulletGraphModule } from "@infragistics/igniteui-react-gauges" ;
IgrBulletGraphModule.register();
export default class BulletGraphBackground extends React.Component {
public render (): JSX .Element {
return (
<div className ="container sample" >
<IgrBulletGraph
height ="80px"
width ="100%"
minimumValue ={0} value ={70} interval ={10}
maximumValue ={100} targetValue ={90}
backingBrush ="#bddcfc"
backingOutline ="DodgerBlue"
backingStrokeThickness ={4}
backingInnerExtent ={0}
backingOuterExtent ={1} />
</div >
);
}
}
const root = ReactDOM.createRoot (document.getElementById('root' ));
root.render (<BulletGraphBackground /> );
tsx コピー
Escala
La escala es un elemento visual que resalta toda la gama de valores del indicador. Puede personalizar la apariencia y la forma de la escala. La escala también se puede invertir (usando la propiedad isScaleInverted
) y todas las etiquetas se representarán de derecha a izquierda en lugar de de izquierda a derecha.
<IgrBulletGraph
height ="80px" width ="400px"
minimumValue ={0} value ={70} interval ={10}
maximumValue ={100} targetValue ={90}
isScaleInverted ={false}
scaleBackgroundBrush ="DodgerBlue"
scaleBackgroundOutline ="DarkViolet"
scaleBackgroundThickness ={2}
scaleStartExtent ={0.05}
scaleEndExtent ={0.95} />
tsx
import React from 'react' ;
import ReactDOM from 'react-dom/client' ;
import './index.css' ;
import { IgrBulletGraph } from "@infragistics/igniteui-react-gauges" ;
import { IgrBulletGraphModule } from "@infragistics/igniteui-react-gauges" ;
IgrBulletGraphModule.register();
export default class BulletGraphScale extends React.Component {
public render (): JSX .Element {
return (
<div className ="container sample" >
<IgrBulletGraph
height ="80px"
width ="100%"
minimumValue ={0} value ={70} interval ={10}
maximumValue ={100} targetValue ={90}
isScaleInverted ={false}
scaleBackgroundBrush ="DodgerBlue"
scaleBackgroundOutline ="Red"
scaleBackgroundThickness ={2}
scaleStartExtent ={0.05}
scaleEndExtent ={0.95} />
</div >
);
}
}
const root = ReactDOM.createRoot (document.getElementById('root' ));
root.render (<BulletGraphScale /> );
tsx コピー
Resumen
Para su comodidad, todos los fragmentos de código anteriores se combinan en un bloque de código a continuación que puede copiar fácilmente a su proyecto y ver el gráfico de viñetas con todas las funciones y elementos visuales habilitados.
<IgrBulletGraph
height ="80px" width ="400px"
minimumValue ={0}
maximumValue ={100}
isScaleInverted ={false}
scaleBackgroundBrush ="Gray"
scaleBackgroundOutline ="Gray"
scaleBackgroundThickness ={2}
scaleStartExtent ={0.05}
scaleEndExtent ={0.95}
value ={50}
valueBrush ="Black"
valueStrokeThickness ={1}
valueInnerExtent ={0.5}
valueOuterExtent ={0.65}
targetValue ={80}
targetValueBreadth ={7.5}
targetValueBrush ="Black"
targetValueOutline ="Black"
targetValueStrokeThickness ={1}
targetValueInnerExtent ={0.3}
targetValueOuterExtent ={0.85}
labelInterval ={10}
labelExtent ={0.025}
labelsPreTerminal ={0}
labelsPostInitial ={0}
fontBrush ="Black"
font ="11px Verdana"
backingBrush ="#cecece"
backingOutline ="#cecece"
backingStrokeThickness ={4}
backingInnerExtent ={0}
backingOuterExtent ={1}
interval ={10}
tickBrush ="Black"
ticksPreTerminal ={0}
ticksPostInitial ={0}
tickStrokeThickness ={2}
tickStartExtent ={0.2}
tickEndExtent ={0.075}
minorTickCount ={4}
minorTickBrush ="Black"
minorTickEndExtent ={0.1}
minorTickStartExtent ={0.2}
minorTickStrokeThickness ={1}
rangeBrushes ="#C62828, #F96232, #FF9800"
rangeOutlines ="#C62828, #F96232, #FF9800" >
<IgrLinearGraphRange
startValue ={20} endValue ={40}
innerStartExtent ={0.25} innerEndExtent ={0.25}
outerStartExtent ={0.9} outerEndExtent ={0.9} />
<IgrLinearGraphRange
startValue ={40} endValue ={60}
innerStartExtent ={0.25} innerEndExtent ={0.25}
outerStartExtent ={0.9} outerEndExtent ={0.9} />
<IgrLinearGraphRange
startValue ={60} endValue ={90}
innerStartExtent ={0.25} innerEndExtent ={0.25}
outerStartExtent ={0.9} outerEndExtent ={0.9} />
</IgrBulletGraph >
tsx
Referencias de API
La siguiente es una lista de miembros de API mencionados en las secciones anteriores:
Recursos adicionales
Puede encontrar más información sobre otros tipos de medidores en estos temas: