JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/echarts/dist/echarts.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/v-charts/lib/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/echarts-amap/dist/echarts-amap.min.js"></script>
<script src="//unpkg.com/echarts/dist/extension/bmap.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/v-charts/lib/style.min.css">
<div id="app">
<ve-line
background-color="#142155"
:data="chartData"
:colors="chartColors"
:legend-visible="false"
:extend="chartExtend"
:title="chartTitle"
:settings="chartSettings">
</ve-line>
</div>
Babel + JSX
// import echarts from 'echarts/lib/echarts'
// import 'echarts/lib/component/title'
new Vue({
el: '#app',
data () {
this.chartSettings = {
yAxisName: ['1', '单位:万元']
}
this.chartExtend = {
yAxis (items) {
return [
Object.assign({}, items[0], {
axisLabel: {
color: '#7792CE'
},
axisLine: {
show: true,
lineStyle: {
color: '#1A2D67',
width: 2
}
},
splitLine: {
show: false
}
}),
Object.assign({}, items[1], {
axisLine: {
show: false
},
nameTextStyle: {
color: '#fff',
align: 'center',
padding: [0, 0, 0, -60]
}
})
]
},
xAxis: {
axisLabel: {
color: '#7792CE'
},
axisTick: {
show: false
},
axisLine: {
show: true,
lineStyle: {
color: '#1A2D67',
width: 2
}
},
boundaryGap: true
},
series: {
showSymbol: false,
areaStyle: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#3054C4'
}, {
offset: 1,
color: '#16255A'
}])
}
}
}
this.chartTitle = {
show: true,
text: '近一年回款趋势',
textStyle: {
color: '#7792CE'
}
}
this.chartColors = ['#548CF5']
return {
chartData: {
columns: ['日期', '访问用户'],
rows: [
{ '日期': '1/1', '访问用户': 1393 },
{ '日期': '1/2', '访问用户': 3530 },
{ '日期': '1/3', '访问用户': 2923 },
{ '日期': '1/4', '访问用户': 1723 },
{ '日期': '1/5', '访问用户': 3792 },
{ '日期': '1/6', '访问用户': 4593 }
]
}
}
}
})