123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <template>
- <view>
- <uni-ec-canvas
- class="uni-ec-canvas"
- id="line-chart"
- canvas-id="multi-charts-line"
- :ec="ec"
- ></uni-ec-canvas>
- </view>
- </template>
- <script>
- // #ifndef MP-WEIXIN
- import uniEcCanvas from '@/components/Echart.vue'
- // #endif
- // #ifdef MP-WEIXIN
- import uniEcCanvas from "./UniEcCanvas.vue";
- // #endif
- export default {
- props: ['data'],
- watch: {
- 'data.yData': {
- handler(val) {
- if (val) {
- this.ec.option.series[0].data = val;
- }
- },
- deep: true
- },
- 'data.name': {
- handler(val) {
- if (val) {
- this.ec.option.series[0].name = val;
- }
- },
- deep: true
- },
- 'data.xData': {
- handler(val) {
- if (val) {
- this.ec.option.xAxis.data = val;
- }
- },
- deep: true
- }
- },
- data() {
- return {
- ec: {
- option : {
- legend: {
- show: true
- },
- xAxis: {
- type: 'category',
- data: [],
- axisLabel: {
- rotate: -50,
- fontSize:10
- }
- },
- yAxis: {
- type: 'value'
- },
- series: [
- {
- data: [],
- type: 'bar',
- name: '统计数据',
- barWidth: 14,
- itemStyle: {
- color: '#0080FF'
- }
- }
- ]
- }
- }
- };
- },
- components: {
- uniEcCanvas
- }
- };
- </script>
- <style scoped>
- .uni-ec-canvas {
- width: 100%;
- height: 600upx;
- display: block;
- }
- </style>
|