1.什么是echats?
ECharts是一款基于JavaScript的数据可视化图表库,提供直观,生动,可交互,可个性化定制的数据可视化图表。 ECharts最初由百度团队开源,并于2018年初捐赠给Apache基金会,成为ASF孵化级项目。 2021年1月26日晚,Apache基金会官方宣布ECharts项目正式毕业。
2.代码工程
实验目的
实现股票日K线图
pom.xml
springboot-demo
com.et
1.0-SNAPSHOT
4.0.0
echarts
8
8
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-autoconfigure
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-starter-thymeleaf
org.projectlombok
lombok
controller
访问根目录,跳转到首页
package com.et.echats.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HelloWorldController {
@RequestMapping("/")
public String index()
{
return"index";
}
}
index.html
常量data0 可以通过接口从后端获取,这里直接用静态数据
flask+echarts项目
application.yaml
spring.thymeleaf.cache=false
spring.thymeleaf.suffix=.html
以上只是一些关键代码,所有代码请参见下面代码仓库
代码仓库
- https://github.com/Harries/springboot-demo
3.测试
- 启动Spring Boot应用
- 访问http://127.0.0.1:8080/
4.引用
- https://echarts.apache.org/handbook/en/basics/release-note/v5-feature/