123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <template>
- <div class="data_body">
- <div style="width: 100%; height: 100%">
- <div id="charts_canvas" class="echart" style="width: 100%; height: 100%; "></div>
- </div>
- </div>
- </template>
-
- <script>
- export default {
- data() {
- return {
- chartObj: null,
- ooption: {
- xdata: [],
- sdata: [],
- },
- option: {
- tooltip: {},
- radar: {
- // shape: 'circle',
- indicator: [
- { name: '目标一', max: 10 },
- { name: '目标二', max: 10 },
- { name: '目标三', max: 10 },
- { name: '目标四', max: 10 },
- { name: '目标五', max: 10 }
- ]
- },
- series: [
- {
- areaStyle: {},
- name: '学生综合评价',
- type: 'radar',
- data: [
- {
- value: [5, 7, 7, 8, 5, 6],
- name: ''
- }
- ]
- }
- ]
- },
- };
- },
- methods: {
- setChart(option) {
- // 雷达图显示的标签
- let newPromise = new Promise((resolve) => {
- resolve();
- });
- //然后异步执行echarts的初始化函数
- newPromise.then(() => {
- const chartObj = this.$echarts.init(
- //劳动课程
- this.$el.querySelector("#charts_canvas")
- );
- // this.option.xAxis.data = option.xdata;
- // this.option.series[0].data = option.sdata;
- // 初始化雷达图
- this.chartObj = chartObj;
- this.chartObj.setOption(this.option);
- });
- },
- },
- watch: {
- },
- mounted() {
- this.setChart(this.ooption);
- var _this = this;
- window.addEventListener("resize", () => {
- if (_this.chartObj) {
- _this.chartObj.resize();
- }
- });
- },
- };
- </script>
-
- <style scoped>
- .data_body {
- height: 100%;
- /* display: flex; */
- position: relative;
- border-radius: 5px;
- /* border: 1px solid #eee; */
- margin: 0 auto;
- box-sizing: border-box;
- padding: 0;
- width: 95%;
- background: #fff;
- }
- </style>
-
|