Pie charts: titles and data labels

Pie charts: titles and data labels

puml.online

简介 / Introduction

Pie charts visualize proportions of parts against a whole and are a staple of data visualization. This article compares PlantUML and Mermaid syntax for drawing pie charts with titles and data labels.

PlantUML version

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
@startuml
title Software Project Duration Distribution

skinparam titleFontSize 14
skinparam legendFontSize 12

skinparam pieTitleFontSize 16
skinparam pieTitleFontColor blue

skinparam pieVerticalLabelPosition 2
skinparam pieElementFontSize 11
skinparam pieElementFontColor black
skinparam pieBorderThickness 1

legend right
<color:blue>**Duration Distribution**</color>
Development 45%
Testing 25%
Deployment 15%
Documentation 15%
endlegend
@enduml

PlantUML uses title, a legend block, and multiple skinparam directives to control the title and labels. Data labels are embedded inside the legend rather than rendered directly on the chart.

Mermaid version

1
2
3
4
5
pie title Software Project Duration Distribution
"Development" : 45
"Testing" : 25
"Deployment" : 15
"Documentation" : 15

Mermaid’s syntax is minimal: pie + title + a list of key-value pairs. The title sits directly after the pie keyword with no extra skinparam needed.

对比 / Side-by-side

Feature PlantUML Mermaid
Title syntax title xxx pie title xxx
Data labels legend embedded text key : number pairs
Color control skinparam pieElementFontColor quoted labels
External legend legend right / left requires CSS override
Syntax complexity high (many skinparams) low (title line + data)

小结 / Wrap-up

PlantUML pie charts offer fine-grained control over fonts, colors, and legend placement — ideal when you need precise styling. Mermaid wins on brevity: one title line plus key-value pairs produces a clean chart immediately. Choose based on your team’s styling needs and chart complexity.

  • Title: Pie charts: titles and data labels
  • Author: puml.online
  • Created at : 2026-09-19 09:00:00
  • Updated at : 2026-09-29 01:06:38
  • Link: https://puml.online/blog/pie-chart-titles-en/
  • License: This work is licensed under CC BY-NC-SA 4.0.