123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- <template>
- <div id="app-container-proportion">
- <div class="bg-color-black">
- <div class="d-flex pt-2 pl-2">
- <span style="color:#5cd9e8">
- <icon name="chart-area"></icon>
- </span>
- <div class="d-flex">
- <span class="fs-xl text mx-2">产品占比图</span>
- <div class="decoration2">
- <dv-decoration-2 :reverse="true" style="width:5px;height:200px;" />
- </div>
- </div>
- </div>
- <div>
- <div>
- <div id="productProportion" style="width:420px; height: 160px;"></div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import productProportion from "../dashboard/productProportion";
- import resize from "@/views/dashboard/mixins/resize";
- export default {
- props: ['dashboarddata'],
- components: {
- productProportion
- },
- data() {
- return {
- chart: null,
- // 查询参数
- queryParams: {
- },
- };
- },
- mixins: [resize],
- mounted() {
- this.initChart()
- // 每隔30秒请求一次数据
- window.setInterval(() => {
- setTimeout(() => {
- ///调取接口获取数据
- this.initChart();
- }, 0)
- }, 20000)
- },
- methods: {
- initChart() {
- // 基于准备好的dom,初始化echarts实例
- this.chart = this.echarts.init(document.getElementById("productProportion"));
- this.chart.setOption({
- color: [
- "#37a2da",
- "#32c5e9",
- "#9fe6b8",
- "#ffdb5c",
- "#ff9f7f",
- "#fb7293",
- "#e7bcf3",
- "#8378ea"
- ],
- tooltip: {
- trigger: "item",
- formatter: "{b} : {c} ({d}%)"
- },
- toolbox: {
- show: true
- },
- calculable: true,
- legend: [{
- icon: "circle",
- orient: 'vertical',
- right: 62,
- top: 40,
- bottom: 20,
- data: ["H2", "C2H4", "CH4", "C3H6"],
- textStyle: {
- color: "#fff"
- }
- }, {
- icon: "circle",
- orient: 'vertical',
- right: -6,
- top: 40,
- bottom: 20,
- data: ["Offgas", "LPG", "C4", "RPG"],
- textStyle: {
- color: "#fff"
- }
- }],
- label: {
- alignTo: 'edge',
- formatter: '{name|{b}}\n{weight|{c} 吨({d}%)}',
- minMargin: 5,
- edgeDistance: 10,
- lineHeight: 15,
- rich: {
- name: {
- fontSize: 12,
- color: '#ffffff'
- },
- weight: {
- fontSize: 8,
- color: '#ffffff'
- }
- }
- },
- series: [
- {
- type: "pie",
- radius: [10, 55],
- roseType: "area",
- center: ["36%", "50%"],
- data: [
- { value: this.dashboarddata.energyQingqi, name: "H2" },
- { value: this.dashboarddata.energyYixi, name: "C2H4" },
- { value: this.dashboarddata.energyJiawan, name: "CH4" },
- { value: this.dashboarddata.energyBingxi, name: "C3H6" },
- { value: this.dashboarddata.energyOffgas, name: "Offgas" },
- { value: this.dashboarddata.energyLpg, name: "LPG" },
- { value: this.dashboarddata.energyCsi, name: "C4" },
- { value: this.dashboarddata.energyRpg, name: "RPG" }
- ],
- }
- ]
- });
- }
- },
- destroyed() {
- window.onresize = null;
- }
- }
- </script>
- <style lang="scss">
- #app-container-proportion {
- padding: 0.2rem 0.2rem 0;
- height: 240px;
- min-width: 3.75rem;
- border-radius: 0.0625rem;
- .bg-color-black {
- height: 90%;
- border-radius: 0.125rem;
- }
- .text {
- color: #c3cbde;
- } //下滑线动态
- .decoration2 {
- position: absolute;
- right: 0.125rem;
- }
- .chart-box {
- margin-top: 0.2rem;
- width: 2.125rem;
- height: 2.125rem;
- .active-ring-name {
- padding-top: 0.125rem;
- }
- }
- }
- </style>
|