|
|
@@ -1,26 +1,48 @@
|
|
|
<template>
|
|
|
- <img alt="Vue logo" src="./assets/logo.png">
|
|
|
- <HelloWorld msg="Welcome to Your Vue.js App"/>
|
|
|
+ <div id="app">
|
|
|
+ <h1>ECharts Line Chart 示例</h1>
|
|
|
+ <LineChart :chartData="chartData" />
|
|
|
+ <button @click="updateData">更新数据</button>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import HelloWorld from './components/HelloWorld.vue'
|
|
|
+import LineChart from "./components/LineChart.vue";
|
|
|
|
|
|
export default {
|
|
|
- name: 'App',
|
|
|
+ name: "App",
|
|
|
components: {
|
|
|
- HelloWorld
|
|
|
- }
|
|
|
-}
|
|
|
+ LineChart,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ chartData: {
|
|
|
+ title: "访问量统计",
|
|
|
+ categories: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: "访问量",
|
|
|
+ type: "line",
|
|
|
+ data: [120, 200, 150, 80, 70, 110, 130],
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ showTooltip:false,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ updateData() {
|
|
|
+ this.chartData.series[0].data = [100, 220, 180, 90, 100, 120, 150];
|
|
|
+ this.chartData.showTooltip = !this.chartData.showTooltip;
|
|
|
+ console.log(this.showTooltip);
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style>
|
|
|
#app {
|
|
|
- font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
|
- -webkit-font-smoothing: antialiased;
|
|
|
- -moz-osx-font-smoothing: grayscale;
|
|
|
text-align: center;
|
|
|
- color: #2c3e50;
|
|
|
- margin-top: 60px;
|
|
|
+ margin-top: 20px;
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|