Commit 6f9fb590 authored by chenghong_tao's avatar chenghong_tao

update readme and add try catch

parent b856ece6
......@@ -10,6 +10,10 @@ npm install
```bash
npm run dev
```
3. 打包项目
```bash
npm run build
```
## 主题
主题文件在`src/theme`中,你可以根据需要修改主题文件,然后重启项目即可生效。
......
......@@ -40,17 +40,29 @@ md.use((md) => {
nextTick(() => {
const chartDom = document.getElementById(chartId);
if (chartDom) {
const myChart = init(chartDom);
const option = JSON.parse(token.content.trim());
// 调整 ECharts 图表的标题文字大小
if (option.title && option.title.text) {
option.title.textStyle = {
fontSize: 12, // 设置标题文字大小为 16px
};
try {
const myChart = init(chartDom);
const option = JSON.parse(token.content.trim());
// 调整 ECharts 图表的标题文字大小
if (option.title && option.title.text) {
option.title.textStyle = {
fontSize: 14, // 设置标题文字大小为 16px
};
}
if (option.legend) {
option.legend.bottom = 0
}
if (option.grid) {
option.grid.containLabel = true
} else {
option.grid = { containLabel: true }
}
myChart.setOption(option);
} catch (error) {
console.error("Error rendering chart:", error);
}
myChart.setOption(option);
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment