React Funnel - Rearrange Legend Items
Although the legend's layout is virtually universal, in some cases, you may need to slightly adjust it, for example, rearrange legend items. You can learn how to do it from the following instructions.
Choose legend orientation
Depending on whether the legend is oriented vertically or horizontally, the Funnel arranges legend items in columns or in rows. To change the legend orientation, use the orientation property.App.js- import React from 'react';
- import Funnel, { Legend } from 'devextreme-react/funnel';
- export default function App() {
- return (
- <Funnel ... >
- <Legend
- orientation="vertical" {/* or "horizontal" */}
- />
- </Funnel>
- );
- }
NOTETo center a horizontally-oriented legend, assign "center" to the horizontalAlignment property. For details on the legend's location, refer to the Relocate the Legend topic.Set the number of columns or rows
To distribute all legend items between several columns (in a vertically-oriented legend) or rows (in a horizontally-oriented legend), set the columnCount or rowCount property respectively.
- import React from 'react';
- import Funnel, { Legend } from 'devextreme-react/funnel';
- export default function App() {
- return (
- <Funnel ... >
- <Legend
- columnCount={3}
- {/* rowCount={2} */}
- />
- </Funnel>
- );
- }
- Adjust the empty space between columns and rows
Regardless of the legend orientation, you can adjust the empty space between columns and rows using the columnItemSpacing and rowItemSpacing properties respectively.
- import React from 'react';
- import Funnel, { Legend } from 'devextreme-react/funnel';
- export default function App() {
- return (
- <Funnel ... >
- <Legend
- columnItemSpacing={20}
- rowItemSpacing={30}
- />
- </Funnel>
- );
- }
Below, you can try out all the mentioned properties in action.