Skip to content

Commit

Permalink
更新echarts渲染方式svg和canvas区别
Browse files Browse the repository at this point in the history
  • Loading branch information
onresize committed Jul 8, 2024
1 parent e52597e commit 77ec6f1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/.vuepress/config/silder.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ export default [
link: '/技术总结/',
collapsible: true,
children: [
'/技术总结/踩坑总结/一个项目安装不同版本的依赖包',
'/技术总结/踩坑总结/MIME类型',
'/技术总结/踩坑总结/一个项目安装不同版本的依赖包',
'/技术总结/踩坑总结/echarts两种渲染方式的应用场景',
'/技术总结/踩坑总结/React.Fragment和空标签的区别',
'/技术总结/踩坑总结/React常用的内置hooks',
'/技术总结/踩坑总结/react的状态管理',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
title: echarts两种渲染方式的应用场景
lang: zh-CN
feed:
enable: true
description: echarts两种渲染方式的应用场景
---

> 本文作者:[onresize](https://github.com/onresize)

### echarts渲染方式svg和canvas区别
- ECharts 支持使用 SVG 和 Canvas 两种方式来渲染图表。

`SVG 方式渲染图表:`
- 优点:SVG 图像可以被搜索引擎搜索、放大缩小而不影响质量、支持无限放大。
- 缺点:在移动设备上的性能不如 Canvas。

`Canvas 方式渲染图表:`
- 优点:在移动设备上性能更好,支持复杂的动画和过渡效果。
- 缺点:Canvas 生成的图像不能被搜索引擎搜索,放大或缩小可能会失真。

你可以在初始化 ECharts 实例时通过设置 renderer 参数来指定使用哪种渲染方式:
```js
var myChart = echarts.init(domElement, null, { renderer: 'canvas' });
// 或者
var myChart = echarts.init(domElement, null, { renderer: 'svg' });
```

0 comments on commit 77ec6f1

Please sign in to comment.