Stacked Chart Visualization logo

Stacked Chart Visualization

OrganizationPopular
OpenSenseNova
stacked-chart-visualization

处理包含百分比字符串的分类占比数据,通过补全缺失维度并生成堆叠柱状图,直观展示多维度构成随时间或分类的变化趋势。

Overview

PublisherOpenSenseNova
RepositorySenseNova-Skills
Skill namestacked-chart-visualization
Stars
5.6K
Forks
392
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by OpenSenseNova on GitHub. Read the source before you install it.

Installation

Install the Stacked Chart Visualization AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/OpenSenseNova/SenseNova-Skills.git /tmp/SenseNova-Skills
mkdir -p .claude/skills
cp -r /tmp/SenseNova-Skills/skills/sn-da-excel-workflow/capability/excel-data-visualization/stacked-chart-visualization .claude/skills/stacked-chart-visualization
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Stacked Chart Visualization in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Stacked Chart Visualization on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Stacked Chart Visualization is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Stacked_Chart_Visualization

Step1 定义百分比转换函数并提取原始数据。通过正则表达式或字符串处理将百分比格式转换为可计算的浮点数。

python
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

# 配置中文字体,确保图表标签正常显示
plt.rcParams['font.sans-serif'] = ['SimHei', 'DejaVu Sans']
plt.rcParams['axes.unicode_minus'] = False

def convert_percentage(val):
    """
    将百分比字符串转换为浮点数。
    处理逻辑:去除百分号并转换为 float,若已经是数值则直接返回。
    """
    if isinstance(val, str):
        return float(val.strip('%'))
    return val

# 示例数据提取逻辑(实际应用中替换为从 DataFrame 提取)
time_labels = ['1月', '2月', '3月', '4月', '5月', '6月'] # 泛化时间轴
cat1_raw = ['23.21%', '22.98%', '24.31%', '24.53%', '23.84%', '24.80%']
cat2_raw = ['25.17%', '25.67%', '25.77%', '25.98%', '25.17%', '25.61%']
cat3_raw = ['28.12%', '28.37%', '26.58%', '25.83%', '26.49%', '25.17%']

cat1_ratios = [convert_percentage(x) for x in cat1_raw]
cat2_ratios = [convert_percentage(x) for x in cat2_raw]
cat3_ratios = [convert_percentage(x) for x in cat3_raw]

Step2 构建结构化数据表,将清洗后的数值整合进 DataFrame 以便进行向量化计算。

python
# 构建包含时间维度和各分类占比的结构化数据表
df = pd.DataFrame({
    'group_col': time_labels,
    'cat_1': cat1_ratios,
    'cat_2': cat2_ratios,
    'cat_3': cat3_ratios
})

Step3 计算缺失维度的占比。在已知部分维度占比的情况下,通过总和 100% 的约束推算剩余维度的数值,并进行数据校验。

python
# 计算已知维度的总占比
target_cols = ['cat_1', 'cat_2', 'cat_3']
df['current_total'] = df[target_cols].sum(axis=1)

# 推算剩余维度(如“其他”或特定分类)的占比
df['cat_remainder'] = 100 - df['current_total']

# 验证数据完整性:确保所有维度相加接近 100
df['final_check'] = df[target_cols + ['cat_remainder']].sum(axis=1)

Step4 使用堆叠柱状图进行可视化。核心在于利用 bottom 参数逐层累加高度,并优化图表美学配置。

python
# 设置绘图风格与画布
plt.figure(figsize=(12, 6), dpi=100)
sns.set_style('whitegrid')

# 核心堆叠逻辑:每一层的 bottom 是前几层高度的总和
plt.bar(df['group_col'], df['cat_1'], label='分类1', color='#5DADE2')
plt.bar(df['group_col'], df['cat_2'], bottom=df['cat_1'], label='分类2', color='#58D68D')
plt.bar(df['group_col'], df['cat_3'], bottom=df['cat_1'] + df['cat_2'], label='分类3', color='#EC7063')
plt.bar(df['group_col'], df['cat_remainder'], bottom=df['cat_1'] + df['cat_2'] + df['cat_3'], label='其他', color='#F4D03F')

# 图表辅助元素优化
plt.xlabel('统计周期')
plt.ylabel('占比 (%)')
plt.title('多维度占比变化趋势分析')
plt.legend(loc='upper right', bbox_to_anchor=(1.1, 1))
plt.xticks(rotation=45) # 避免标签重叠
plt.tight_layout()

Step5 导出分析结果。将生成的图表保存为高分辨率图片,并清理内存。

python
# 保存图表,设置 dpi 确保清晰度,bbox_inches 确保标签不被截断
output_path = 'stacked_ratio_analysis.png'
plt.savefig(output_path, dpi=300, bbox_inches='tight')
plt.show()
plt.close()

Frequently asked questions

What does the Stacked Chart Visualization AI skill do?

处理包含百分比字符串的分类占比数据,通过补全缺失维度并生成堆叠柱状图,直观展示多维度构成随时间或分类的变化趋势。

Why use Stacked Chart Visualization on TypingMind?

Because you install it once and use it with any model. Stacked Chart Visualization is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Stacked Chart Visualization in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/OpenSenseNova/SenseNova-Skills/tree/main/skills/sn-da-excel-workflow/capability/excel-data-visualization/stacked-chart-visualization. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Stacked Chart Visualization?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Stacked Chart Visualization?

As many as you like. As long as a model supports skills, you can use Stacked Chart Visualization with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Stacked Chart Visualization AI skill free?

Yes. It is published on GitHub by OpenSenseNova under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇