HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// create a data table
4
var dataTable = anychart.data.table(0);
5
6
// add data
7
dataTable.addData(getData());
8
9
// map the data for the frist series
10
var mapping_1 = dataTable.mapAs({value: 1});
11
12
// map the data for the second series
13
var mapping_2 = dataTable.mapAs({value: 6});
14
15
// map the data for the tecnical indicator
16
// var mapping_3 = dataTable.mapAs({open: 1, high: 2, low: 3, close: 4});
17
18
// create a stock chart
19
var chart = anychart.stock();
20
21
// create the first plot and and two line series
22
var line_1 = chart.plot(0).line(mapping_1);
23
var line_2 = chart.plot(0).spline(mapping_2);
24
line_1.name("Licenças");
25
// set stroke thickness 5px and apply gradient colors
26
line_1.stroke("3 Red");
27
// line_1.stroke( { keys: [ ".1 blue", ".70 yellow",".80 red"], thickness: 5 });
28
// disable marker on mouse over
29
line_1.hovered().markers(false);
30
// set series name
31
32
33
line_2.name("Conexões");
34
// set stroke thickness 5px, stroke color green and stroke opacity 0.4
35
line_2.stroke("3 blue 0.4");
36
// stroke settings for mouse over the series
37
line_2.hovered().stroke("5 #006600 0.4");
38
// set series name
39
line_2.name("Solid Color with Opacity");
40
41
42
43
chart.selectRange('2021-04-14 12:10:000', '2021-04-15');
44
// create the second plot and a williams %r indicator
45
//chart.plot(1).yScale().minimum(-100);
46
//chart.plot(1).yScale().maximum(0);
47
//chart.plot(1).williamsR(mapping_3, 4, "marker");
48
49
// set the chart title
50
chart.title("Indicação de Licenças e Conexões Ativas do Dominio");
51
chart.background("black");
52
// set the container id
53
chart.container("container");
54
55
56
// initiate drawing the chart
57
chart.draw();
58
function getData() {
59
var format ="EEEE, dd MMMM yyyy";
60
var locale = "pt-br";
61
anychart.format.outputLocale("pt-br");
62
anychart.format.outputDateTimeFormat("EEEE, dd MMMM yyyy");
63
var timeZoneOffset = new Date().getTimezoneOffset();
64
return [
65
['2021-04-14 11:20',58,14,12,0,17,101],
66
['2021-04-14 11:30',59,16,12,0,16,103],
67
['2021-04-14 11:40',58,16,12,0,17,103],
68
['2021-04-14 11:50',60,16,12,0,17,105],
69
['2021-04-14 12:00',61,17,12,0,16,106],
70
['2021-04-14 12:10',72,16,12,0,18,109],
71
['2021-04-14 12:20',75,16,12,0,18,110],
72
['2021-04-14 12:30',80,16,12,0,18,112],
73
['2021-04-14 12:40',85,16,13,0,17,111],
74
['2021-04-14 12:50',50,16,13,0,18,110],
75
[]
76
];
77
}
78
});