|
|
@ -4,22 +4,59 @@ |
|
|
|
<!-- 学习路径推荐 --> |
|
|
|
<!-- 学习路径推荐 --> |
|
|
|
|
|
|
|
|
|
|
|
<script lang="ts" setup> |
|
|
|
<script lang="ts" setup> |
|
|
|
|
|
|
|
// import echarts from 'echarts/types/dist/echarts'; |
|
|
|
import { ref } from 'vue'; |
|
|
|
import { ref } from 'vue'; |
|
|
|
const option = ref({ |
|
|
|
// import * as echarts from 'echarts'; |
|
|
|
xAxis: { |
|
|
|
import 'echarts' |
|
|
|
type: 'category', |
|
|
|
import ECharts from 'vue-echarts'; |
|
|
|
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] |
|
|
|
var ROOT_PATH = 'https://echarts.apache.org/examples'; |
|
|
|
}, |
|
|
|
var chartDom = document.getElementById('main'); |
|
|
|
yAxis: { |
|
|
|
var myChart = echarts.init(chartDom); |
|
|
|
type: 'value' |
|
|
|
var option; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
myChart.showLoading(); |
|
|
|
|
|
|
|
$.getJSON(ROOT_PATH + '/data/asset/data/les-miserables.json', function (graph) { |
|
|
|
|
|
|
|
myChart.hideLoading(); |
|
|
|
|
|
|
|
const option = ref({ |
|
|
|
|
|
|
|
tooltip: {}, |
|
|
|
|
|
|
|
legend: [ |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
data: graph.categories.map(function (a) { |
|
|
|
|
|
|
|
return a.name; |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
series: [ |
|
|
|
series: [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
data: [150, 230, 224, 218, 135, 147, 260], |
|
|
|
name: 'Les Miserables', |
|
|
|
type: 'line' |
|
|
|
type: 'graph', |
|
|
|
|
|
|
|
layout: 'none', |
|
|
|
|
|
|
|
data: graph.nodes, |
|
|
|
|
|
|
|
links: graph.links, |
|
|
|
|
|
|
|
categories: graph.categories, |
|
|
|
|
|
|
|
roam: true, |
|
|
|
|
|
|
|
label: { |
|
|
|
|
|
|
|
show: true, |
|
|
|
|
|
|
|
position: 'right', |
|
|
|
|
|
|
|
formatter: '{b}' |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
labelLayout: { |
|
|
|
|
|
|
|
hideOverlap: true |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
scaleLimit: { |
|
|
|
|
|
|
|
min: 0.4, |
|
|
|
|
|
|
|
max: 2 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
lineStyle: { |
|
|
|
|
|
|
|
color: 'source', |
|
|
|
|
|
|
|
curveness: 0.3 |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
myChart.setOption(option); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
option && myChart.setOption(option); |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
<style lang="scss" scoped> |
|
|
|