1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <template>
- <div >
- <div ref="testLine" style="height: 170px; width: 300px"></div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- currentChartId: 1,
- xData: new Array(30).fill("-"),
- y1Data: new Array(30).fill("-"),
- y2Data: new Array(30).fill("-"),
- count: 0,
- myChart: null,
- option: {
- title: {
- text: "各煤仓占比",
- // 标题内边距 上下边距 左右边距
- padding: [10, 10, 0, 110],
- textStyle: {
- fontWeight: "bolder", //标题颜色
- color: "white",
- fontSize: 18,
- },
- },
- tooltip: {
- trigger: "item",
- },
- grid: {
- top: "22%",
- left: "41%",
- right: "4%",
- bottom: "3%",
- containLabel: true,
- },
- // legend: {
- // align: "left",
- // left: "44%",
- // top: "17%",
- // type: "plain",
- // textStyle: {
- // color: "#7ec7ff",
- // fontSize: 11,
- // },
- // data: ["原煤仓", "块煤仓","末煤仓","成品煤"],
- // },
- series: [
- {
- name: "煤仓占比",
- type: "pie",
- radius: "50%",
- data: [
- { value: 1048, name: "原煤仓" },
- { value: 735, name: "块煤仓" },
- { value: 580, name: "末煤仓" },
- { value: 484, name: "成品煤" },
- ],
- emphasis: {
- itemStyle: {
- shadowBlur: 10,
- shadowOffsetX: 0,
- shadowColor: "rgba(0, 0, 0, 0.5)",
- },
- },
- },
- ],
- },
- };
- },
- methods: {},
- mounted() {
- this.myChart = this.$echarts.init(this.$refs.testLine);
- // 获取数据
- this.myChart.setOption(this.option);
- },
- };
- </script>
- <style scoped lang="less">
- </style>
|