Contents
- Orientation
- Right-to-left (RTL)
- Animation
- Theme
Having trouble getting help?
Contact Support
Contact Support
Customization in React Bullet chart component
20 Jan 202319 minutes to read
Orientation
The Bullet Chart can be rendered in different orientations such as Horizontal or Vertical via the orientation
property. By default, the Bullet Chart is rendered in the Horizontal orientation.
import { BulletChartComponent } from '@syncfusion/ej2-react-charts';
import { BulletRangeCollectionDirective, BulletRangeDirective } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
return (<BulletChartComponent id='ranges' animation={{ enable: false }} valueField='value' targetField='target' title='Sales Rate in dollars' width='20%' orientation='vertical' minimum={0} maximum={100} interval={20} dataSource={[{ value: 55, target: 45 }]}>
<BulletRangeCollectionDirective>
<BulletRangeDirective end={35}></BulletRangeDirective>
<BulletRangeDirective end={50}></BulletRangeDirective>
<BulletRangeDirective end={100}></BulletRangeDirective>
</BulletRangeCollectionDirective>
</BulletChartComponent>);
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { BulletChartComponent, Inject} from '@syncfusion/ej2-react-charts';
import { BulletRangeCollectionDirective, BulletRangeDirective} from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
return (<BulletChartComponent id='ranges'
animation={{ enable: false }}
valueField='value'
targetField='target'
title='Sales Rate in dollars'
width='20%'
orientation='vertical'
minimum={0}
maximum={100}
interval={20}
dataSource={[{value: 55, target: 45}]}>
<BulletRangeCollectionDirective>
<BulletRangeDirective end={35}></BulletRangeDirective>
<BulletRangeDirective end={50}></BulletRangeDirective>
<BulletRangeDirective end={100}></BulletRangeDirective>
</BulletRangeCollectionDirective>
</BulletChartComponent>);
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Right-to-left (RTL)
The Bullet Chart supports the right-to-left rendering that can be enabled by setting the enableRtl
property to true.
import { BulletChartComponent } from '@syncfusion/ej2-react-charts';
import { BulletRangeCollectionDirective, BulletRangeDirective } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
return (<BulletChartComponent id='ranges' animation={{ enable: false }} valueField='value' targetField='target' enableRtl={true} minimum={0} maximum={2000} interval={200} dataSource={[{ value: 1500, target: 1000 }]}>
<BulletRangeCollectionDirective>
<BulletRangeDirective end={500} color='red'></BulletRangeDirective>
<BulletRangeDirective end={1500} color='blue'></BulletRangeDirective>
<BulletRangeDirective end={2000} color='green'></BulletRangeDirective>
</BulletRangeCollectionDirective>
</BulletChartComponent>);
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { BulletChartComponent, Inject} from '@syncfusion/ej2-react-charts';
import { BulletRangeCollectionDirective, BulletRangeDirective} from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
return (<BulletChartComponent id='ranges'
animation={{ enable: false }}
valueField='value'
targetField='target'
enableRtl={true}
minimum={0}
maximum={2000}
interval={200}
dataSource={[{value: 1500, target: 1000}]}>
<BulletRangeCollectionDirective>
<BulletRangeDirective end={500} color='red' ></BulletRangeDirective>
<BulletRangeDirective end={1500} color='blue'></BulletRangeDirective>
<BulletRangeDirective end={2000} color='green'></BulletRangeDirective>
</BulletRangeCollectionDirective>
</BulletChartComponent>);
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Animation
The actual and the target bar supports the linear animation via the animation
setting. The speed and the delay are controlled using the duration
and delay
properties respectively.
import { BulletChartComponent } from '@syncfusion/ej2-react-charts';
import { BulletRangeCollectionDirective, BulletRangeDirective } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
return (<BulletChartComponent id='ranges' animation={{ enable: true }} valueField='value' targetField='target' minimum={0} maximum={2000} interval={200} dataSource={[{ value: 1500, target: 1000 }]}>
<BulletRangeCollectionDirective>
<BulletRangeDirective end={500} color='red'></BulletRangeDirective>
<BulletRangeDirective end={1500} color='blue'></BulletRangeDirective>
<BulletRangeDirective end={2000} color='green'></BulletRangeDirective>
</BulletRangeCollectionDirective>
</BulletChartComponent>);
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { BulletChartComponent, Inject} from '@syncfusion/ej2-react-charts';
import { BulletRangeCollectionDirective, BulletRangeDirective} from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
return (<BulletChartComponent id='ranges'
animation={{ enable: true }}
valueField='value'
targetField='target'
minimum={0}
maximum={2000}
interval={200}
dataSource={[{value: 1500, target: 1000}]}>
<BulletRangeCollectionDirective>
<BulletRangeDirective end={500} color='red' ></BulletRangeDirective>
<BulletRangeDirective end={1500} color='blue'></BulletRangeDirective>
<BulletRangeDirective end={2000} color='green'></BulletRangeDirective>
</BulletRangeCollectionDirective>
</BulletChartComponent>);
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Theme
The Bullet Chart supports different type of themes via the theme
property.
import { BulletChartComponent } from '@syncfusion/ej2-react-charts';
import { BulletRangeCollectionDirective, BulletRangeDirective } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
return (<BulletChartComponent id='ranges' animation={{ enable: false }} valueField='value' targetField='target' title='Profit in %' theme='HighContrast' minimum={0} maximum={100} interval={10} dataSource={[{ value: 50, target: 45 }]}>
<BulletRangeCollectionDirective>
<BulletRangeDirective end={15} color='red'></BulletRangeDirective>
<BulletRangeDirective end={50} color='blue'></BulletRangeDirective>
<BulletRangeDirective end={100} color='green'></BulletRangeDirective>
</BulletRangeCollectionDirective>
</BulletChartComponent>);
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { BulletChartComponent, Inject} from '@syncfusion/ej2-react-charts';
import { BulletRangeCollectionDirective, BulletRangeDirective} from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
return (<BulletChartComponent id='ranges'
animation={{ enable: false }}
valueField='value'
targetField='target'
title='Profit in %'
theme='HighContrast'
minimum={0}
maximum={100}
interval={10}
dataSource={[{value: 50, target: 45}]}>
<BulletRangeCollectionDirective>
<BulletRangeDirective end={15} color='red' ></BulletRangeDirective>
<BulletRangeDirective end={50} color='blue'></BulletRangeDirective>
<BulletRangeDirective end={100} color='green'></BulletRangeDirective>
</BulletRangeCollectionDirective>
</BulletChartComponent>);
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));