1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
| <template>
| <view :prop="config" :change:prop="curve.updateEcharts" :id="chartID"></view>
| </template>
|
| <script>
| export default {
| props: ["list"],
| data() {
| return {
| chartID:
| "chart" +
| parseInt(Math.random() * 100000) +
| "" +
| parseInt(Math.random() * 100000),
| };
| },
| computed: {
| config() {
| return {
| chartID: this.chartID,
| list: this.list,
| };
| },
| },
| onLoad() {},
| methods: {},
| };
| </script>
|
| <script module="curve" lang="renderjs">
| import highstock from "highcharts/highstock";
| export default {
| data(){
| return {
| currentList:[],
| currentChartID:''
| }
| },
| mounted() {
| this.initPage();
| this.intiChart();
| },
| methods: {
| initPage() {
| this.currentList = this.config.list.map(item=>item*1)
| this.currentChartID= this.config.chartID
| },
| intiChart() {
| return highstock.stockChart(document.getElementById(this.currentChartID), {
| chart: {
| panning: false,
| spacingRight: 0,
| spacingLeft: 0,
| backgroundColor: "transparent",
| },
| credits: {
| enabled: false,
| },
| rangeSelector: {
| enabled: false,
| },
| navigator: {
| enabled: false,
| },
| scrollbar: {
| enabled: false,
| },
| legend: {
| enabled: false,
| },
| tooltip: {
| enabled: false,
| },
| xAxis: {
| visible: false,
| },
| yAxis: {
| visible: false,
| },
| plotOptions: {
| spline: {
| enableMouseTracking: false,
| },
| },
| series: [{
| color:{
| linearGradient:{
| x1:'0%',
| y1:'0%',
| x2:'100%',
| y2:'100%'
| },
| stops:[
| [0, '#B4EC51'],
| [1, '#429321'],
| ]
| },
| data: this.currentList,
| lineWidth: 1.5,
| type: "spline",
| }, ],
| });
| },
| updateEcharts() {
|
| },
| }
| }
| </script>
|
| <style>
| .content {
| display: flex;
| flex-direction: column;
| align-items: center;
| justify-content: center;
| }
|
| .echarts {
| margin-top: 100px;
| width: 100%;
| height: 300px;
| }
| </style>
|
|