Commit d7b9cc39 authored by Jenny's avatar Jenny

feat: 图表组件尺寸

parent 2941eec4
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
ref="barMixMapCanvas" ref="barMixMapCanvas"
canvas-id="bar-mix-map-chart" canvas-id="bar-mix-map-chart"
:ec="ec" :ec="ec"
:style="[elStyleObject]"
></uni-ec-canvas> ></uni-ec-canvas>
</view> </view>
</template> </template>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
ref="chinaMapCanvas" ref="chinaMapCanvas"
canvas-id="china-map-chart" canvas-id="china-map-chart"
:ec="ec" :ec="ec"
:style="[elStyleObject]"
></uni-ec-canvas> ></uni-ec-canvas>
</view> </view>
</template> </template>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
ref="horizontalBarCanvas" ref="horizontalBarCanvas"
canvas-id="horizontal-bar-chart" canvas-id="horizontal-bar-chart"
:ec="ec" :ec="ec"
:style="[elStyleObject]"
></uni-ec-canvas> ></uni-ec-canvas>
</view> </view>
</template> </template>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
ref="lineMixBarCanvas" ref="lineMixBarCanvas"
canvas-id="line-mix-bar-chart" canvas-id="line-mix-bar-chart"
:ec="ec" :ec="ec"
:style="[elStyleObject]"
></uni-ec-canvas> ></uni-ec-canvas>
</view> </view>
</template> </template>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
ref="normalbarCanvas" ref="normalbarCanvas"
canvas-id="normal-bar-chart" canvas-id="normal-bar-chart"
:ec="ec" :ec="ec"
:style="[elStyleObject]"
></uni-ec-canvas> ></uni-ec-canvas>
</view> </view>
</template> </template>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
ref="normalGaugeCanvas" ref="normalGaugeCanvas"
canvas-id="normal-gauge-chart" canvas-id="normal-gauge-chart"
:ec="ec" :ec="ec"
:style="[elStyleObject]"
></uni-ec-canvas> ></uni-ec-canvas>
</view> </view>
</template> </template>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
ref="normalLineCanvas" ref="normalLineCanvas"
canvas-id="normal-line-chart" canvas-id="normal-line-chart"
:ec="ec" :ec="ec"
:style="[elStyleObject]"
></uni-ec-canvas> ></uni-ec-canvas>
</view> </view>
</template> </template>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
ref="normalPieCanvas" ref="normalPieCanvas"
canvas-id="normal-pie-chart" canvas-id="normal-pie-chart"
:ec="ec" :ec="ec"
:style="[elStyleObject]"
></uni-ec-canvas> ></uni-ec-canvas>
</view> </view>
</template> </template>
......
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
id="normalra-dar" id="normalra-dar"
ref="normalRadarCanvas" ref="normalRadarCanvas"
canvas-id="normalra-dar-chart" canvas-id="normalra-dar-chart"
:ec="ec"></uni-ec-canvas> :ec="ec"
:style="[elStyleObject]"
></uni-ec-canvas>
</view> </view>
</template> </template>
......
...@@ -11,6 +11,16 @@ export default { ...@@ -11,6 +11,16 @@ export default {
required: true required: true
} }
}, },
computed: {
elStyleObject() {
const { windowWidth } = uni.getSystemInfoSync()
const { width, height } = this.elementInfo
return {
'width': `${width > windowWidth ? '100%' : width + 'px'}`,
'height': `${width > windowWidth ? height / width * windowWidth : height}px`
}
}
},
methods: { methods: {
/** /**
* 静态数据 * 静态数据
......
...@@ -26,4 +26,5 @@ ...@@ -26,4 +26,5 @@
width: 100%; width: 100%;
height: 750rpx; height: 750rpx;
display:block; display:block;
margin: 20rpx auto;
} }
\ No newline at end of file
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