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 chart
4
var chart = anychart.marker();
5
6
// create series, set the data and names
7
chart.marker([[1,1],[1,1],[5,4],[10,1]]).name("Drug 1");
8
chart.marker([[2,3],[1,5],[7,3],[13,6]]).name("Drug 2");
9
chart.marker([[2,1],[1,2],[3,3],[8,1]]).name("Placebo");
10
11
// enable major grids
12
chart.xGrid(true);
13
chart.yGrid(true);
14
15
// enable minor grids
16
chart.xMinorGrid(true);
17
chart.yMinorGrid(true);
18
19
// enable the legend
20
var legend = chart.legend();
21
legend.enabled(true);
22
23
// set the position mode of the legend
24
legend.positionMode("inside");
25
26
// set the padding of the legend
27
legend.padding(35);
28
29
// configure the background of the legend
30
legend.background().enabled(true);
31
legend.background().fill("white");
32
legend.background().stroke("3 #96a6a6");
33
34
// enable the drag-and-drop mode of the legend
35
legend.drag(true);
36
37
// set the chart title
38
chart.title("Legend: Position (Drag and Drop)");
39
40
// set the container id
41
chart.container("container");
42
43
// initiate drawing the chart
44
chart.draw();
45
});