123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- <template>
- <view>
- <view class="all">
- <view class="chart">
- <view class="charts-box">
- <best-gauge :config="gaugeOption"></best-gauge>
- </view>
- <view class="charts-box">
- <best-gauge :config="gaugeOption2"></best-gauge>
- </view>
- </view>
- <view class="white">
- <view class="title1">
- <text class="param">空调排风温度变化</text>
- <view class="tiao"></view>
- </view>
- <view>
- <canvas canvas-id="canvasLineA" id="canvasLineA" class="charts" @touchmove="moveLineA"
- @touchend="moveLineA"></canvas>
-
- </view>
- </view>
- <view class="white1">
- <view class="title1">
- <text class="param">空调排风湿度变化</text>
- <view class="tiao"></view>
- </view>
- <view>
- <canvas canvas-id="canvasLineA11" id="canvasLineA11" class="charts" @touchmove="moveLineA11"
- @touchend="moveLineA11"></canvas>
-
- </view>
- </view>
- <view class="anniu">
- <image class="anniu" src="../../static/设备菜单/前往列表@2x.png" @tap="back"></image>
- </view>
- </view>
- </view>
- </template>
- <script>
-
- import bestGauge from '@/components/best-gauge/best-gauge.vue'
-
- import uCharts from '@/components/u-charts/u-charts.js'
- var _self;
- var _self11;
- var canvaLineA = null;
- var canvaLineA11 = null;
- export default {
- components: {
- bestGauge,
- },
- data() {
- let _width = uni.upx2px(350);
- return {
- cWidth: '',
- cHeight: '',
-
- gaugeOption: {
- id: 'gaugeId0',
- value: 75.8,
- axisTickLength: 2
- },
- gaugeOption2: {
- name: 'CK01排风湿度显示',
- id: 'gaugeId1',
- value: 60.5,
- unit: '%',
- axisTickLength: 2
- },
-
-
- data: {
- categories: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
- series: [{
- name: "温度",
- data: [40, 30, 36, 44, 34, 30, 22],
- }]
- },
-
- data11: {
- categories11: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
- series11: [{
- name: "湿度",
- data: [40, 30, 36, 44, 38, 34, 30],
- }]
- },
- }
- },
- onLoad() {
- this.cWidth = uni.upx2px(702);
- this.cHeight = uni.upx2px(500);
- _self = this
- _self.showLineA("canvasLineA", _self.data);
- _self11 = this
- _self11.showLineA11("canvasLineA11", _self11.data11);
- },
- methods: {
- back() {
- uni.navigateTo({
- url: '/pages/device/deviceInfo/deviceInfo'
- })
- },
- showLineA(canvasId, chartData) {
- canvaLineA = new uCharts({
- $this: _self,
- canvasId: canvasId,
- type: 'line',
- colors: ['#F45E41'],
- fontSize: 14,
- padding: [15, 15, 0, 15],
- legend: {
- show: true,
- padding: 5,
- lineHeight: 11,
- margin: 0,
- },
- dataLabel: false,
- categories: chartData.categories,
- series: chartData.series,
- xAxis: {
- gridColor: '#CCCCCC',
- gridType: 'dash',
- dashLength: 8,
- },
- yAxis: {
- gridType: 'dash',
- gridColor: '#CCCCCC',
- dashLength: 8,
- },
- width: _self.cWidth,
- height: _self.cHeight,
- extra: {
- line: {
- type: 'curve'
- }
- }
- });
- },
- moveLineA(e) {
- canvaLineA.showToolTip(e, {
- format: function(item, category) {
- return category + ' ' + item.name + ':' + item.data + '℃'
- }
- });
- },
-
- showLineA11(canvasId, chartData) {
- canvaLineA11 = new uCharts({
- $this: _self11,
- canvasId: canvasId,
- type: 'line',
- colors: ['#007AFF'],
- fontSize: 14,
- padding: [15, 15, 0, 15],
- legend: {
- show: true,
- padding: 5,
- lineHeight: 11,
- margin: 0,
- },
- dataLabel: false,
- categories: chartData.categories11,
- series: chartData.series11,
- xAxis: {
- gridColor: '#CCCCCC',
- gridType: 'dash',
- dashLength: 8,
- },
- yAxis: {
- gridType: 'dash',
- gridColor: '#CCCCCC',
- dashLength: 8,
- },
- width: _self11.cWidth,
- height: _self11.cHeight,
- extra: {
- line: {
- type: 'curve'
- }
- }
- });
- },
- moveLineA11(e) {
- canvaLineA11.showToolTip(e, {
- format: function(item, category) {
- return category + ' ' + item.name + ':' + item.data + '%'
- }
- });
- },
- }
- }
- </script>
- <style>
- .anniu {
- width: 116rpx;
- height: 116rpx;
- float: right;
- margin-top: 20rpx;
- }
- .charts {
- margin-top: 60rpx;
- width: 702rpx;
- height: 500rpx;
- background-color: #FFFFFF;
- }
- .title1 {
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .tiao {
- width: 60px;
- height: 3px;
- margin-top: 20rpx;
- background: #007AFF;
- }
- .param {
- font-size: 38rpx;
- font-weight: 550;
- margin-top: 40rpx;
- }
- .white {
- width: 702rpx;
- height: 720rpx;
- margin-left: 24rpx;
- background-color: white;
- margin-top: 28rpx;
- border-radius: 10rpx;
- }
- .white1 {
- width: 702rpx;
- height: 720rpx;
- margin-left: 24rpx;
- background-color: white;
- margin-top: 28rpx;
- border-radius: 10rpx;
- }
- .chart {
- font-size: 26rpx;
- height: 300px;
-
- background: rgb(30, 130, 250);
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- }
- .charts-box {
- margin-left: 8rpx;
- margin-right: 8rpx;
- }
- </style>
|