123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <!-- **************************************NO.6 矿坑*************************************** -->
- <template>
- <div class="chart-container">
- <div id="pit" style="width: 100%; height:24vh;">
- </div>
- </div>
- </template>
- <script>
- import * as echarts from 'echarts';
- import {getSjqs} from '@/api/bigdata'
- export default {
- name: 'pit',
- data() {
- return {
- count: 0,
- data_sjqs_month:[],
- data_sjqs_num:[]
- }
- },
- mounted() {
- this.sjqs()
- },
- methods: {
- // 出处 http://192.144.199.210:8080/editor/index.html?chart_id=udduEFcFiEYEEj4Q
- sjqs(){
- let that = this
- getSjqs().then(resp=>{
- that.data_sjqs_month = resp.data.month
- that.data_sjqs_num = resp.data.num
- console.log(that.data_sjqs_month)
- console.log(that.data_sjqs_num)
- that.myEcharts()
- })
- },
- myEcharts() {
- let that = this
- var chartDom = document.getElementById('pit');
- var myChart = echarts.init(chartDom);
- var color = ['#02CDFF', '#62FBE7', '#7930FF','#ef5f9d','#ecb935'];
- var option;
- option = {
- xAxis: {
- data:that.data_sjqs_month,
- },
- yAxis: {
- axisLabel: {
- fontSize: 10,
- color: '#999',
- verticalAlign: 'bottom',
- formatter: function (value, index) {
- return `${value.toFixed(2)}`;
- },
- },
- },
- series: [
- {
- type: 'line',
- lineStyle: {
- color: '#C22F43',
- width: 1,
- type: 'solid',
- },
- areaStyle: {
- color: {
- type: 'linear',
- x: 0,
- y: 0,
- x2: 0,
- y2: 1,
- colorStops: [
- {
- offset: 0,
- color: 'rgba(194, 47, 67, 1.0)',
- },
- {
- offset: 1,
- color: 'rgba(194, 47, 67, 0.03)',
- },
- ],
- global: false,
- },
- origin: 'start',
- },
- opacity: 0.2,
- shadowColor: 'rgba(194, 47, 67)',
- shadowBlur: 0,
- shadowOffsetX: 0,
- data: that.data_sjqs_num
- },
- ],
- };
- option && myChart.setOption(option);
- },
- },
- }
- </script>
- <style rel="stylesheet/scss" lang="scss" scoped>
- .chart-container {
- width: 100%;
- height: 100%;
- position: relative;
- padding-bottom: 10px;
- display: flex;
- }
- </style>
|