Skip to content

Data Visualization and Dashboards

Preface

A good chart is worth a thousand rows of data. Data visualization transforms abstract numbers into intuitive visual representations, allowing people to understand the story behind the data in seconds. From Excel charts to Grafana monitoring dashboards, visualization is everywhere.

What will you learn in this article?

After completing this chapter, you will gain:

  • Chart Selection: Choose the most appropriate chart type based on your data purpose
  • Visualization Principles: Master the core design principles of data visualization
  • Dashboard Design: Understand layout patterns for different types of dashboards
  • Tool Ecosystem: Familiarize yourself with the positioning and selection of mainstream visualization tools
  • Common Pitfalls: Avoid misleading charts and common visualization mistakes
ChapterContentKey Concepts
Chapter 1Chart Type SelectionComparison, trends, proportions, distributions, relationships
Chapter 2Visualization Design PrinciplesData-ink ratio, consistency, readability
Chapter 3Dashboard LayoutOverview, comparison, drill-down, real-time
Chapter 4Tool SelectionECharts, D3, Grafana, Metabase
Chapter 5Common PitfallsTruncated axes, 3D pie charts, color misuse

0. The Big Picture: Why Visualization Matters

The human brain processes visual information much faster than text. A line chart lets you quickly see that "sales dropped last month," while the same information presented in a table might require row-by-row comparison to reach the same conclusion.

The core value of visualization:

  • Discover patterns: Trends, cycles, and outliers are immediately apparent in charts
  • Support decision-making: Enable non-technical people to understand data and participate in decisions
  • Communication efficiency: A picture is worth a thousand words, reducing ambiguity in data interpretation

Visualization ≠ Pretty

The goal of visualization is to convey information, not to show off. A plain but accurate bar chart is far more valuable than a flashy but hard-to-understand 3D chart.


1. Chart Type Selection: Tell the Right Story with the Right Chart

The first step in choosing a chart is not "what chart do I like," but "what information do I want to convey." Different data purposes correspond to different optimal chart types.

图表类型选择器
选择你的数据目的,查看推荐的图表类型
📊
比较
📈
趋势
🍩
占比
🔔
分布
🕸️
关系
比较:推荐图表
▐▐▐
柱状图
比较不同类别的数值大小
示例:各部门销售额对比
▐▐ ▐▐
分组柱状图
多维度分组比较
示例:各季度各产品线收入
雷达图
多维度综合对比
示例:候选人能力评估

Chart Selection Quick Reference

Data PurposeRecommended ChartNot RecommendedReason
Compare magnitudesBar chart, Column chartPie chartThe human eye is more sensitive to length differences than angle differences
Show trendsLine chart, Area chartBar chartThe continuity of a line implies temporal continuity
Show proportionsPie chart (≤5 categories), Stacked bar chart3D pie chart3D perspective distorts area proportions
Show distributionsHistogram, Box plotLine chartDistributions require viewing frequency, not trends
Show relationshipsScatter plot, Bubble chartBar chartThe relationship between two continuous variables requires two-dimensional space

A Simple Decision Rule

  • One variable → Histogram (distribution) or number card (KPI)
  • Two variables → Line chart (time vs. value) or scatter plot (value vs. value)
  • Multiple categories → Bar chart (comparison) or pie chart (proportion, ≤5 categories)
  • Multiple dimensions → Radar chart or parallel coordinates plot

2. Visualization Design Principles: Let the Data Speak

Good visualization is not about being "pretty" but about being "understandable." Several classic principles proposed by Edward Tufte in The Visual Display of Quantitative Information remain important references for visualization design today.

PrincipleDescriptionAnti-pattern
Data-ink ratioThe proportion of "ink" used to display data in a chart should be as high as possibleExcessive gridlines, decorative elements
Minimize non-data elementsRemove visual elements that convey no information3D effects, shadows, gradient backgrounds
Consistent scaleStart axes from zero with uniform tick marks; if truncating an axis, clearly indicate itY-axis starting at 95 without explanation
Sensible color useUse color to encode information, not for decorationRainbow colors for ordinal data
Clear labelingTitle, axis labels, legend, and units are all indispensableNo units, no time range

2.1 Data-Ink Ratio

The proportion of "ink" used to express data in a chart relative to the total "ink" should be as high as possible.

Simply put: remove everything that doesn't convey information.

Should RemoveShould Keep
3D effects, shadows, gradientsData points, axis labels
Excessive gridlinesKey reference lines (e.g., target values)
Decorative iconsLegends (when there are multiple series)
Flashy background colorsClear titles and units

2.2 Consistency Principle

  • Color consistency: Use the same color for the same dimension across different charts, e.g., "revenue" is always blue
  • Scale consistency: Axes should start from 0 whenever possible, unless there's a good reason and clear annotation
  • Time consistency: Intervals on the time axis should be uniform; don't plot unevenly spaced time points as if they were evenly spaced

2.3 Readability Principle

  • Titles should state conclusions: Not "Monthly Sales" but "Sales Have Declined for 3 Consecutive Months"
  • Annotate key points: Add annotations at outliers and inflection points to guide the reader's attention
  • Control information density: Each chart should convey 1-2 core messages; don't cram too much in

Three Rules for Color Use

  1. Same metric, same color: Revenue should always be blue across all charts, not sometimes blue and sometimes green
  2. Sequential data uses gradients: Temperature from low to high uses a blue→red gradient, not discrete colors
  3. Consider colorblind-friendliness: Approximately 8% of males have red-green color blindness; avoid relying solely on red and green to distinguish critical information

3. Dashboard Layout: Different Scenarios, Different Patterns

A dashboard is an organic combination of multiple charts. A good dashboard doesn't just pile charts together—it selects an appropriate layout pattern based on the use case.

仪表盘布局模式
点击查看不同类型的仪表盘布局
全局概览型
对比分析型
下钻分析型
实时监控型
全局概览型
顶部核心指标卡片 + 中间趋势图 + 底部明细表
DAU 12.5万
收入 ¥85万
转化率 3.2%
客单价 ¥268
趋势折线图
明细数据表
适用场景:管理层日报、运营大盘

Four Common Layout Patterns

Layout PatternCore StructureUse CaseDesign Points
OverviewKPI cards + trend charts + detail tablesExecutive daily reports, operations dashboardsPlace core metrics at the top; key numbers visible at a glance
Comparison analysisSymmetric left-right layoutA/B testing, year-over-year analysisKeep comparison dimensions consistent, highlight differences
Drill-down analysisProgressive expansion from summary to detailSales analysis, user behavior analysisSupport click interactions, layer-by-layer exploration
Real-time monitoringLarge numbers + real-time curves + alert statusDouble Eleven big screens, server monitoringAuto-refresh, dark background, suitable for projection

5 Principles of Dashboard Design

  1. First ask "who is looking": The CEO views strategic metrics, operations views process metrics, engineers view technical metrics
  2. 5-second rule: Users should understand the dashboard's core information within 5 seconds
  3. Information hierarchy: Place the most important content in the upper-left, secondary content below
  4. Minimize scrolling: Display core content on one screen; avoid making users scroll to see critical data
  5. Whitespace: Don't fill every inch of space; appropriate whitespace makes the visual experience more comfortable

Dashboard vs. Report

  • Dashboard: Real-time/near-real-time, interactive, oriented toward monitoring and quick decision-making
  • Report: Generated periodically (daily/weekly/monthly), static, oriented toward detailed analysis and archival

These two are not replacements for each other but complements. Dashboards identify problems; reports analyze them in depth.


4. Tool Selection: From Code Libraries to BI Platforms

Visualization tools can be divided into three tiers: code-level chart libraries, data analysis chart libraries, and BI platforms. Which one to choose depends on requirements complexity, interaction needs, and team technical capabilities.

4.1 Code-Level Chart Libraries

ToolLanguage/PlatformFeaturesUse Case
EChartsJavaScriptReady to use, rich chart types, excellent documentationEmbedded charts in business systems
D3.jsJavaScriptLow-level flexibility, can customize any visualizationHighly customized data visualization
Chart.jsJavaScriptLightweight and simple, quick to get startedSimple chart requirements
MatplotlibPythonStandard scientific computing library, static chartsData analysis, paper figures
PlotlyPython/JSInteractive charts, 3D supportData exploration, Jupyter Notebook

4.2 BI Platforms (No-Code / Low-Code)

ToolPositioningCore StrengthSuitable Team
GrafanaMonitoring visualizationStrong time-series support, alerting integrationOps/SRE teams
MetabaseLightweight BIOpen source and free, create charts from SQLSmall to mid teams building quickly
Apache SupersetEnterprise BIOpen source, supports big data sourcesCompanies with data teams
TableauCommercial BIDrag-and-drop, excellent visualizationBusiness analysts
Power BICommercial BIStrong integration with Microsoft ecosystemEnterprises using the Microsoft stack

Selection Advice

  • Developers embedding charts in products → ECharts or Chart.js (for simple scenarios)
  • Data analysts doing exploratory analysis → Plotly + Jupyter or Metabase
  • Ops monitoring dashboards → Grafana (the de facto standard)
  • Business teams doing self-service analytics → Metabase (open source) or Tableau (commercial)
  • Need high customization → D3.js (steep learning curve, but most flexible)

5. Common Pitfalls: These Charts Are Lying to You

Data visualization is a double-edged sword: used well, it reveals truth; used poorly, it creates illusions. Below are the most common visualization pitfalls that every data practitioner should be able to recognize.

5.1 Truncated Axes

Changing the Y-axis starting point from 0 to a large number makes tiny differences look like massive changes.

ScenarioActual DifferenceVisual Perception
Y-axis starts at 0Product A: 98 points, Product B: 95 pointsSmall gap
Y-axis starts at 90Same dataA appears to be several times larger than B

When is truncation acceptable? When absolute values are large but changes are small (e.g., stock price from 100 to 105), truncation is reasonable, but it must be clearly labeled.

5.2 The 3D Pie Chart Perspective Trap

3D perspective makes sectors closer to the viewer appear larger. A 25% sector can look like 35% under a 3D viewing angle.

Solution: Never use 3D pie charts. Use regular pie charts or donut charts, or simply use bar charts.

5.3 Color Misuse

Wrong PracticeCorrect Practice
Using red-green to represent dataUsing blue-orange and other colorblind-safe palettes
Different colors for each categoryUsing shades of the same color family for the same series
Encoding continuous data with color but no legendAlways provide a color legend and value labels
Insufficient contrast between background and data colorsEnsure WCAG AA level contrast

5.4 Other Common Mistakes

PitfallProblemFix
Dual Y-axesTwo unrelated metrics sharing the X-axis implies causationSplit into two charts, or explicitly state no causal relationship
Area misrepresentationUsing a circle's radius instead of area to represent valuesWhen values double, area should double, not radius
Uneven time axisJanuary, March, and December spaced equallyArrange by actual time proportions
Too many categoriesPie chart with 15 sectorsUse bar charts for more than 5 categories, or group into "Other"

Ethical Guidelines for Visualization

The purpose of visualization is to aid understanding, not to manipulate perception. Ask yourself every time you create a chart:

  • If I were the reader, would this chart lead me to a wrong conclusion?
  • Am I hiding unfavorable data?
  • Are the axes, scales, and colors presenting the data fairly?

Summary

Data visualization is the "last mile" of delivering data value. No matter how good the analysis is, if it cannot be correctly understood, it's as if the analysis never happened.

Let's review the key takeaways from this chapter:

  1. Choose the right chart: Select chart types based on data purpose (comparison, trends, proportions, distributions, relationships)
  2. Design principles: High data-ink ratio, consistency, and readability are the three core principles
  3. Dashboard layout: Overview, comparison, drill-down, and real-time patterns cover most scenarios
  4. Tool selection: From ECharts to Grafana, choose based on team capability and requirements complexity
  5. Avoid pitfalls: Truncated axes, 3D pie charts, and color misuse are the most common misleading techniques

Further Reading