Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:图表的宽度和高度根据外部容器宽高自适应 #85

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/cw/cw_echarts_library/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 1.0.5

Associated Task: [#283415](https://projectmanage.netease-official.lcap.163yun.com/dashboard/TaskDetail?id=2834156332085760)

### ✨Features

- [c4b5bd9](https://github.com/vusion/cloud-ui-materials/commit/c4b5bd953fa23ff9f591ef09d84bfaa27e35d6bd) Thanks [wangxue08](https://github.com/wangxue08) ! - 图表的宽度和高度根据外部容器宽高自适应

## 1.0.4

Associated Task: [#281100](https://projectmanage.netease-official.lcap.163yun.com/dashboard/TaskDetail?id=2811004089143552)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,6 @@
default: true
description: 允许用户设置保存图片
group: 图表功能
- name: width
title: 宽度
type: string
default: 380px
description: 设置图宽度
group: 图表基础
- name: height
title: 高度
type: string
default: 300px
description: 设置图高度
group: 图表基础
- name: formatter
title: 标签内容格式器
type: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div :class="$style.root" ref="room">
<div :class="$style.container" border :style="size">
<div :class="$style.container" border>
<echart-bar
v-if="!loading"
:axisData="axisData"
Expand All @@ -11,7 +11,7 @@
ref="echart"
@clickItem="$emit('clickItem', $event)"
></echart-bar>
<div v-else :style="size">
<div v-else>
<img :src="require('../../assets/barEmpty.png')" :class="$style.emptyImage">
</div>
</div>
Expand All @@ -33,8 +33,6 @@ export default {
props: {
dataSource: [Function, Array, Object],
theme: {type: String, default: 'theme1'},
width: {type: String, default: '340px'},
height: {type: String, default: '300px'},
xAxis: {type: String, default: ''},
yAxis: {type: String, default: ''},
xAxisTitle: {type: String, default: 'X轴标题'},
Expand Down Expand Up @@ -108,12 +106,6 @@ export default {
}
},
computed: {
size() {
return {
width: this.width,
height: this.height,
}
},
axisData() {
return {
xAxis: this.xAxis,
Expand Down Expand Up @@ -222,6 +214,10 @@ export default {
<style module>
.root {
display: inline-block;
> div {
width: 100%;
height: 100%;
}
}

.container[border] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,6 @@
type: Array<Item> | Function | object | DataSource
designer-value: '[{}, {}, {}]'
description: 表格的数据源,数据集对象或者返回数据集的逻辑
- name: width
title: 宽度
type: string
default: 380px
description: 设置图宽度
group: 图表基础
- name: height
title: 高度
type: string
default: 300px
description: 设置图高度
group: 图表基础
- name: formatter
title: 标签内容格式器
type: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div :class="$style.root" ref="room">
<div :class="$style.container" border :style="size">
<div :class="$style.container" border>
<echart-basic
v-if="!loading"
:sourceData="sourceData"
Expand Down Expand Up @@ -31,8 +31,6 @@ export default {
props: {
dataSource: [Function, Array, Object],
options: {type: Object, default: () => ({})},
width: {type: String, default: '380px'},
height: {type: String, default: '300px'},
},
data() {
return {
Expand All @@ -43,14 +41,6 @@ export default {
created() {
this.init();
},
computed: {
size() {
return {
width: this.width,
height: this.height,
}
},
},
mounted(){
this.resizeObserver = new ResizeObserver(()=>{
this.$refs.echart.resize();
Expand Down Expand Up @@ -116,6 +106,8 @@ export default {
.container[border] {
border: 1px solid var(--border-color-base);
padding: 15px;
width: 100%;
height: 100%;
}

.emptyImage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,6 @@
default: true
description: 允许用户设置保存图片
group: 图表功能
- name: width
title: 宽度
type: string
default: 380px
description: 设置图宽度
group: 图表基础
- name: height
title: 高度
type: string
default: 300px
description: 设置图高度
group: 图表基础
- name: formatter
title: 标签内容格式器
type: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div :class="$style.root" ref="room">
<div :class="$style.container" border :style="size">
<div :class="$style.container" border >
<echart-line
v-if="!loading"
:axisData="axisData"
Expand Down Expand Up @@ -34,8 +34,6 @@ export default {
props: {
dataSource: [Function, Array, Object],
theme: {type: String, default: 'theme1'},
width: {type: String, default: '340px'},
height: {type: String, default: '300px'},
xAxis: {type: String, default: ''},
yAxis: {type: String, default: ''},
xAxisTitle: {type: String, default: 'X轴标题'},
Expand Down Expand Up @@ -111,12 +109,6 @@ export default {
}
},
computed: {
size() {
return {
width: this.width,
height: this.height,
}
},
axisData() {
return {
xAxis: this.xAxis,
Expand Down Expand Up @@ -213,6 +205,10 @@ export default {
<style module>
.root {
display: inline-block;
> div {
width: 100%;
height: 100%;
}
}

.container[border] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,6 @@
default: true
description: 允许用户设置保存图片
group: 图表功能
- name: width
title: 宽度
type: string
default: 340px
description: 设置图宽度
group: 图表基础
- name: height
title: 高度
type: string
default: 300px
description: 设置图高度
group: 图表基础
- name: formatter
title: 标签内容格式器
type: string
Expand Down
6 changes: 3 additions & 3 deletions packages/cw/cw_echarts_library/manifest
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Plugin-Version: 1.0.0
Library-Type: Frontend
Metadata-File: usage.json
packages/extension/[email protected].4/dist-theme/demo.html: dist-theme/demo.html
packages/extension/[email protected].4/dist-theme/index.js: dist-theme/index.js
packages/extension/[email protected].4/dist-theme/index.js.map: dist-theme/index.js.map
packages/extension/[email protected].5/dist-theme/demo.html: dist-theme/demo.html
packages/extension/[email protected].5/dist-theme/index.js: dist-theme/index.js
packages/extension/[email protected].5/dist-theme/index.js.map: dist-theme/index.js.map
2 changes: 1 addition & 1 deletion packages/cw/cw_echarts_library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "cw_echarts_library",
"title": "echarts依赖库",
"description": "",
"version": "1.0.4",
"version": "1.0.5",
"main": "./index.js",
"author": "",
"repository": "",
Expand Down
Loading