Share
Save
data
bind
style
animate
AI
code
info
settings
EN
Chart Info

樹狀圖

樹狀圖(Treemap,也常稱矩形樹狀圖)把一個大矩形切成許多小矩形,每塊的面積與數值成正比。小矩形可以依分類嵌套在較大的群組裡,同一張圖就能看出每個項目的大小,以及它屬於哪個類別。

在 makechart.io 線上做圖不用安裝軟體:貼上或上傳表格,對應面積、名稱與分類層級的欄位,版面會自動排好。再調整顏色、標籤與圖例,就能匯出圖片或分享連結。

設定資料
貼上、上傳資料,或用範例資料開始製作這張圖表。

資料格式

每一列是一個項目,需要名稱和一個代表面積的數值。對應一或多個分類欄位,就能把項目分組嵌套:第一個分類是最上層,之後的是下一層。

欄位型態
面積
必填
數值
每個矩形的大小。數值應為正數,面積無法表示負值。
名稱
必填
文字或分類
每個矩形的標籤,例如產品或檔案名稱。
分類
選填
分類(可一或多欄)
分組的層級。由大到小依序對應多個欄位,就能形成階層。
顏色
選填
數值或分類
矩形的顏色。分類會給不同顏色,數值會套用漸層色階。
範例
地區國家名稱人口
亞洲日本東京37.4
亞洲日本大阪19.1
亞洲印度德里31.0
歐洲法國巴黎11.0
歐洲英國倫敦9.3

適合的使用時機

  • 呈現總量由許多部分組成,例如各部門、各計畫的預算分配。
  • 有兩、三層的階層資料,例如大類、小類到單一產品。
  • 在有限的版面裡,從數十到數百個項目中找出最大的幾個。
  • 硬碟空間使用量、市值或投資組合的組成。

不適合的情況

  • 需要精確比較數值時:人對長度的判斷比面積準確,長條圖會更好。
  • 資料有負值或接近零的值,無法用面積表示。
  • 呈現隨時間的變化,這時改用折線圖或堆積面積圖。

使用技巧

  • 「分類」對應多個欄位,矩形就會分層嵌套;只對應一欄則是單層的樹狀圖。
  • 在「樣式」面板打開 zoom,可以點進某個群組,往下查看更細的層級。

相關圖表

Treemap

A treemap fills a rectangle with smaller rectangles whose areas are proportional to their values. Rectangles can be nested inside larger groups, so a single view shows both how big each item is and which category it belongs to.

makechart.io is a chart maker that runs in your browser: paste or upload your table, bind the columns for area, name and category levels, and the treemap is laid out for you. Tune colors, labels and the legend, then export it as an image or share a link.

Set up data
Paste, upload or pick sample data to make this chart.

Data format

One row per item. Give each row a name and a numeric value for its area. Bind one or more category columns to nest items into groups; the first category is the top level, the next ones are sub-levels.

FieldType
面積
required
Number
Size of each rectangle (the area dimension). Values should be positive, since area cannot be negative.
名稱
required
Text or category
Label of each rectangle, such as a product or file name.
分類
optional
Category (one or more columns)
Grouping levels. Bind several columns, from the broadest to the most detailed, to build a hierarchy.
顏色
optional
Number or category
Color of each rectangle. A category gives distinct colors, a number gives a color scale.
Example
regioncountrynamevalue
AsiaJapanTokyo37.4
AsiaJapanOsaka19.1
AsiaIndiaDelhi31.0
EuropeFranceParis11.0
EuropeUKLondon9.3

When to use

  • Showing how a total splits into many parts, such as a budget by department and program.
  • Hierarchical data with two or three levels, like category, subcategory and product.
  • Spotting the largest items among dozens or hundreds of entries in limited space.
  • Disk usage, market capitalization or portfolio breakdowns.

When not to use

  • Comparing values precisely; people judge lengths better than areas, so a bar chart is more accurate.
  • Data with negative values or values close to zero, which cannot be drawn as areas.
  • Showing change over time; use a line or stacked area chart instead.

Tips

  • Bind several columns to 分類 to nest the rectangles; leave it with one column for a flat treemap.
  • Turn on zoom in the Style panel to click into a group and explore deeper levels.

Related charts

bind
Auto Bind
Clear
no dimension
Reset
no style
no matching style

s
%
code
Loading