主题
饼图
¥Pie chart diagrams
饼图(或圆形图)是一种圆形统计图形,将其划分为多个切片以说明数字比例。在饼图中,每个切片的弧长(及其中心角和面积)与其表示的数量成正比。虽然它因其类似于切片的馅饼而得名,但它的渲染方式却有多种变化。已知最早的饼图通常归功于 William Playfair 于 1801 年发布的统计手册 - 维基百科
¥A pie chart (or a circle chart) is a circular statistical graphic, which is divided into slices to illustrate numerical proportion. In a pie chart, the arc length of each slice (and consequently its central angle and area), is proportional to the quantity it represents. While it is named for its resemblance to a pie which has been sliced, there are variations on the way it can be presented. The earliest known pie chart is generally credited to William Playfair's Statistical Breviary of 1801 -Wikipedia
Mermaid 可以渲染饼图。
¥Mermaid can render Pie Chart diagrams.
语法
¥Syntax
在 Mermaid 中绘制饼图非常简单。
¥Drawing a pie chart is really simple in mermaid.
以
pie
关键字开始绘制图表¥Start with
pie
keyword to begin the diagramshowData
在图例文本之后渲染实际数据值。这是可选的¥
showData
to render the actual data values after the legend text. This is OPTIONAL
后面跟着
title
关键字及其字符串值,为饼图提供标题。这是可选的¥Followed by
title
keyword and its value in string to give a title to the pie-chart. This is OPTIONAL接下来是数据集。饼图切片将按与标签相同的顺序顺时针排序。
¥Followed by dataSet. Pie slices will be ordered clockwise in the same order as the labels.
label
表示饼图中" "
引号内的部分。¥
label
for a section in the pie diagram within" "
quotes.后跟
:
冒号作为分隔符¥Followed by
:
colon as separator后面跟着
positive numeric value
(支持最多两位小数)¥Followed by
positive numeric value
(supported up to two decimal places)
[饼图] [显示数据](可选)[标题] [标题值](可选) "[数据键 1]" : [dataValue1] "[数据键 2]" : [dataValue2] "[数据键 3]" : [dataValue3] 。 。
¥[pie] [showData] (OPTIONAL) [title] [titlevalue] (OPTIONAL) "[datakey1]" : [dataValue1] "[datakey2]" : [dataValue2] "[datakey3]" : [dataValue3] . .
示例
¥Example
配置
¥Configuration
可能的饼图配置参数:
¥Possible pie diagram configuration parameters:
参数 | 描述 | 默认值 |
---|---|---|
textPosition | 饼图切片标签的轴向位置,从中心的 0.0 到圆外边缘的 1.0。 | 0.75 |