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
// set the range series data
2
function rangeData() {
3
return [
4
{
5
name: "Childhood and Education",
6
start: "1971/06/28",
7
end: "1995/09/01"
8
},
9
{
10
name: "Entrepreneur Journey",
11
start: "1983/06/28",
12
end: "2002/03/13"
13
},
14
{
15
name: "Making of Tycoon",
16
start: "2002/03/14",
17
end: "2010/06/28"
18
},
19
{
20
name: "Rise of Tycoon",
21
start: "2010/06/29",
22
end: "2030/01/01"
23
}
24
];
25
}
26
27
// set the moment series data
28
function momentData() {
29
return [
30
["1971/06/28", "Elon Musk was born in South Africa"],
31
["1981/06/28", "Began to learn computer programming on his own"],
32
["1983/06/28", "Sold the code of his game Blastar for $500"],
33
["1990/09/01", "Entered Queen's University in Kingston, Ontario"],
34
["1992/09/01", "Transferred to the University of Pennsylvania"],
35
["1995/06/01", "Received bachelor's degrees in physics and economics"],
36
["1995/09/01", "Started a Ph.D. at Stanford (dropped out in 2 days"],
37
["1995/11/06", "Founded Zip2 with his brother"],
38
["1999/02/01", "Sold Zip2 to Compaq for $307M"],
39
["1999/03/01", "Co-founded X.com"],
40
["2000/03/01", "Merged X.com with Confinity to form PayPal"],
41
["2001/01/01", "Started conceptualizing Mars Oasis"],
42
["2002/03/14", "Founded SpaceX & became its CEO"],
43
["2002/10/03", "Received $175.8M from PayPal's sale to eBay for $1.5B"],
44
["2004/02/01", "Invested $6.5M in Tesla and joined its board as chairman"],
45
["2006/01/01", "SpaceX started to get NASA contracts"],
46
["2008/10/01", "Became CEO at Tesla"],
47
["2010/06/29", "Tesla's first IPO"],
48
["2015/12/11", "Co-founded OpenAI"],
49
["2016/07/01", "Co-founded Neuralink"],
50
["2018/02/21", "Resigned his board seat at OpenAI"],
51
["2021/11/06", "Started selling his Tesla stock (10% for $16.4B by year end)"],
52
["2022/04/13", "Made an offer to buy Twitter"],
53
["2022/07/08", "Withdrew his $44B bid to buy Twitter"]
54
];
55
}
56
57
anychart.onDocumentReady(function () {
58
59
// create a timeline chart
60
let chart = anychart.timeline();
61
62
// create a range series
63
let rangeSeries = chart.range(rangeData());
64
65
// create a moment series
66
let momentSeries = chart.moment(momentData());
67
68
// configure the range series label settings
69
rangeSeries.labels().format("{%name}");
70
71
72
// set the chart title
73
chart.title("Timeline of Elon Musk");
74
75
// set the chart container id
76
chart.container("container");
77
78
// draw the chart
79
chart.draw();
80
81
});