编写数据请求代码:
controller层:
@Api(tags = "测试接口")
@ApiSort(value = 4)
@RestController
@RequestMapping
@Slf4j
public class TestController {
@Autowired
private ZrFsElesService zrFsElesService;
@GetMapping("/test")
@ApiOperation(value = "测试echarts画图", httpMethod = "GET")
public Result first(){
return zrFsElesService.queryDataHistoryList("1", "2023-01-01 00:00:00", "2024-03-01 00:00:00");
}
}
实现层 略
在resource文件夹下创建static
编写html文件
<!doctype html>
<html lang="

本文介绍了如何在SpringBoot的Controller层中创建一个用于获取数据的API接口,并利用ECharts库在前端动态渲染折线图。代码展示了如何从API获取数据并更新图表内容。
最低0.47元/天 解锁文章
5024

被折叠的 条评论
为什么被折叠?



