Gauges Overview

The Gauges provide a set of React components for building common gauge types.

Basic Usage

The following example demonstrates the Arc, Linear, and Radial Gauges in action.

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {
    ArcGauge,
    LinearGauge,
    RadialGauge
} from '@progress/kendo-react-gauges';

const DemoContainer = ({ heading, children }) =>
    (<div><h1>{heading}</h1>{children}</div>);

const value = 30;
const pointer = {
    value: value
};

const arcCenterRenderer = (currentValue, color) => {
    return (<h3 style={{ color: color }}>{currentValue}%</h3>);
};

const gaugeStyles = {
    display: 'block'
};

const GaugeContainer = () => (
    <DemoContainer heading="Gauges demos">
        <div className="row">
            <div className="col-sm-12 col-md-2">
                <LinearGauge style={gaugeStyles} pointer={pointer} />
            </div>
            <div className="col-sm-12 col-md-5">
                <RadialGauge style={gaugeStyles} pointer={pointer} />
            </div>
            <div className="col-sm-12 col-md-5">
                <ArcGauge style={gaugeStyles} value={value} arcCenterRender={arcCenterRenderer} />
            </div>
        </div>
    </DemoContainer>
);

ReactDOM.render(
    <GaugeContainer />,
    document.querySelector('my-app')
);

Installation

  1. Download and install the package. Use Node.js v5.0.0 or later.

    npm install --save @progress/kendo-react-gauges @progress/kendo-drawing @progress/kendo-react-intl
  2. Once installed, import the package module.

    // ES2015 module syntax
    import { ArcGauge, LinearGauge, RadialGauge } from '@progress/kendo-react-gauges';
    // CommonJS format
    const { ArcGauge, LinearGauge, RadialGauge } = require('@progress/kendo-react-gauges');
  3. You are required to install one of the Kendo UI themes to style your components. For more information on how to add the styles, refer to the article on getting started.

Dependencies

The Gauges package requires you to install the following peer dependencies in your application:

  • react
  • react-dom
  • @progress/kendo-react-intl
  • @progress/kendo-drawing

The following dependencies are automatically installed:

  • @progress/kendo-react-common
  • @progress/kendo-charts
  • prop-types

In this article