Search results

User Interaction

Tooltip

Circular gauge will displays the pointer details through tooltip, when the mouse is moved over the pointer.

Enable Tooltip

By default, tooltip is not visible. Enable the tooltip by setting enable property to true and by injecting GaugeTooltip module into the services.

Note: To use tooltip, we need to refer the gauge CSS file in our web page. Tooltip CSS files are available in the ej2-circulargauge package folder. This can be referenced in your application using the following code.

[src/styles/styles.css]

@import '../../node_modules/@syncfusion/ej2-circulargauge/styles/material.css';
Source
Preview
index.tsx
import * as React from "react";
import * as ReactDOM from "react-dom";
import { CircularGaugeComponent, AxesDirective, AxisDirective, PointersDirective, PointerDirective, Inject, GaugeTooltip } from '@syncfusion/ej2-react-circulargauge';

class App extends React.Component<{}, {}>{
    render() {
        return  <CircularGaugeComponent id='circulargauge' tooltip= {{enable: true}}>
                  <Inject services={[ GaugeTooltip ]}/>
                  <AxesDirective>
                    <AxisDirective>
                      <PointersDirective>
                        <PointerDirective value = {70}></PointerDirective>
                      </PointersDirective>
                    </AxisDirective>
                  </AxesDirective>
                </CircularGaugeComponent>
    }
}
ReactDOM.render(<App />, document.getElementById('circulargauge'));

Template

Any HTML elements can be displayed in the tooltip by using the template property of the tooltip.

Source
Preview
index.tsx
import * as React from "react";
import * as ReactDOM from "react-dom";
import { CircularGaugeComponent, AxesDirective, AxisDirective, PointersDirective, PointerDirective, Inject, GaugeTooltip } from '@syncfusion/ej2-react-circulargauge';
ReactDOM.render(
  <CircularGaugeComponent id='circulargauge' tooltip= {{
        enable: true,
        template: '<div id="templateWrap"><div style="float: right; padding-left:10px; line-height:30px;"><span>Pointer &nbsp;&nbsp;:&nbsp; ${Math.round(pointers[0].value)}</span></div></div>'
    }}>
    <Inject services={[ GaugeTooltip ]}/>
    <AxesDirective>
      <AxisDirective>
        <PointersDirective>
            <PointerDirective value = {70}></PointerDirective>
        </PointersDirective>
      </AxisDirective>
    </AxesDirective>
  </CircularGaugeComponent>,document.getElementById('circulargauge'));

Pointer Drag

Pointers can be dragged over the axis value. This can be achieved by clicking and dragging the pointer. To enable or disable the pointer drag, you can use enablePointerDrag property.

Source
Preview
index.tsx
import * as React from "react";
import * as ReactDOM from "react-dom";
import { CircularGaugeComponent, AxesDirective, AxisDirective, PointersDirective, PointerDirective, Inject, GaugeTooltip } from '@syncfusion/ej2-react-circulargauge';
ReactDOM.render(
  <CircularGaugeComponent id='circulargauge' enablePointerDrag = {true} tooltip= {{
        enable: true,
        template: '<div id="templateWrap"><div style="float: right; padding-left:10px; line-height:30px;"><span>Pointer &nbsp;&nbsp;:&nbsp; ${Math.round(pointers[0].value)}</span></div></div>'
    }}>
    <Inject services={[ GaugeTooltip ]}/>
    <AxesDirective>
      <AxisDirective>
        <PointersDirective>
            <PointerDirective value = {70}></PointerDirective>
        </PointersDirective>
      </AxisDirective>
    </AxesDirective>
  </CircularGaugeComponent>,document.getElementById('circulargauge'));