Getting started

18 Mar 20246 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

You can use create-react-app to setup the applications.
To install create-react-app run the following command.

    npm install -g create-react-app
  • To set-up a React application in TypeScript environment, run the following command.

       create-react-app quickstart --template typescript
       cd quickstart
       npm start
    
  • To set-up a React application in JavaScript environment, run the following command.
      create-react-app quickstart
      cd quickstart
      npm start
    
  • 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 start command in the console, it will run your application and open the browser window.

npm start