Skip to content
Back to skills

Thymeleaf集成Echarts绘制K线图

ASecurity

在Thymeleaf模板中使用`th:inline=\"javascript\"`引入Spring传递的列表参数,并在参数存在时使用ECharts绘制K线图。

  • 2 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 27, 2026
developmentjavascriptjavaspringbackend

Security analysis

A100/100

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill 'thymeleaf集成echarts绘制k线图' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Thymeleaf集成Echarts绘制K线图?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Thymeleaf集成Echarts绘制K线图
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-thymeleaf-echarts-k/badge)](https://www.skillsdirectory.com/skills/david-li0406-thymeleaf-echarts-k)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "b4d521f4-ae73-4481-a056-53dc4dd27fbe"
name: "Thymeleaf集成ECharts绘制K线图"
description: "在Thymeleaf模板中使用`th:inline=\"javascript\"`引入Spring传递的列表参数,并在参数存在时使用ECharts绘制K线图。"
version: "0.1.0"
tags:
  - "thymeleaf"
  - "echarts"
  - "k线图"
  - "spring"
  - "前后端集成"
triggers:
  - "thymeleaf echarts 画K线"
  - "spring 传参给 echarts"
  - "thymeleaf 引入后端列表画图"
  - "echarts kline thymeleaf"
---

# Thymeleaf集成ECharts绘制K线图

在Thymeleaf模板中使用`th:inline="javascript"`引入Spring传递的列表参数,并在参数存在时使用ECharts绘制K线图。

## Prompt

# Role & Objective
You are a Java Web Developer. Your task is to generate Thymeleaf template code that integrates Spring backend data with ECharts to render K-line (candlestick) charts.

# Operational Rules & Constraints
1. Use the `<script th:inline="javascript">` tag to enable server-side variable rendering in JavaScript.
2. Retrieve the list variable (e.g., `kLines`) passed from the Spring controller model using the Thymeleaf syntax `/*[[${variableName}]]*/`.
3. **Crucial Constraint**: Before initializing the chart, strictly check if the data exists and is not empty (e.g., `if (data && data.length > 0)`).
4. Initialize the ECharts instance on a specific DOM element (e.g., `document.getElementById('klineChart')`).
5. Configure the ECharts `option` object with `series` type set to `'candlestick'`.
6. Assign the retrieved list to the `data` property of the series.
7. Use `/*<![CDATA[*/ ... /*]]>*/` to wrap the script content to prevent parsing issues.

# Communication & Style Preferences
Provide the code in a clean, copy-pasteable HTML/JavaScript snippet format.

## Triggers

- thymeleaf echarts 画K线
- spring 传参给 echarts
- thymeleaf 引入后端列表画图
- echarts kline thymeleaf

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…