-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchart.html
108 lines (100 loc) · 2.74 KB
/
chart.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
</head>
<body>
<div id="chart"></div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script>
$(function() {
$.getJSON('https://backend.brecoins.com.br/chart', function(data) {
var trace = {
x: data.date,
close: data.close,
decreasing: {
line: {
color: '#7F7F7F'
}
},
high: data.high,
increasing: {
line: {
color: '#17BECF'
}
},
line: {
color: 'rgba(31,119,180,1)'
},
low: data.low,
open: data.open,
type: 'candlestick',
xaxis: 'x',
yaxis: 'y',
// cutomise colors
increasing: {
line: {
color: 'green'
}
},
decreasing: {
line: {
color: 'red'
}
}
};
var data = [trace];
var layout = {
dragmode: 'zoom',
margin: {
r: 10,
t: 25,
b: 40,
l: 60
},
showlegend: false,
xaxis: {
autorange: true,
type: 'date',
rangeselector: {
x: 0,
y: 1.2,
xanchor: 'left',
font: {
size: 8
},
buttons: [{
step: 'month',
stepmode: 'backward',
count: 1,
label: '1 mês'
}, {
step: 'month',
stepmode: 'backward',
count: 6,
label: '6 meses'
}, {
step: 'year',
stepmode: 'backward',
count: 1,
label: '1 ano'
}, {
step: 'all',
label: 'Tudo'
}]
}
},
yaxis: {
autorange: true,
type: 'linear'
}
};
Plotly.plot('chart', data, layout);
});
})
</script>
</html>