12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <template>
- <div>
- <div id="analysisChartTopLeft" style="width:6rem;height:4rem;margin:35px auto;"></div>
- </div>
- </template>
- <script>
- import echartMixins from "@/utils/resizeMixins";
- export default {
- props:['xDataTopLeft','yDataTopLeft'],
- data() {
- return {
- chart: null,
- }
- },
- mixins: [echartMixins],
- mounted() {
- this.init();
- },
- methods: {
- init() {
- this.chart = this.echarts.init(document.getElementById("analysisChartTopLeft"));
- let option = {
- title: {
- text: '设备 1',
- fontSize: 20,
- textStyle: {
- fontWeight: 'bold',
- color: '#DCDCDC'
- },
- x: 'center'
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow'
- }
- },
- legend: {},
- grid: {
- left: '3%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- xAxis: {
- type: 'value',
- boundaryGap: [0, 0.01],
- axisLabel: {
- fontSize: 14,
- textStyle: {
- fontWeight: 'bold',
- color: '#DCDCDC'
- }
- },
- nameTextStyle: {
- fontSize: 14,
- fontWeight: 'bold',
- color: '#DCDCDC'
- }
- },
- yAxis: {
- type: 'category',
- data: this.yDataTopLeft,
- axisLabel: {
- fontSize: 14,
- textStyle: {
- fontWeight: 'bold',
- color: '#DCDCDC'
- }
- },
- nameTextStyle: {
- fontSize: 14,
- fontWeight: 'bold',
- color: '#DCDCDC'
- }
- },
- series: [
- {
- type: 'bar',
- data: this.xDataTopLeft,
-
- }
- ]
- };
- this.chart.setOption(option);
- }
- },
- destroyed() {
- window.onresize = null;
- }
- }
- </script>
- <style>
- </style>
|