123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <template>
- <view>
- <!-- 搜索井下人员 -->
- <p-i-o-navbar></p-i-o-navbar>
-
- <view class="content">
- <!-- 当前井下人员 -->
- <p-i-o-section-1>
- <!-- 圆环图 -->
- <canvas style="width: 720upx; height:500upx;" canvas-id="canvasRing" id="canvasRing" @touchstart="touchRing"></canvas>
-
- </p-i-o-section-1>
- <!-- 井下人员(区域分布) -->
- <p-i-o-section-2></p-i-o-section-2>
- <!-- 井下人员(部门分布) -->
- <p-i-o-section-3></p-i-o-section-3>
- <!-- 各科室下井人数 -->
- <p-i-o-section-4></p-i-o-section-4>
- </view>
- </view>
- </template>
- <script>
- import uCharts from '@/components/u-charts/u-charts.js';
- var _self;
- var canvaRing = null;
- export default {
- data() {
- return {
- cWidth: '',
- cHeight: '',
- pixelRatio: 1,
- serverData: '',
- }
- },
- onLoad() {
- _self = this;
- this.cWidth = uni.upx2px(720);
- this.cHeight = uni.upx2px(500);
- this.getServerData();
- },
- methods: {
- getServerData() {
- let Ring = {
- series: [
- {
- "name": "一班",
- "data": 50
- }, {
- "name": "二班",
- "data": 30
- }, {
- "name": "三班",
- "data": 20
- }, {
- "name": "四班",
- "data": 18
- }, {
- "name": "五班",
- "data": 8
- },
- ]
- }
- _self.showRing("canvasRing", Ring);
- },
- showRing(canvasId, chartData) {
- canvaRing = new uCharts({
- $this: _self,
- canvasId: canvasId,
- type: 'ring',
- fontSize: 11,
- legend: true,
- title: {
- name: '70%',
- color: '#7cb5ec',
- fontSize: 25 * _self.pixelRatio,
- offsetY: 0 * _self.pixelRatio,
- },
- subtitle: {
- name: '收益率',
- color: '#666666',
- fontSize: 15 * _self.pixelRatio,
- offsetY: 0 * _self.pixelRatio,
- },
- extra: {
- pie: {
- offsetAngle: -45,
- ringWidth: 40 * _self.pixelRatio,
- labelWidth: 15
- }
- },
- background: '#FFFFFF',
- pixelRatio: _self.pixelRatio,
- series: chartData.series,
- animation: true,
- width: _self.cWidth * _self.pixelRatio,
- height: _self.cHeight * _self.pixelRatio,
- disablePieStroke: true,
- dataLabel: true,
- });
- },
- touchRing(e) {
- canvaRing.showToolTip(e, {
- format: function(item) {
- return item.name + ':' + item.data
- }
- });
- },
- }
- }
- </script>
- <style lang="scss">
- page{
- background-color: #f3f3f3;
- }
- .content{
- box-sizing: border-box;
- padding: 0 15rpx;
- background-color: #f3f3f3;
- }
- </style>
|