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 - Doughnut with Top N Series

In this example, the PieChart component displays only top N values and aggregates the remainder into the others category.

www.wikipedia.org
Backend API
<template> <DxPieChart id="pie" :data-source="internetLanguages" type="doughnut" title="Top Internet Languages" palette="Soft Pastel" > <DxSeries argument-field="language" value-field="percent" > <DxSmallValuesGrouping :top-count="3" mode="topN" /> <DxLabel :visible="true" :customize-text="customizeLabel" format="fixedPoint" > <DxConnector :visible="true" :width="1" /> </DxLabel> </DxSeries> <DxExport :enabled="true"/> <DxLegend horizontal-alignment="center" vertical-alignment="bottom" /> </DxPieChart> </template> <script setup lang="ts"> import DxPieChart, { DxSmallValuesGrouping, DxLegend, DxSeries, DxLabel, DxConnector, DxExport, } from 'devextreme-vue/pie-chart'; import { internetLanguages } from './data.ts'; const customizeLabel = ({ argumentText, valueText }: { argumentText: string; valueText: string }) => `${argumentText}: ${valueText}%`; </script> <style> #pie { height: 440px; } </style>
export const internetLanguages = [{ language: 'English', percent: 55.5, }, { language: 'Chinese', percent: 4.0, }, { language: 'Spanish', percent: 4.3, }, { language: 'Japanese', percent: 4.9, }, { language: 'Portuguese', percent: 2.3, }, { language: 'German', percent: 5.6, }, { language: 'French', percent: 3.8, }, { language: 'Russian', percent: 6.3, }, { language: 'Italian', percent: 1.6, }, { language: 'Polish', percent: 1.8, }];
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>