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 Selection

This demo illustrates how a user can select slices on the PieChart component with the doughnut series type.

www.wikipedia.org
Backend API
<template> <DxPieChart id="pie" :data-source="olympicMedals" type="doughnut" title="Olympic Medals in 2008" palette="Soft Pastel" @point-click="pointClickHandler" > <DxSeries argument-field="country" value-field="medals" > <DxHoverStyle color="#ffd700"/> </DxSeries> <DxExport :enabled="true"/> <DxLegend :margin="0" horizontal-alignment="right" vertical-alignment="top" /> </DxPieChart> </template> <script setup lang="ts"> import DxPieChart, { DxLegend, DxSeries, DxExport, DxHoverStyle, } from 'devextreme-vue/pie-chart'; import { olympicMedals } from './data.ts'; function pointClickHandler({ target }: { target: { select: () => void } }): void { target.select(); } </script> <style> #pie { height: 440px; } </style>
export const olympicMedals = [{ country: 'USA', medals: 110, }, { country: 'China', medals: 100, }, { country: 'Russia', medals: 72, }, { country: 'Britain', medals: 47, }, { country: 'Australia', medals: 46, }, { country: 'Germany', medals: 41, }, { country: 'France', medals: 40, }, { country: 'South Korea', medals: 31, }];
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>