| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- <script>
- import apiCarbonCar from "@/api/carbon/apiCarbonCar";
- import apiCarbonPrint from "@/api/carbon/apiCarbonPrint";
- export default {
- data() {
- return {
- option: {
- legend: {
- data: [
- '中迅',
- '北京规划院',
- '郑分',
- '广分',
- '上分',
- '成分',
- ],
- selected: {
- '中迅': false,
- '北京规划院': true,
- '郑分': false,
- '广分': false,
- '上分': false,
- '成分': false,
- }
- },
- grid: {
- left: '0%', //默认10%
- right: '1%', //默认10%
- bottom: '15%', //默认60
- top: '15%',
- containLabel: true
- //grid区域是否包含坐标轴的刻度标签
- },
- xAxis: {
- data: []
- },
- yAxis: [
- {
- name: '排放量',
- type: 'value',
- nameTextStyle: {
- padding: [10, 0, 10, -12]
- },
- },
- ],
- dataZoom: [
- {
- type: 'slider',
- start: 0,
- end: 100,
- height: 12,
- },
- {
- type: 'inside',
- start: 0,
- end: 100,
- }
- ],
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- },
- textStyle: {
- color: '#fff',
- align: 'left',
- fontSize: 14
- },
- axisLine: {//x坐标轴轴线
- show: true,
- lineStyle: {//x坐标轴轴线样式
- color: '#000',//'#ccc' | 'rgb(128, 128, 128)' | 'rgba(128, 128, 128, 0.5)',设置标签颜色
- }
- },
- backgroundColor: 'rgba(0,0,0,0.8)',
- },
- series: [
- {
- name: '中迅',
- data: [],
- type: 'line',
- smooth: true,
- showSymbol:false,
- symbolSize: 6,
- lineStyle: {
- color: "#FDB65B",
- width: 1,
- },
- itemStyle: {
- color: "#FDB65B"
- },
- emphasis: {
- scale:1.5
- }
- },
- {
- name: '北京规划院',
- data: [],
- type: 'line',
- smooth: true,
- showSymbol:false,
- lineStyle: {
- color: "#62CC97",
- width: 3,
- },
- itemStyle: {
- color: "#62CC97"
- },
- emphasis: {
- scale:1.5
- },
- },
- {
- name: '郑分',
- data: [],
- type: 'line',
- smooth: true,
- showSymbol:false,
- lineStyle: {
- color: "#4D94FF",
- width: 1,
- },
- itemStyle: {
- color: "#4D94FF"
- },
- emphasis: {
- scale:1.5
- },
- },
- {
- name: '广分',
- data: [],
- type: 'line',
- smooth: true,
- showSymbol:false,
- lineStyle: {
- color: "#4DF5FF",
- width: 1,
- },
- itemStyle: {
- color: "#4DF5FF"
- },
- emphasis: {
- scale:1.5
- },
- },
- {
- name: '上分',
- data: [],
- type: 'line',
- smooth: true,
- showSymbol:false,
- lineStyle: {
- color: "#FF6E4D",
- width: 1,
- },
- itemStyle: {
- color: "#FF6E4D"
- },
- emphasis: {
- scale:1.5
- },
- },
- {
- name: '成分',
- data: [],
- type: 'line',
- smooth: true,
- showSymbol:false,
- lineStyle: {
- color: "#8B4DFF",
- width: 1,
- },
- itemStyle: {
- color: "#8B4DFF"
- },
- emphasis: {
- scale:1.5
- },
- }
- ]
- },
- }
- },
- props: {
- height: Number,
- queryData: Object
- },
- mounted() {
- this.$nextTick(()=>{
- this.initChart();
- })
- },
- methods: {
- initChart() {
- let chart = this.$echarts.init(this.$refs.myChart)
- this.chart = chart;
- this.$util.chartsResize(this.chart);
- chart.setOption(this.option)
- this.getData()
- },
- getData() {
- return apiCarbonPrint.getPrintInfo(this.queryData).then(res=>{
- let data = this.$util.dataUtil.covertDataToEcharts(res, ['zhongxun','guihuayuanBJ','zhengfen','guangfen','shangfen','chengfen'])
- this.$util.dataUtil.refreshEchartsData(this.chart, this.option, data)
- })
- }
- }
- }
- </script>
- <template>
- <div id="personTrendChart" style="width: 100%" :style="{height: height+'px'}" ref="myChart" ></div>
- </template>
- <style lang="less" scoped>
- </style>
|