#
luxiaotao1123
2021-12-15 4d317e08d281b9e5e2cf742788c3d4b5b6bb9b38
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
var dom1 = document.getElementById("Histogram");
var myChart1 = echarts.init(dom1);
window.addEventListener('resize',function () {
    myChart1.resize();
})
var app1 = {};
 
var dom = document.getElementById("baobiao2");
var myChart = echarts.init(dom);
window.addEventListener('resize',function () {
    myChart.resize();
})
var app = {};
 
 
var option1;
 
option1 = {
    title: {
        text: '年度进/出货量',
        x:'5px',
        y:'15px',
        textStyle:{
            color:'#ffffff',
            fontWeight:400,
            fontSize: 10,
        },
        subtext: 'Data',
        subtextStyle:{
            align:'center',
            color:'#ffffff',
            fontSize: 7,
        },
        show: true,
 
    },
    tooltip: {
        trigger: 'axis'
    },
    textStyle:{
        color:'#f5f4f4',
    },
    legend: {
        show:false,
        data: ['进货', '出货']
    },
    toolbox: {
        show: false,
        feature: {
            dataView: { show: true, readOnly: false },
            magicType: { show: true, type: ['line', 'bar'] },
            restore: { show: true },
            saveAsImage: { show: true }
        }
    },
    calculable: true,
    xAxis: [
        {
            color:'#975a5a',
            type: 'category',
            axisTick:{
                show:false,
                lineStyle:{
                    color:'#000'
                }
            },
            axisLabel: { //  如果这个字段不设置,echarts会根据屏宽及横坐标数据自动给出间隔
                fontSize:9,
                interval: 1, // 间隔长度,可自定义(如果是时间格式,echarts会自动处理)
                rotate: 0 ,// 横坐标上label的倾斜度
                textStyle: {
                    color:'#fff'
                }
            },
            axisLine:{
                lineStyle: {
                    color: '#e2e1e1',// x轴刻度线的颜色
                }},
            data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
        }
    ],
    yAxis: [
        {
            type: 'value',
            offset: -4,
            axisTick:{
                show:false,
            },
            axisLabel: {
                fontSize:9,
            },
            splitLine:{
                lineStyle:{
                    color:'#cdcdcd'// y轴分割线颜色
                }
            }
 
        }
    ],
    series: [
        {
            color:['#88b0e2'],
            name: '进货',
            type: 'bar',
            data: [
                204.5, 50.5, 15.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3
            ],
        },
        {
            color:['#f8f7f7'],
            name: '出货',
            type: 'bar',
            data: [
                100, 75.2, 33.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
            ],
        }
    ],
 
};
 
if (option1 && typeof option1 === 'object') {
    myChart1.setOption(option1);
}
 
let base = +new Date(1988, 9, 3);
let oneDay = 24 * 3600 * 1000;
let data = [[base, Math.random() * 300]];
for (let i = 1; i < 20000; i++) {
    let now = new Date((base += oneDay));
    data.push([+now, Math.round((Math.random() - 0.5) * 20 + data[i - 1][1])]);
}
option = {
    tooltip: {
        trigger: 'axis',
        position: function (pt) {
            return [pt[0], '10%'];
        }
    },
    title: {
        x:'5px',
        y:'15px',
        text: '销售件数',
        textStyle:{
            color:'#ffffff',
            fontWeight:400,
            fontSize: 10,
        },
    },
    toolbox: {
        show:false,
        feature: {
            dataZoom: {
                yAxisIndex: 'none'
            },
            restore: {},
            saveAsImage: {}
        }
    },
    textStyle:{
        color:'#f5f4f4',
    },
    xAxis: {
        type: 'time',
        boundaryGap: false,
        axisTick:{
            show:false,
        },
        axisLabel: { //  如果这个字段不设置,echarts会根据屏宽及横坐标数据自动给出间隔
            fontSize:9,
            interval: 1, // 间隔长度,可自定义(如果是时间格式,echarts会自动处理)
            rotate: 0 ,// 横坐标上label的倾斜度
            textStyle: {
                color:'#fff'
            }
        },
        axisLine:{
            lineStyle: {
                color: '#e2e1e1',// x轴刻度线的颜色
            }},
 
    },
 
    yAxis: {
        type: 'value',
        boundaryGap: [0, '100%'],
        axisLabel: {
            fontSize:9,
        },
        splitLine:{
            lineStyle:{
                color:'#cdcdcd'// y轴分割线颜色
            }
        }
    },
    dataZoom: [
        {
            type: 'inside',
            start: 0,
            end: 20
        },
        {
            start: 0,
            end: 20
        }
    ],
    series: [
        {
            name: 'Fake Data',
            type: 'line',
            smooth: true,
            symbol: 'none',
            areaStyle: {
                normal: {
                    color: '#88b0e2' //改变区域颜色
                }
            },
            itemStyle : {
                normal : {
                    color:'#dddede', //改变折线点的颜色
                    lineStyle:{
                        // color:'#8cd5c2' //改变折线颜色
                        width:0.5,
                    }
                }
            },
            data: data
        }
    ]
};
 
if (option && typeof option === 'object') {
    myChart.setOption(option);
}