Legend in React 3D Chart control
10 Jan 202424 minutes to read
Legend provides information about the series rendered in the 3D chart.
Position and alignment
By using the position
property, the legend can be positioned at left, right, top or bottom of the 3D chart. The legend is positioned at the bottom of the 3D chart, by default.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
The custom position helps you to position the legend anywhere in the 3D chart using x and y coordinates.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
const legend = {
visible: true,
location: { x: 200, y: 20 },
position:'Custom'
};
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings = {legend} wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
const legend = {
visible: true,
location: { x: 200, y: 20 },
position:'Custom'
};
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings = {legend} wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Legend reverse
The order of the legend items can be reversed by using the reverse
property. By default, legend for the first series in the collection will be placed first.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Legend alignment
The legend can be aligned at near, far or center to the 3D chart using the alignment
property.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Legend customization
To change the legend icon shape, legendShape
property in the series
can be used. By default, the legend icon shape is seriesType
.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' legendShape="Circle" name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' legendShape="SeriesType" name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' legendShape="Rectangle" name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' legendShape="Circle" name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' legendShape="SeriesType" name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' legendShape="Rectangle" name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Legend size
By default, legend takes 20% - 25% of the 3D chart’s height horizontally, when it is placed on top or bottom position and 20% - 25% of the 3D chart’s width vertically, when it is placed on left or right position. You can change this default legend size by using the height
and width
properties of the legendSettings
.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
const legend = {
visible: true,
width: '500', height: '100',
border: { width: 1, color: 'pink'}
};
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings = {legend} wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
const legend = {
visible: true,
width: '500', height: '100',
border: { width: 1, color: 'pink'}
};
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings = {legend} wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Legend item size
The size of the legend items can be customised by using the shapeHeight
and shapeWidth
properties.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' legendShape="Circle" name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' legendShape="Circle" name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' legendShape="Circle" name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' legendShape="Circle" name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' legendShape="Circle" name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' legendShape="Circle" name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Paging for legend
Paging will be enabled by default, when the legend items exceeds the legend bounds. Each legend items can be viewed by navigating between the pages using navigation buttons.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
const legend = {
padding: 10, shapePadding: 10,
visible: true, border: {
width: 2, color: 'grey'
},
width: '200'
};
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings = {legend} wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
const legend = {
padding: 10, shapePadding: 10,
visible: true, border: {
width: 2, color: 'grey'
},
width: '200'
};
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings = {legend} wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Legend text wrap
When the legend text exceeds the container, the text can be wrapped by using the textWrap
property. End user can also wrap the legend text based on the maximumLabelWidth
property.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Series selection through legend
By default, you can collapse the series visibility by clicking the legend. On the other hand, turn off the toggleVisibility
property if you must use a legend click to choose a series.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Collapsing legend item
By default, series name will be displayed as legend. To skip the legend for a particular series, you can give empty string to the series name.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Legend title
You can set title for legend using title
property in legendSettings
. The size
, color
, opacity
, fontStyle
, fontWeight
, fontFamily
, textAlignment
, and textOverflow
of legend title can be customized by using the titleStyle
property in legendSettings
. The titlePosition
is used to set the legend position in Top
, Left
and Right
position. The maximumTitleWidth
is used to set the width of the legend title. By default, it will be 100px
.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ country: "USA", gold: 50, silver: 70, bronze: 45 },
{ country: "China", gold: 40, silver: 60, bronze: 55 },
{ country: "Japan", gold: 70, silver: 60, bronze: 50 },
{ country: "Australia", gold: 60, silver: 56, bronze: 40 },
{ country: "France", gold: 50, silver: 45, bronze: 35 },
{ country: "Germany", gold: 40, silver: 30, bronze: 22 },
{ country: "Italy", gold: 40, silver: 35, bronze: 37 },
{ country: "Sweden", gold: 30, silver: 25, bronze: 27 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='country' yName='gold' name="Gold" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='silver' name="Silver" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='country' yName='bronze' name="Bronze" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Arrow page navigation
The page number will always be visible while using legend paging. It is now possible to disable the page number and enable page navigation with the left and right arrows. The enablePages
property needs to be set to false in order to render the arrow page navigation.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ x: 'WW', y: 12, y1: 22, y2: 38.3, y3: 50 },
{ x: 'EU', y: 9.9, y1: 26, y2: 45.2, y3: 63.6 },
{ x: 'APAC', y: 4.4, y1: 9.3, y2: 18.2, y3: 20.9 },
{ x: 'LATAM', y: 6.4, y1: 28, y2: 46.7, y3: 65.1 },
{ x: 'MEA', y: 30, y1: 45.7, y2: 61.5, y3: 73 },
{ x: 'NA', y: 25.3, y1: 35.9, y2: 64, y3: 81.4 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y' name="December 2007" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y1' name="December 2008" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y2' name="December 2009" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y3' name="December 2010" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ x: 'WW', y: 12, y1: 22, y2: 38.3, y3: 50 },
{ x: 'EU', y: 9.9, y1: 26, y2: 45.2, y3: 63.6 },
{ x: 'APAC', y: 4.4, y1: 9.3, y2: 18.2, y3: 20.9 },
{ x: 'LATAM', y: 6.4, y1: 28, y2: 46.7, y3: 65.1 },
{ x: 'MEA', y: 30, y1: 45.7, y2: 61.5, y3: 73 },
{ x: 'NA', y: 25.3, y1: 35.9, y2: 64, y3: 81.4 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y' name="December 2007" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y1' name="December 2008" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y2' name="December 2009" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y3' name="December 2010" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Legend item padding
The itemPadding
property can be used to adjust the space between the legend items.
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ x: 'WW', y: 12, y1: 22, y2: 38.3, y3: 50 },
{ x: 'EU', y: 9.9, y1: 26, y2: 45.2, y3: 63.6 },
{ x: 'APAC', y: 4.4, y1: 9.3, y2: 18.2, y3: 20.9 },
{ x: 'LATAM', y: 6.4, y1: 28, y2: 46.7, y3: 65.1 },
{ x: 'MEA', y: 30, y1: 45.7, y2: 61.5, y3: 73 },
{ x: 'NA', y: 25.3, y1: 35.9, y2: 64, y3: 81.4 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y' name="December 2007" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y1' name="December 2008" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y2' name="December 2009" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y3' name="December 2010" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
}
;
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
import { Chart3DComponent, Chart3DSeriesCollectionDirective, Chart3DSeriesDirective, Category3D, Inject, Legend3D, DataLabel3D, Tooltip3D, ColumnSeries3D, Highlight3D } from '@syncfusion/ej2-react-charts';
import * as React from "react";
import * as ReactDOM from "react-dom";
function App() {
const data = [
{ x: 'WW', y: 12, y1: 22, y2: 38.3, y3: 50 },
{ x: 'EU', y: 9.9, y1: 26, y2: 45.2, y3: 63.6 },
{ x: 'APAC', y: 4.4, y1: 9.3, y2: 18.2, y3: 20.9 },
{ x: 'LATAM', y: 6.4, y1: 28, y2: 46.7, y3: 65.1 },
{ x: 'MEA', y: 30, y1: 45.7, y2: 61.5, y3: 73 },
{ x: 'NA', y: 25.3, y1: 35.9, y2: 64, y3: 81.4 }
];
return <Chart3DComponent id='charts'
primaryXAxis=
legendSettings=
wallColor='transparent'
enableRotation={true} rotation={7} tilt={10} depth={100}>
<Inject services={[ColumnSeries3D, Category3D, Legend3D, Tooltip3D, DataLabel3D, Highlight3D]} />
<Chart3DSeriesCollectionDirective >
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y' name="December 2007" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y1' name="December 2008" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y2' name="December 2009" type='Column'>
</Chart3DSeriesDirective>
<Chart3DSeriesDirective dataSource={data} xName='x' yName='y3' name="December 2010" type='Column'>
</Chart3DSeriesDirective>
</Chart3DSeriesCollectionDirective>
</Chart3DComponent>;
};
export default App;
ReactDOM.render(<App />, document.getElementById("charts"));
Note: To use the legend feature, we need to inject the
Legend3D
module into the services.