Chart Donut

Overview

The VApexChartDonut component renders a donut chart using the vue3-apexcharts library. This component accepts various props to customize the chart's appearance, including data, labels, font size, colors, and a title.

Usage

This component uses the vue3-apexcharts library, which must be installed in your project. If not already added, you can install it using:

bash
yarn add @apexcharts/apexcharts vue3-apexcharts

Import the VApexChartDonut component into your Vue file:

vue
import VApexChartDonut from 'UiKit/components/VApexChartDonut/VApexChartDonut.vue';

Include the component in your template like this:

vue
<VApexChartDonut
  :data="[20, 30, 25, 15, 10]"
  :labels="['Label 1', 'Label 2', 'Label 3', 'Label 4', 'Label 5']"
  fontSize="12px"
  :colors="['#FF5733', '#33FF57', '#3357FF', '#FF33A1', '#FFD633']"
  title="Donut Chart Example"
/>

Props

NameTypeDefault ValueDescription
datanumber[][]Array of data values for the chart.
labelsstring[][]Array of label names corresponding to the data values.
fontSizestring'10px'Font size for the donut chart's value labels.
colorsstring[]['#004FFF', '#3DDC97', '#FF7070', '#6F3DFD', '#FFC24D']Array of color codes for the chart segments.
titlestringN/ATitle to be displayed above the chart.

Example Usage

vue
<VApexChartDonut
  :data="[20, 30, 25, 15, 10]"
  :labels="['Label 1', 'Label 2', 'Label 3', 'Label 4', 'Label 5']"
  fontSize="12px"
  :colors="['#FF5733', '#33FF57', '#3357FF', '#FF33A1', '#FFD633']"
  title="Donut Chart Example"
/>

Problems

  • Customizing the chart for new visual requirements may require extending or modifying the component's core properties or computed options.
  • Complex customizations may necessitate overriding ApexCharts' default configurations.

Advantages

  • Leverages vue3-apexcharts for robust charting capabilities and a responsive layout.
  • Offers flexibility for future visual adjustments using props without requiring external CSS changes.
Help Ukraine to stop russian aggression