123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <!-- **************************************NO.14 泡沫液*************************************** -->
- <template>
- <div class="chart-container">
- <div id="foam" style="width: 100%; height:23vh;">
- </div>
- </div>
- </template>
- <script>
- import * as echarts from 'echarts';
- import {getPmy} from '@/api/bigdata'
- export default {
- name: 'foam',
- data() {
- return {
- count: 0,
- data_pmy_name:[],
- data_pmy_value:[]
- }
- },
- mounted() {
- this.pmy()
- },
- methods: {
- pmy() {
- let that = this
- getPmy().then(resp => {
- that.data_pmy_name = resp.data.name
- that.data_pmy_value = resp.data.value
- that.myEcharts()
- })
- },
- // 出处 http://192.144.199.210:8080/editor/index.html?chart_id=daPJGrcYMpZanpxR
- myEcharts() {
- let that = this
- var chartDom = document.getElementById('foam');
- var myChart = echarts.init(chartDom);
- var zdslColorList = ['#D0A00E', '#34DA62', '#00C0E9', '#0096F3', '#33CCFF','#D0A00E', '#34DA62', '#00C0E9', '#0096F3', '#33CCFF','#D0A00E', '#34DA62', '#00C0E9', '#0096F3', '#33CCFF','#D0A00E', '#34DA62', '#00C0E9', '#0096F3', '#33CCFF','#D0A00E', '#34DA62', '#00C0E9', '#0096F3', '#33CCFF','#D0A00E', '#34DA62', '#00C0E9', '#0096F3', '#33CCFF'];
- var option;
- option = {
- grid: {
- top: '5%',
- left: '10%',
- right: '12%',
- bottom: '0',
- containLabel: true
- },
- tooltip: {},
- xAxis: {
- show: false,
- type: 'value'
- },
- yAxis: {
- type: 'category',
- inverse: true,
- data: that.data_pmy_name,
- axisLabel: {
- show: true,
- textStyle: {
- color: '#ADD6FF',
- fontSize: '12'
- }
- },
- splitLine: {
- show: false
- },
- axisTick: {
- show: false
- },
- axisLine: {
- show: false
- },
- },
- series: [
- {
- type: 'bar',
- barWidth: "10%",
- data: that.data_pmy_value
- }
- ],
- itemStyle: {
- color: function (params) {
- return zdslColorList[params.dataIndex]
- }
- }
- }
- option && myChart.setOption(option);
- },
- },
- }
- </script>
- <style rel="stylesheet/scss" lang="scss" scoped>
- .chart-container {
- width: 100%;
- height: auto;
- position: relative;
- padding-bottom: 10px;
- display: flex;
- }
- </style>
|