- Dependencies
- Installation and configuration
- Add 3D Circular Chart to the project
Contact Support
Getting started
16 May 20257 minutes to read
This section explains you the steps required to create a simple 3D Circular Chart and demonstrate the basic usage of the 3D Circular Chart control.
Dependencies
Below is the list of minimum dependencies required to use the 3D Circular Chart component.
|-- @syncfusion/ej2-react-charts
|-- @syncfusion/ej2-base
|-- @syncfusion/ej2-data
|-- @syncfusion/ej2-charts
|-- @syncfusion/ej2-react-base
|-- @syncfusion/ej2-pdf-export
|-- @syncfusion/ej2-file-utils
|-- @syncfusion/ej2-compression
|-- @syncfusion/ej2-svg-base
Installation and configuration
To easily set up a React application, use create-vite-app
, which provides a faster development environment, smaller bundle sizes, and optimized builds compared to traditional tools like create-react-app
. For detailed steps, refer to the Vite installation instructions. Vite sets up your environment using JavaScript and optimizes your application for production.
Note: To create a React application using
create-react-app
, refer to this documentation for more details.
To create a new React application, run the following command.
npm create vite@latest my-app
To set-up a React application in TypeScript environment, run the following command.
npm create vite@latest my-app -- --template react-ts
cd my-app
npm run dev
To set-up a React application in JavaScript environment, run the following command.
npm create vite@latest my-app -- --template react
cd my-app
npm run dev
- Install Syncfusion® packages using below command.
npm install @syncfusion/ej2-react-charts --save
Add 3D Circular Chart to the project
Now, you can start adding 3D Circular Chart component in the application.
For getting started, add the 3D Circular Chart component in src/App.tsx
file using following code.
import { CircularChart3DComponent } from '@syncfusion/ej2-react-charts';
import * as React from 'react';
function App() {
return (<CircularChart3DComponent />);
}
export default App;
import { CircularChart3DComponent } from '@syncfusion/ej2-react-charts';
import * as React from 'react';
function App() {
return (<CircularChart3DComponent />);
}
export default App;
Pie Series
By default, the pie series will be rendered when assigning the JSON data to the series using the dataSource
property. Map the field names in the JSON data to the xName
and yName
properties of the series.
import { CircularChart3DComponent, CircularChart3DSeriesCollectionDirective, CircularChart3DSeriesDirective, PieSeries3D, CircularChartDataLabel3D, CircularChartLegend3D, Inject } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const circularData = [
{ x: 'Chrome', y: 62.92 },
{ x: 'Internet Explorer', y: 6.12 },
{ x: 'Opera', y: 3.15 },
{ x: 'Edge', y: 5.5 },
{ x: 'Safari', y: 19.97 },
{ x: 'Others', y: 2.34 }
];
return <CircularChart3DComponent id='charts' title='Browser Market Shares in November 2023' tilt={-45} legendSettings={{ visible: true, position: 'Right' }}>
<Inject services={[PieSeries3D, CircularChartDataLabel3D, CircularChartLegend3D]}/>
<CircularChart3DSeriesCollectionDirective>
<CircularChart3DSeriesDirective dataSource={circularData} xName='x' yName='y' dataLabel={{ visible: true, position: 'Outside', name: 'x', font: { fontWeight: '600' }, connectorStyle: { length: '40px' } }}>
</CircularChart3DSeriesDirective>
</CircularChart3DSeriesCollectionDirective>
</CircularChart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { CircularChart3DComponent, CircularChart3DSeriesCollectionDirective, CircularChart3DSeriesDirective, PieSeries3D, CircularChartDataLabel3D, CircularChartLegend3D, Inject } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const circularData: any[] = [
{ x: 'Chrome', y: 62.92 },
{ x: 'Internet Explorer', y: 6.12 },
{ x: 'Opera', y: 3.15 },
{ x: 'Edge', y: 5.5 },
{ x: 'Safari', y: 19.97 },
{ x: 'Others', y: 2.34 }
];
return <CircularChart3DComponent id='charts' title='Browser Market Shares in November 2023' tilt={-45} legendSettings={{ visible: true, position: 'Right' }}>
<Inject services={[PieSeries3D, CircularChartDataLabel3D, CircularChartLegend3D]}/>
<CircularChart3DSeriesCollectionDirective>
<CircularChart3DSeriesDirective dataSource={circularData} xName='x' yName='y' dataLabel={{ visible: true, position: 'Outside', name: 'x', font: { fontWeight: '600' }, connectorStyle: { length: '40px' } }}>
</CircularChart3DSeriesDirective>
</CircularChart3DSeriesCollectionDirective>
</CircularChart3DComponent>
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Now run the npm run dev
command in the console to start the development server. This command compiles your code and serves the application locally, opening it in the browser.
npm run dev