DevExtreme v26.1 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

Vue Charts - Equal Size Pies

To display multiple PieChart components that share series and legend settings, you can use a v-for notation to iterate through every PieChart option.

Backend API
<template> <div class="pies-container"> <DxPieChart v-for="(options, index) in pieCharts" :key="index" :data-source="options.dataSource" :title="options.title" :palette="options.palette" class="pie" size-group="piesGroup" > <DxSeries argument-field="name" value-field="area" > <DxLabel :visible="true" format="percent" /> </DxSeries> <DxLegend :row-count="2" vertical-alignment="bottom" horizontal-alignment="center" item-text-position="right" /> </DxPieChart> </div> </template> <script setup lang="ts"> import DxPieChart, { DxSeries, DxLabel, DxLegend, type DxPieChartTypes, } from 'devextreme-vue/pie-chart'; import { countries, waterLandRatio } from './data.ts'; const pieCharts: { title: string, palette: DxPieChartTypes.Palette, dataSource: { name: string, area: number }[], }[] = [{ title: 'Area of Countries', palette: 'Soft', dataSource: countries, }, { title: 'Water/Land Ratio', palette: 'Soft Pastel', dataSource: waterLandRatio, }]; </script> <style> .pies-container { margin: auto; width: 800px; } .pies-container > .pie { width: 400px; float: left; } </style>
export const waterLandRatio = [{ name: 'Land', area: 0.29, }, { name: 'Water', area: 0.71, }]; export const countries = [{ name: 'Russia', area: 0.12, }, { name: 'Canada', area: 0.07, }, { name: 'USA', area: 0.07, }, { name: 'China', area: 0.07, }, { name: 'Brazil', area: 0.06, }, { name: 'Australia', area: 0.05, }, { name: 'India', area: 0.02, }, { name: 'Others', area: 0.55, }];
import { createApp } from 'vue'; import App from './App.vue'; createApp(App).mount('#app');
<!DOCTYPE html> <html lang="en"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/26.1.5/css/dx.light.css" /> <link rel="stylesheet" type="text/css" href="./bundle.css" /> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="app"> </div> </div> <script src="bundles/vendor/vue.vendor.js"></script> <script src="./bundle.js"></script> </body> </html>

When you display PieChart components side by side, their pies may differ in size. You can join all charts into a size group to resize these pies to match each other. To do so, set the sizeGroup property of every chart to the same value.