[Feature] Support for LLM-optimized Declarative Protocol (ECharts-Lite) in Markdown/JSON

未关闭
#21,592 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
冷清
技术栈
json, markdown, typescript

调研方向

Start with the proposed echarts.renderLite(dom, liteOption, theme) entry point and the echarts-lite/v1 schema described in the issue. Define the Markdown/JSON input and strict validation boundaries, then trace how chart types and dataset dimensions should expand into an ECharts option. Done means a consistent protocol with smart defaults and clear validation errors.

由索引模型根据 Issue 内容生成。

描述

en new-feature pending
What problem does this feature solve?

[Context & Rationale]
With the rapid integration of Large Language Models (LLMs) into data analysis and BI tools, ECharts has become a primary target for AI-generated visualizations. However, there is a significant "impedance mismatch" between LLM outputs and the current ECharts option structure. The existing API, while powerful and comprehensive, is highly verbose for LLMs, leading to frequent "hallucinations" in nested JSON structures, high token consumption, and instability in rendering styling details.

[End User Experience]
The goal is to enable a "Zero-Config" experience for AI-native applications. Developers should be able to pass a simplified, intent-based Markdown or JSON structure directly from the LLM to ECharts. The renderer should intelligently handle the "boilerplate" (like tooltips, basic axis styling, and grid layouts) based on the chart type and data, allowing the LLM to focus solely on the data and the high-level visual intent.

[Why it cannot be easily dealt with existing APIs]
While users can write custom "translation" layers, every developer is currently reinventing the wheel. A fragmented ecosystem of "ECharts-Lite" parsers leads to inconsistent user experiences across different AI platforms. By introducing a standardized, declarative "Lite" protocol within the ECharts ecosystem, we can:

Lower the barrier for AI agents to interact with ECharts.

Optimize performance by reducing the payload size in LLM streaming.

Ensure visual consistency by separating data (from LLM) and theme/style (from the developer/ECharts defaults).

What does the proposed API look like?

We propose a Simplified Declarative Schema (e.g., echarts-lite) that can be used either as a standalone JSON or within a Markdown code block. This schema prioritizes a flat structure and the dataset component.

Proposed Schema Example:

JSON
{
"protocol": "echarts-lite/v1",
"type": "line",
"title": "User Growth Trend",
"data": [
["Month", "Users", "Retention"],
["2025-01", 150, 0.85],
["2025-02", 230, 0.82],
["2025-03", 224, 0.88]
],
"options": {
"smooth": true,
"stack": false,
"showSymbol": "auto"
},
"enhance": ["tooltip", "legend", "toolbox"]
}
Implementation Suggestion:
A new static method or a lightweight plugin, e.g., echarts.renderLite(dom, liteOption, theme), which:

Expands the lite protocol into a full echarts.option object internally.

Injects smart defaults for missing UI configurations (e.g., automatically generating series based on the data dimensions).

Validates the input using a strict JSON Schema to provide clear error messages for LLM debugging.

主要语言
TypeScript
星标
67.7k
派生
19.9k
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/echarts 的其他 Issue

查看 apache/echarts 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。