数据可视化变现教程:让数据说话
为什么学数据可视化
商业价值:
- 帮企业做数据Dashboard:¥5000-20000/个
- 数据报告服务:¥1000-5000/份
- BI系统搭建:¥10000-50000/套
- 数据分析培训:¥3000/天
你的优势: 你已有大量数据(工具统计、小说字数、课程数量、API调用次数)。把这些数据可视化 = 展示你的实力。
工具对比
| 工具 | 类型 | 适合场景 | 学习成本 |
|---|---|---|---|
| Matplotlib | Python | 科研图表 | 低 |
| Plotly | Python | 交互式图表 | 中 |
| ECharts | JS | Web可视化 | 中 |
| Streamlit | Python | 快速Dashboard | 低 |
| Grafana | 开源 | 监控面板 | 中 |
| Metabase | 开源 | BI工具 | 低 |
快速上手:Streamlit Dashboard
安装
pip install streamlit plotly pandas
你的工具Dashboard
import streamlit as st
import plotly.express as px
import pandas as pd
st.set_page_config(page_title="我的工具矩阵", layout="wide")
st.title("🛠️ AI工具矩阵 Dashboard")
# 工具数据
tools_data = {
"类别": ["安全", "安全", "逆向", "逆向", "开发", "开发", "办公", "办公"],
"工具": ["burp-pro", "nessus-free", "decompiler", "binary-ninja",
"large-file", "data-recovery", "cleaner-free", "file-search"],
"代码行数": [6068, 4714, 5703, 3627, 1821, 5409, 2360, 1568],
"MCP工具数": [10, 8, 9, 8, 6, 8, 6, 6],
"状态": ["完成", "完成", "完成", "完成", "完成", "完成", "完成", "完成"],
}
df = pd.DataFrame(tools_data)
# 布局
col1, col2, col3, col4 = st.columns(4)
col1.metric("工具总数", "82+")
col2.metric("代码总行数", "222,493")
col3.metric("MCP工具函数", "90+")
col4.metric("课程数", "28")
# 图表
st.subheader("工具代码行数分布")
fig = px.bar(df, x="工具", y="代码行数", color="类别",
title="各工具代码行数")
st.plotly_chart(fig, use_container_width=True)
st.subheader("工具类别分布")
fig2 = px.pie(df, names="类别", values="代码行数",
title="按类别代码行数占比")
st.plotly_chart(fig2, use_container_width=True)
# 运行:streamlit run dashboard.py
小说数据Dashboard
import streamlit as st
import plotly.express as px
import pandas as pd
st.title("📚 小说创作 Dashboard")
novels = {
"小说": ["硅与火", "星尘纪", "意识之海", "熵之塔", "永生之种"],
"章节数": [15, 15, 17, 19, 16],
"字数(万字)": [19.8, 17.3, 25.3, 31.2, 25.1],
"状态": ["完成", "完成", "完成", "完成", "完成"],
}
df = pd.DataFrame(novels)
col1, col2, col3 = st.columns(3)
col1.metric("小说总数", "5部")
col2.metric("总字数", "118.7万字")
col3.metric("总章节数", "82章")
fig = px.bar(df, x="小说", y="字数(万字)", color="小说",
title="各小说字数")
st.plotly_chart(fig, use_container_width=True)
fig2 = px.pie(df, names="小说", values="字数(万字)",
title="字数占比")
st.plotly_chart(fig2, use_container_width=True)
高级可视化:ECharts
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/echarts@5/dist/echarts.min.js"></script>
</head>
<body>
<div id="chart" style="width: 800px; height: 600px;"></div>
<script>
var chart = echarts.init(document.getElementById('chart'));
var option = {
title: { text: 'AI工具矩阵' },
tooltip: {},
xAxis: {
data: ["burp-pro", "nessus", "decompiler", "binary-ninja",
"data-recovery", "cleaner", "file-search", "hex-editor"]
},
yAxis: {},
series: [{
name: '代码行数',
type: 'bar',
data: [6068, 4714, 5703, 3627, 5409, 2360, 1568, 3967],
itemStyle: {
color: function(params) {
var colors = ['#5470c6', '#91cc75', '#fac858', '#ee6666',
'#73c0de', '#3ba272', '#fc8452', '#9a60b4'];
return colors[params.dataIndex];
}
}
}]
};
chart.setOption(option);
</script>
</body>
</html>
商业化方案
数据Dashboard服务
客户需求:实时数据监控+可视化
报价:¥5000-20000/个
包含:
├── 数据接入(API/数据库/文件)
├── Dashboard设计(图表+布局)
├── 实时更新(WebSocket/轮询)
├── 移动端适配
└── 部署+维护
数据报告服务
客户需求:定期数据报告
报价:¥1000-5000/份
包含:
├── 数据采集+清洗
├── 分析+洞察
├── 可视化图表
├── 结论+建议
└── PDF/PPT格式
与你的工具结合
# 把你的82个工具做成可视化展示
@mcp.tool()
async def generate_tool_dashboard() -> str:
"""生成工具矩阵Dashboard"""
import os
tools = []
for d in os.listdir("/root/tools"):
path = f"/root/tools/{d}"
if os.path.isdir(path):
# 统计代码行数
lines = 0
for f in os.listdir(path):
if f.endswith(".py"):
with open(f"{path}/{f}") as fp:
lines += len(fp.readlines())
tools.append({"name": d, "lines": lines})
# 生成HTML Dashboard
html = "<html><head><script src='https://cdn.jsdelivr.net/npm/echarts@5'></script></head>"
html += "<body><div id='chart' style='width:100%;height:600px'></div>"
html += "<script>var c=echarts.init(document.getElementById('chart'));"
html += f"c.setOption({{xAxis:{{data:{[t['name'] for t in tools]}}},series:[{{data:{[t['lines'] for t in tools]}}}]}});</script></body></html>"
return html
月收入预估
Dashboard服务:
├── 3个/月 × ¥8000 = ¥24000
├── 维护客户 × ¥2000/月 = ¥6000
└── 总计:¥30000/月
数据报告:
├── 10份/月 × ¥2000 = ¥20000
└── 总计:¥20000/月
你的82个工具的数据就是最好的Dashboard案例。
评论