-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathv3-migration.html
144 lines (144 loc) · 77.3 KB
/
v3-migration.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
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
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>3.x Migration Guide | Chart.js</title>
<meta name="generator" content="VuePress 1.8.2">
<link rel="icon" href="/docs/3.0.2/favicon.ico">
<meta name="description" content="Open source HTML5 Charts for your website">
<link rel="preload" href="/docs/3.0.2/assets/css/0.styles.167a146f.css" as="style"><link rel="preload" href="/docs/3.0.2/assets/js/app.6bf3e574.js" as="script"><link rel="preload" href="/docs/3.0.2/assets/js/2.12eeefd0.js" as="script"><link rel="preload" href="/docs/3.0.2/assets/js/171.768b5d41.js" as="script"><link rel="prefetch" href="/docs/3.0.2/assets/js/10.f55d851f.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/100.5a2b4083.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/101.a8bd2fd6.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/102.33de6359.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/103.dcd6e6a8.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/104.ab312fc7.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/105.fe2ab4d8.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/106.844a25c8.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/107.c9dc1e9f.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/108.82506a18.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/109.b0e20f43.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/11.67874f70.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/110.b8b023a0.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/111.58611ea7.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/112.68f2bf20.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/113.5b83557e.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/114.de507144.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/115.c01286e9.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/116.9133c3d6.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/117.817f6928.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/118.ed3f7f4b.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/119.feab2cb9.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/12.9b4f7770.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/120.03b3fe04.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/121.42b2e1ce.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/122.b27deca9.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/123.96f9d31a.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/124.58a56890.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/125.1eff684f.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/126.29a12744.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/127.dd00ecf0.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/128.69f5df01.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/129.fc7fc8eb.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/13.ddb3bad1.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/130.2cddc6bc.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/131.5d950ccb.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/132.bbcde3ea.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/133.03c6022a.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/134.eee9bdf0.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/135.00d3cbf8.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/136.8b7ca46d.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/137.16730f4f.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/138.c80b94bf.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/139.1af1b0e9.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/14.786e1df3.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/140.c3bb74e5.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/141.61ca28e4.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/142.4342b55d.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/143.9b450ab1.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/144.ed5e512d.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/145.e2f10961.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/146.334a9029.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/147.6d3772ec.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/148.766fb0dd.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/149.8100460f.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/15.b7622cdd.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/150.cccfe07a.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/151.9f081aa2.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/152.8fcae040.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/153.d0ab58ef.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/154.41802f1f.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/155.7b5d27f7.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/156.2001c869.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/157.1a51ea68.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/158.c5bf9ad2.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/159.0b250f19.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/16.31031a70.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/160.0c467e6b.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/161.68add810.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/162.c15a29e3.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/163.5e4b9ebc.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/164.c9c5494f.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/165.89549850.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/166.8d8708ca.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/167.21188ed0.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/168.e7fcb785.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/169.2e1ae395.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/17.4a4ab226.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/170.3f395d77.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/172.9a11b3c3.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/173.e4fb8b19.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/174.174d16ed.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/175.2f6df83e.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/176.5db1df68.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/177.0053a62a.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/178.1e9d6703.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/179.4857aad6.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/18.a655d142.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/180.22a23b11.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/181.8a0de9b0.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/182.a76d6f40.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/183.4634b478.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/184.8b9c4a50.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/185.76abf744.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/186.3c4ae66b.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/187.e1224b84.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/188.96a509b9.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/189.b8f127e2.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/19.fb7fa61b.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/190.d9b8d424.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/191.705d8100.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/192.e27c8c2b.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/193.ab64e843.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/194.599ef9ab.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/195.fbfa58f1.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/196.294e2e17.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/197.007958a4.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/198.964f2a0d.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/199.c938e529.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/20.930cfd43.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/200.6c8fa006.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/201.22bf47f7.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/202.f05fd735.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/203.40e5faf8.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/204.e4170100.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/205.f6a60ab7.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/206.e0444609.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/207.c4c294db.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/208.608452e3.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/209.20ede83c.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/21.15ba6125.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/210.e4b3215d.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/211.2c162163.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/212.6daefd06.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/213.e1b152e7.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/214.941335ea.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/215.ae7534f2.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/216.7544b48c.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/217.a8362f2a.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/218.fb96e694.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/219.69504106.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/22.978b7698.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/220.c33985a0.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/221.430616f8.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/222.7768dae1.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/223.8eac8940.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/224.b8c3db68.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/225.5cbe34a4.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/226.69c39cd5.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/227.613b3299.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/228.daef258f.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/229.dc424698.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/23.f045b7d5.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/230.47f0c3d6.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/231.ab2bbc56.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/232.bb6d33b0.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/233.367abe20.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/234.b747a7d8.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/24.850410b2.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/25.b5f565d9.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/26.c5c22a4c.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/27.23acbdb5.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/28.07bb33d9.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/29.63a97f92.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/3.1e2ae757.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/30.316932ca.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/31.3d009e47.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/32.776c4897.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/33.1efe12b6.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/34.dfe0220f.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/35.26d29494.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/36.3c2dab63.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/37.bcfed940.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/38.6b061c3b.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/39.76b8ae63.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/4.f8e1d93a.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/40.06a26a64.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/41.6ba4364b.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/42.184a7d24.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/43.8c0a716b.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/44.d26c9fe0.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/45.77a28295.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/46.6f06287f.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/47.6e53b561.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/48.8e1d5cb2.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/49.3ce97abc.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/5.daa1afc5.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/50.3e595639.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/51.74c8cad5.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/52.50aab8f2.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/53.3cf560b7.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/54.b64ee725.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/55.c2e4a1e9.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/56.0839c5b3.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/57.c8d466a5.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/58.1ce0cb32.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/59.0dfdfcfd.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/6.2fe7a141.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/60.d7d3d88e.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/61.3c65d8c8.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/62.3cc430e5.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/63.025e6cab.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/64.247ac42c.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/65.82a7e08a.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/66.e033b420.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/67.eb80c45d.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/68.3363dc6e.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/69.c24e86f0.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/7.5cbdfd1a.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/70.c1caf1e9.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/71.c75306a6.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/72.eabeb206.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/73.34096c84.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/74.5f3e4d40.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/75.14e9b640.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/76.c5001b44.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/77.51ead747.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/78.8fbeff5d.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/79.0edca19e.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/8.0c01ed67.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/80.c9634a4a.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/81.91070473.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/82.2a64735e.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/83.de0b2465.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/84.c99126e7.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/85.1475c46c.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/86.18036556.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/87.04f88421.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/88.0d16de9f.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/89.6a772841.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/9.f775722e.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/90.c0a9f4b8.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/91.3eefbace.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/92.00fa6b37.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/93.14b30d30.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/94.5cedcb30.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/95.ebc9461c.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/96.dffe6b71.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/97.78ce5f2e.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/98.a74daec6.js"><link rel="prefetch" href="/docs/3.0.2/assets/js/99.db67cd85.js">
<link rel="stylesheet" href="/docs/3.0.2/assets/css/0.styles.167a146f.css">
</head>
<body>
<div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/docs/3.0.2/" class="home-link router-link-active"><img src="/docs/3.0.2/favicon.ico" alt="Chart.js" class="logo"> <span class="site-name can-hide">Chart.js</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/docs/3.0.2/" class="nav-link">
Home
</a></div><div class="nav-item"><a href="/docs/3.0.2/api/" class="nav-link">
API
</a></div><div class="nav-item"><a href="/docs/3.0.2/samples/" class="nav-link">
Samples
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Community Menu" class="dropdown-title"><span class="title">Ecosystem</span> <span class="arrow down"></span></button> <button type="button" aria-label="Community Menu" class="mobile-dropdown-title"><span class="title">Ecosystem</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://github.com/chartjs/awesome" target="_blank" rel="noopener noreferrer" class="nav-link external">
Awesome
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://chartjs-slack.herokuapp.com/" target="_blank" rel="noopener noreferrer" class="nav-link external">
Slack
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://stackoverflow.com/questions/tagged/chart.js" target="_blank" rel="noopener noreferrer" class="nav-link external">
Stack Overflow
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <a href="https://github.com/chartjs/Chart.js" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/docs/3.0.2/" class="nav-link">
Home
</a></div><div class="nav-item"><a href="/docs/3.0.2/api/" class="nav-link">
API
</a></div><div class="nav-item"><a href="/docs/3.0.2/samples/" class="nav-link">
Samples
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Community Menu" class="dropdown-title"><span class="title">Ecosystem</span> <span class="arrow down"></span></button> <button type="button" aria-label="Community Menu" class="mobile-dropdown-title"><span class="title">Ecosystem</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://github.com/chartjs/awesome" target="_blank" rel="noopener noreferrer" class="nav-link external">
Awesome
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://chartjs-slack.herokuapp.com/" target="_blank" rel="noopener noreferrer" class="nav-link external">
Slack
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://stackoverflow.com/questions/tagged/chart.js" target="_blank" rel="noopener noreferrer" class="nav-link external">
Stack Overflow
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <a href="https://github.com/chartjs/Chart.js" target="_blank" rel="noopener noreferrer" class="repo-link">
GitHub
<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav> <ul class="sidebar-links"><li><a href="/docs/3.0.2/" aria-current="page" class="sidebar-link">Chart.js</a></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading open"><span>Getting Started</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/docs/3.0.2/getting-started/" aria-current="page" class="sidebar-link">Getting Started</a></li><li><a href="/docs/3.0.2/getting-started/installation.html" class="sidebar-link">Installation</a></li><li><a href="/docs/3.0.2/getting-started/integration.html" class="sidebar-link">Integration</a></li><li><a href="/docs/3.0.2/getting-started/usage.html" class="sidebar-link">Usage</a></li><li><a href="/docs/3.0.2/getting-started/v3-migration.html" aria-current="page" class="active sidebar-link">3.x Migration Guide</a></li></ul></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>General</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Configuration</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Chart Types</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Axes</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0"><p class="sidebar-heading"><span>Developers</span> <span class="arrow right"></span></p> <!----></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="_3-x-migration-guide"><a href="#_3-x-migration-guide" class="header-anchor">#</a> 3.x Migration Guide</h1> <p>Chart.js 3.0 introduces a number of breaking changes. Chart.js 2.0 was released in April 2016. In the years since then, as Chart.js has grown in popularity and feature set, we've learned some lessons about how to better create a charting library. In order to improve performance, offer new features, and improve maintainability, it was necessary to break backwards compatibility, but we aimed to do so only when worth the benefit. Some major highlights of v3 include:</p> <ul><li>Large <a href="/docs/3.0.2/general/performance.html">performance</a> improvements including the ability to skip data parsing and render charts in parallel via webworkers</li> <li>Additional configurability and scriptable options with better defaults</li> <li>Completely rewritten animation system</li> <li>Rewritten filler plugin with numerous bug fixes</li> <li>Documentation migrated from GitBook to Vuepress</li> <li>API documentation generated and verified by TypeDoc</li> <li>No more CSS injection</li> <li>Tons of bug fixes</li> <li>Tree shaking</li></ul> <h2 id="end-user-migration"><a href="#end-user-migration" class="header-anchor">#</a> End user migration</h2> <h3 id="setup-and-installation"><a href="#setup-and-installation" class="header-anchor">#</a> Setup and installation</h3> <ul><li>Distributed files are now in lower case. For example: <code>dist/chart.js</code>.</li> <li>Chart.js is no longer providing the <code>Chart.bundle.js</code> and <code>Chart.bundle.min.js</code>. Please see the <a href="/docs/3.0.2/getting-started/installation.html">installation</a> and <a href="/docs/3.0.2/getting-started/integration.html">integration</a> docs for details on the recommended way to setup Chart.js if you were using these builds.</li> <li><code>moment</code> is no longer specified as an npm dependency. If you are using the <code>time</code> or <code>timeseries</code> scales, you must include one of <a href="https://github.com/chartjs/awesome#adapters" target="_blank" rel="noopener noreferrer">the available adapters<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> and corresponding date library. You no longer need to exclude moment from your build.</li> <li>The <code>Chart</code> constructor will throw an error if the canvas/context provided is already in use</li> <li>Chart.js 3 is tree-shakeable. So if you are using it as an <code>npm</code> module in a project and want to make use of this feature, you need to import and register the controllers, elements, scales and plugins you want to use. You will not have to call <code>register</code> if importing Chart.js via a <code>script</code> tag or from the <a href="/docs/3.0.2/getting-started/integration.html#bundlers-webpack-rollup-etc"><code>auto</code></a> register path as an <code>npm</code> module, in this case you will not get the tree shaking benefits. Here is an example of registering components:</li></ul> <div class="language-javascript extra-class"><pre class="language-javascript"><code><span class="token keyword">import</span> <span class="token punctuation">{</span> Chart<span class="token punctuation">,</span> LineController<span class="token punctuation">,</span> LineElement<span class="token punctuation">,</span> PointElement<span class="token punctuation">,</span> LinearScale<span class="token punctuation">,</span> Title <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">chart.js</span><span class="token template-punctuation string">`</span></span>
Chart<span class="token punctuation">.</span><span class="token function">register</span><span class="token punctuation">(</span>LineController<span class="token punctuation">,</span> LineElement<span class="token punctuation">,</span> PointElement<span class="token punctuation">,</span> LinearScale<span class="token punctuation">,</span> Title<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> chart <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Chart</span><span class="token punctuation">(</span>ctx<span class="token punctuation">,</span> <span class="token punctuation">{</span>
type<span class="token operator">:</span> <span class="token string">'line'</span><span class="token punctuation">,</span>
<span class="token comment">// data: ...</span>
options<span class="token operator">:</span> <span class="token punctuation">{</span>
plugins<span class="token operator">:</span> <span class="token punctuation">{</span>
title<span class="token operator">:</span> <span class="token punctuation">{</span>
display<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
text<span class="token operator">:</span> <span class="token string">'Chart Title'</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
scales<span class="token operator">:</span> <span class="token punctuation">{</span>
x<span class="token operator">:</span> <span class="token punctuation">{</span>
type<span class="token operator">:</span> <span class="token string">'linear'</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
y<span class="token operator">:</span> <span class="token punctuation">{</span>
type<span class="token operator">:</span> <span class="token string">'linear'</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
</code></pre></div><h3 id="chart-types"><a href="#chart-types" class="header-anchor">#</a> Chart types</h3> <ul><li><code>horizontalBar</code> chart type was removed. Horizontal bar charts can be configured using the new <a href="/docs/3.0.2/getting-started/charts/bar.html#horizontal-bar-chart"><code>indexAxis</code></a> option</li></ul> <h3 id="options"><a href="#options" class="header-anchor">#</a> Options</h3> <p>A number of changes were made to the configuration options passed to the <code>Chart</code> constructor. Those changes are documented below.</p> <h4 id="generic-changes"><a href="#generic-changes" class="header-anchor">#</a> Generic changes</h4> <ul><li>Indexable options are now looping. <code>backgroundColor: ['red', 'green']</code> will result in alternating <code>'red'</code> / <code>'green'</code> if there are more than 2 data points.</li> <li>The input properties of object data can now be freely specified, see <a href="/docs/3.0.2/general/data-structures.html">data structures</a> for details.</li> <li>Most options are resolved utilizing proxies, instead merging with defaults. In addition to easily enabling different resolution routes for different contexts, it allows using other resolved options in scriptable options.
<ul><li>Options are by default scriptable and indexable, unless disabled for some reason.</li> <li>Scriptable options receive a option reolver as second parameter for accessing other options in same context.</li> <li>Resolution falls to upper scopes, if no match is found earlier. See <a href="/docs/3.0.2/getting-started/general/options.html">options</a> for details.</li></ul></li></ul> <h4 id="specific-changes"><a href="#specific-changes" class="header-anchor">#</a> Specific changes</h4> <ul><li><code>elements.rectangle</code> is now <code>elements.bar</code></li> <li><code>hover.animationDuration</code> is now configured in <code>animation.active.duration</code></li> <li><code>responsiveAnimationDuration</code> is now configured in <code>animation.resize.duration</code></li> <li>Polar area <code>elements.arc.angle</code> is now configured in degrees instead of radians.</li> <li>Polar area <code>startAngle</code> option is now consistent with <code>Radar</code>, 0 is at top and value is in degrees. Default is changed from <code>-½π</code> to <code>0</code>.</li> <li>Doughnut <code>rotation</code> option is now in degrees and 0 is at top. Default is changed from <code>-½π</code> to <code>0</code>.</li> <li>Doughnut <code>circumference</code> option is now in degrees. Default is changed from <code>2π</code> to <code>360</code>.</li> <li>Doughnut <code>cutoutPercentage</code> was renamed to <code>cutout</code>and accepts pixels as numer and percent as string ending with <code>%</code>.</li> <li><code>scale</code> option was removed in favor of <code>options.scales.r</code> (or any other scale id, with <code>axis: 'r'</code>)</li> <li><code>scales.[x/y]Axes</code> arrays were removed. Scales are now configured directly to <code>options.scales</code> object with the object key being the scale Id.</li> <li><code>scales.[x/y]Axes.barPercentage</code> was moved to dataset option <code>barPercentage</code></li> <li><code>scales.[x/y]Axes.barThickness</code> was moved to dataset option <code>barThickness</code></li> <li><code>scales.[x/y]Axes.categoryPercentage</code> was moved to dataset option <code>categoryPercentage</code></li> <li><code>scales.[x/y]Axes.maxBarThickness</code> was moved to dataset option <code>maxBarThickness</code></li> <li><code>scales.[x/y]Axes.minBarLength</code> was moved to dataset option <code>minBarLength</code></li> <li><code>scales.[x/y]Axes.scaleLabel</code> was renamed to <code>scales[id].title</code></li> <li><code>scales.[x/y]Axes.scaleLabel.labelString</code> was renamed to <code>scales[id].title.text</code></li> <li><code>scales.[x/y]Axes.ticks.beginAtZero</code> was renamed to <code>scales[id].beginAtZero</code></li> <li><code>scales.[x/y]Axes.ticks.max</code> was renamed to <code>scales[id].max</code></li> <li><code>scales.[x/y]Axes.ticks.min</code> was renamed to <code>scales[id].min</code></li> <li><code>scales.[x/y]Axes.ticks.reverse</code> was renamed to <code>scales[id].reverse</code></li> <li><code>scales.[x/y]Axes.ticks.suggestedMax</code> was renamed to <code>scales[id].suggestedMax</code></li> <li><code>scales.[x/y]Axes.ticks.suggestedMin</code> was renamed to <code>scales[id].suggestedMin</code></li> <li><code>scales.[x/y]Axes.ticks.unitStepSize</code> was removed. Use <code>scales[id].ticks.stepSize</code></li> <li><code>scales.[x/y]Axes.ticks.userCallback</code> was renamed to <code>scales[id].ticks.callback</code></li> <li><code>scales.[x/y]Axes.time.format</code> was renamed to <code>scales[id].time.parser</code></li> <li><code>scales.[x/y]Axes.time.max</code> was renamed to <code>scales[id].max</code></li> <li><code>scales.[x/y]Axes.time.min</code> was renamed to <code>scales[id].min</code></li> <li><code>scales.[x/y]Axes.zeroLine*</code> options of axes were removed. Use scriptable scale options instead.</li> <li>The dataset option <code>steppedLine</code> was removed. Use <code>stepped</code></li> <li>The chart option <code>showLines</code> was renamed to <code>showLine</code> to match the dataset option.</li> <li>The chart option <code>startAngle</code> was moved to <code>radial</code> scale options.</li> <li>To override the platform class used in a chart instance, pass <code>platform: PlatformClass</code> in the config object. Note that the class should be passed, not an instance of the class.</li> <li><code>aspectRatio</code> defaults to 1 for doughnut, pie, polarArea, and radar charts</li> <li><code>TimeScale</code> does not read <code>t</code> from object data by default anymore. The default property is <code>x</code> or <code>y</code>, depending on the orientation. See <a href="/docs/3.0.2/general/data-structures.html">data structures</a> for details on how to change the default.</li> <li><code>tooltips</code> namespace was renamed to <code>tooltip</code> to match the plugin name</li> <li><code>legend</code>, <code>title</code> and <code>tooltip</code> namespaces were moved from <code>options</code> to <code>options.plugins</code>.</li> <li><code>tooltips.custom</code> was renamed to <code>plugins.tooltip.external</code></li></ul> <h4 id="defaults"><a href="#defaults" class="header-anchor">#</a> Defaults</h4> <ul><li><code>global</code> namespace was removed from <code>defaults</code>. So <code>Chart.defaults.global</code> is now <code>Chart.defaults</code></li> <li>Dataset controller defaults were relocate to <code>overrides</code>. For example <code>Chart.defaults.line</code> is now <code>Chart.overrides.line</code></li> <li><code>default</code> prefix was removed from defaults. For example <code>Chart.defaults.global.defaultColor</code> is now <code>Chart.defaults.color</code></li> <li><code>defaultColor</code> was split to <code>color</code>, <code>borderColor</code> and <code>backgroundColor</code></li> <li><code>defaultFontColor</code> was renamed to <code>color</code></li> <li><code>defaultFontFamily</code> was renamed to <code>font.family</code></li> <li><code>defaultFontSize</code> was renamed to <code>font.size</code></li> <li><code>defaultFontStyle</code> was renamed to <code>font.style</code></li> <li><code>defaultLineHeight</code> was renamed to <code>font.lineHeight</code></li> <li>Horizontal Bar default tooltip mode was changed from <code>'index'</code> to <code>'nearest'</code> to match vertical bar charts</li> <li><code>legend</code>, <code>title</code> and <code>tooltip</code> namespaces were moved from <code>Chart.defaults</code> to <code>Chart.defaults.plugins</code>.</li> <li><code>elements.line.fill</code> default changed from <code>true</code> to <code>false</code>.</li> <li>Line charts no longer override the default <code>interaction</code> mode. Default is changed from <code>'index'</code> to <code>'nearest'</code>.</li></ul> <h4 id="scales"><a href="#scales" class="header-anchor">#</a> Scales</h4> <p>The configuration options for scales is the largest change in v3. The <code>xAxes</code> and <code>yAxes</code> arrays were removed and axis options are individual scales now keyed by scale ID.</p> <p>The v2 configuration below is shown with it's new v3 configuration</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code>options<span class="token operator">:</span> <span class="token punctuation">{</span>
scales<span class="token operator">:</span> <span class="token punctuation">{</span>
xAxes<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>
id<span class="token operator">:</span> <span class="token string">'x'</span><span class="token punctuation">,</span>
type<span class="token operator">:</span> <span class="token string">'time'</span><span class="token punctuation">,</span>
display<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
title<span class="token operator">:</span> <span class="token punctuation">{</span>
display<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
text<span class="token operator">:</span> <span class="token string">'Date'</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
ticks<span class="token operator">:</span> <span class="token punctuation">{</span>
major<span class="token operator">:</span> <span class="token punctuation">{</span>
enabled<span class="token operator">:</span> <span class="token boolean">true</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token function-variable function">font</span><span class="token operator">:</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">context</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>context<span class="token punctuation">.</span>tick <span class="token operator">&&</span> context<span class="token punctuation">.</span>tick<span class="token punctuation">.</span>major<span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword">return</span> <span class="token punctuation">{</span>
style<span class="token operator">:</span> <span class="token string">'bold'</span><span class="token punctuation">,</span>
color<span class="token operator">:</span> <span class="token string">'#FF0000'</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
yAxes<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>
id<span class="token operator">:</span> <span class="token string">'y'</span><span class="token punctuation">,</span>
display<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
title<span class="token operator">:</span> <span class="token punctuation">{</span>
display<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
text<span class="token operator">:</span> <span class="token string">'value'</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">]</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre></div><p>And now, in v3:</p> <div class="language-javascript extra-class"><pre class="language-javascript"><code>options<span class="token operator">:</span> <span class="token punctuation">{</span>
scales<span class="token operator">:</span> <span class="token punctuation">{</span>
x<span class="token operator">:</span> <span class="token punctuation">{</span>
type<span class="token operator">:</span> <span class="token string">'time'</span><span class="token punctuation">,</span>
display<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
title<span class="token operator">:</span> <span class="token punctuation">{</span>
display<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
text<span class="token operator">:</span> <span class="token string">'Date'</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
ticks<span class="token operator">:</span> <span class="token punctuation">{</span>
major<span class="token operator">:</span> <span class="token punctuation">{</span>
enabled<span class="token operator">:</span> <span class="token boolean">true</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token function-variable function">color</span><span class="token operator">:</span> <span class="token punctuation">(</span><span class="token parameter">context</span><span class="token punctuation">)</span> <span class="token operator">=></span> context<span class="token punctuation">.</span>tick <span class="token operator">&&</span> context<span class="token punctuation">.</span>tick<span class="token punctuation">.</span>major <span class="token operator">&&</span> <span class="token string">'#FF0000'</span><span class="token punctuation">,</span>
<span class="token function-variable function">font</span><span class="token operator">:</span> <span class="token keyword">function</span><span class="token punctuation">(</span><span class="token parameter">context</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword">if</span> <span class="token punctuation">(</span>context<span class="token punctuation">.</span>tick <span class="token operator">&&</span> context<span class="token punctuation">.</span>tick<span class="token punctuation">.</span>major<span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword">return</span> <span class="token punctuation">{</span>
style<span class="token operator">:</span> <span class="token string">'bold'</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
y<span class="token operator">:</span> <span class="token punctuation">{</span>
display<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
title<span class="token operator">:</span> <span class="token punctuation">{</span>
display<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
text<span class="token operator">:</span> <span class="token string">'value'</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre></div><ul><li>The time scale option <code>distribution: 'series'</code> was removed and a new scale type <code>timeseries</code> was introduced in its place</li> <li>In the time scale, <code>autoSkip</code> is now enabled by default for consistency with the other scales</li></ul> <h4 id="animations"><a href="#animations" class="header-anchor">#</a> Animations</h4> <p>Animation system was completely rewritten in Chart.js v3. Each property can now be animated separately. Please see <a href="/docs/3.0.2/configuration/animations.html">animations</a> docs for details.</p> <h4 id="customizability"><a href="#customizability" class="header-anchor">#</a> Customizability</h4> <ul><li><code>custom</code> attribute of elements was removed. Please use scriptable options</li> <li>The <code>hover</code> property of scriptable options <code>context</code> object was renamed to <code>active</code> to align it with the datalabels plugin.</li></ul> <h4 id="interactions"><a href="#interactions" class="header-anchor">#</a> Interactions</h4> <ul><li>To allow DRY configuration, a root options scope for common interaction options was added. <code>options.hover</code> and <code>options.plugins.tooltip</code> now both extend from <code>options.interaction</code>. Defaults are defined at <code>defaults.interaction</code> level, so by default hover and tooltip interactions share the same mode etc.</li> <li><code>interactions</code> are now limited to the chart area + allowed overflow</li> <li><code>{mode: 'label'}</code> was replaced with <code>{mode: 'index'}</code></li> <li><code>{mode: 'single'}</code> was replaced with <code>{mode: 'nearest', intersect: true}</code></li> <li><code>modes['X-axis']</code> was replaced with <code>{mode: 'index', intersect: false}</code></li> <li><code>options.onClick</code> is now limited to the chart area</li> <li><code>options.onClick</code> and <code>options.onHover</code> now receive the <code>chart</code> instance as a 3rd argument</li> <li><code>options.onHover</code> now receives a wrapped <code>event</code> as the first parameter. The previous first parameter value is accessible via <code>event.native</code>.</li> <li><code>options.hover.onHover</code> was removed, use <code>options.onHover</code>.</li></ul> <h4 id="ticks"><a href="#ticks" class="header-anchor">#</a> Ticks</h4> <ul><li><code>options.gridLines</code> was renamed to <code>options.grid</code></li> <li><code>options.gridLines.offsetGridLines</code> was renamed to <code>options.grid.offset</code>.</li> <li><code>options.gridLines.tickMarkLength</code> was renamed to <code>options.grid.tickLength</code>.</li> <li><code>options.ticks.fixedStepSize</code> is no longer used. Use <code>options.ticks.stepSize</code>.</li> <li><code>options.ticks.major</code> and <code>options.ticks.minor</code> were replaced with scriptable options for tick fonts.</li> <li><code>Chart.Ticks.formatters.linear</code> was renamed to <code>Chart.Ticks.formatters.numeric</code>.</li> <li><code>options.ticks.backdropPaddingX</code> and <code>options.ticks.backdropPaddingY</code> were replaced with <code>options.ticks.backdropPadding</code> in the radial linear scale.</li></ul> <h4 id="tooltip"><a href="#tooltip" class="header-anchor">#</a> Tooltip</h4> <ul><li><code>xLabel</code> and <code>yLabel</code> were removed. Please use <code>label</code> and <code>formattedValue</code></li> <li>The <code>filter</code> option will now be passed additional parameters when called and should have the method signature <code>function(tooltipItem, index, tooltipItems, data)</code></li> <li>The <code>custom</code> callback now takes a context object that has <code>tooltip</code> and <code>chart</code> properties</li> <li>All properties of tooltip model related to the tooltip options have been moved to reside within the <code>options</code> property.</li> <li>The callbacks no longer are given a <code>data</code> parameter. The tooltip item parameter contains the chart and dataset instead</li> <li>The tooltip item's <code>index</code> parameter was renamed to <code>dataIndex</code> and <code>value</code> was renamed to <code>formattedValue</code></li> <li>The <code>xPadding</code> and <code>yPadding</code> options were merged into a single <code>padding</code> object</li></ul> <h2 id="developer-migration"><a href="#developer-migration" class="header-anchor">#</a> Developer migration</h2> <p>While the end-user migration for Chart.js 3 is fairly straight-forward, the developer migration can be more complicated. Please reach out for help in the #dev <a href="https://chartjs-slack.herokuapp.com/" target="_blank" rel="noopener noreferrer">Slack<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> channel if tips on migrating would be helpful.</p> <p>Some of the biggest things that have changed:</p> <ul><li>There is a completely rewritten and more performant animation system.
<ul><li><code>Element._model</code> and <code>Element._view</code> are no longer used and properties are now set directly on the elements. You will have to use the method <code>getProps</code> to access these properties inside most methods such as <code>inXRange</code>/<code>inYRange</code> and <code>getCenterPoint</code>. Please take a look at <a href="https://github.com/chartjs/Chart.js/tree/master/src/elements" target="_blank" rel="noopener noreferrer">the Chart.js-provided elements<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> for examples.</li> <li>When building the elements in a controller, it's now suggested to call <code>updateElement</code> to provide the element properties. There are also methods such as <code>getSharedOptions</code> and <code>includeOptions</code> that have been added to skip redundant computation. Please take a look at <a href="https://github.com/chartjs/Chart.js/tree/master/src/controllers" target="_blank" rel="noopener noreferrer">the Chart.js-provided controllers<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> for examples.</li></ul></li> <li>Scales introduced a new parsing API. This API takes user data and converts it into a more standard format. E.g. it allows users to provide numeric data as a <code>string</code> and converts it to a <code>number</code> where necessary. Previously this was done on the fly as charts were rendered. Now it's done up front with the ability to skip it for better performance if users provide data in the correct format. If you're using standard data format like <code>x</code>/<code>y</code> you may not need to do anything. If you're using a custom data format you will have to override some of the parse methods in <code>core.datasetController.js</code>. An example can be found in <a href="https://github.com/chartjs/chartjs-chart-financial" target="_blank" rel="noopener noreferrer">chartjs-chart-financial<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>, which uses an <code>{o, h, l, c}</code> data format.</li></ul> <p>A few changes were made to controllers that are more straight-forward, but will affect all controllers:</p> <ul><li>Options:
<ul><li><code>global</code> was removed from the defaults namespace as it was unnecessary and sometimes inconsistent</li> <li>Dataset defaults are now under the chart type options instead of vice-versa. This was not able to be done when introduced in 2.x for backwards compatibility. Fixing it removes the biggest stumbling block that new chart developers encountered</li> <li>Scale default options need to be updated as described in the end user migration section (e.g. <code>x</code> instead of <code>xAxes</code> and <code>y</code> instead of <code>yAxes</code>)</li></ul></li> <li><code>updateElement</code> was changed to <code>updateElements</code> and has a new method signature as described below. This provides performance enhancements such as allowing easier reuse of computations that are common to all elements and reducing the number of function calls</li></ul> <h3 id="removed"><a href="#removed" class="header-anchor">#</a> Removed</h3> <p>The following properties and methods were removed:</p> <h4 id="removed-from-chart"><a href="#removed-from-chart" class="header-anchor">#</a> Removed from Chart</h4> <ul><li><code>Chart.animationService</code></li> <li><code>Chart.active</code></li> <li><code>Chart.borderWidth</code></li> <li><code>Chart.chart.chart</code></li> <li><code>Chart.Bar</code>. New charts are created via <code>new Chart</code> and providing the appropriate <code>type</code> parameter</li> <li><code>Chart.Bubble</code>. New charts are created via <code>new Chart</code> and providing the appropriate <code>type</code> parameter</li> <li><code>Chart.Chart</code></li> <li><code>Chart.Controller</code></li> <li><code>Chart.Doughnut</code>. New charts are created via <code>new Chart</code> and providing the appropriate <code>type</code> parameter</li> <li><code>Chart.innerRadius</code> now lives on doughnut, pie, and polarArea controllers</li> <li><code>Chart.lastActive</code></li> <li><code>Chart.Legend</code> was moved to <code>Chart.plugins.legend._element</code> and made private</li> <li><code>Chart.Line</code>. New charts are created via <code>new Chart</code> and providing the appropriate <code>type</code> parameter</li> <li><code>Chart.LinearScaleBase</code> now must be imported and cannot be accessed off the <code>Chart</code> object</li> <li><code>Chart.offsetX</code></li> <li><code>Chart.offsetY</code></li> <li><code>Chart.outerRadius</code> now lives on doughnut, pie, and polarArea controllers</li> <li><code>Chart.plugins</code> was replaced with <code>Chart.registry</code>. Plugin defaults are now in <code>Chart.defaults.plugins[id]</code>.</li> <li><code>Chart.plugins.register</code> was replaced by <code>Chart.register</code>.</li> <li><code>Chart.PolarArea</code>. New charts are created via <code>new Chart</code> and providing the appropriate <code>type</code> parameter</li> <li><code>Chart.prototype.generateLegend</code></li> <li><code>Chart.platform</code>. It only contained <code>disableCSSInjection</code>. CSS is never injected in v3.</li> <li><code>Chart.PluginBase</code></li> <li><code>Chart.Radar</code>. New charts are created via <code>new Chart</code> and providing the appropriate <code>type</code> parameter</li> <li><code>Chart.radiusLength</code></li> <li><code>Chart.scaleService</code> was replaced with <code>Chart.registry</code>. Scale defaults are now in <code>Chart.defaults.scales[type]</code>.</li> <li><code>Chart.Scatter</code>. New charts are created via <code>new Chart</code> and providing the appropriate <code>type</code> parameter</li> <li><code>Chart.types</code></li> <li><code>Chart.Title</code> was moved to <code>Chart.plugins.title._element</code> and made private</li> <li><code>Chart.Tooltip</code> is now provided by the tooltip plugin. The positioners can be accessed from <code>tooltipPlugin.positioners</code></li> <li><code>ILayoutItem.minSize</code></li></ul> <h4 id="removed-from-dataset-controllers"><a href="#removed-from-dataset-controllers" class="header-anchor">#</a> Removed from Dataset Controllers</h4> <ul><li><code>BarController.getDatasetMeta().bar</code></li> <li><code>DatasetController.addElementAndReset</code></li> <li><code>DatasetController.createMetaData</code></li> <li><code>DatasetController.createMetaDataset</code></li> <li><code>DoughnutController.getRingIndex</code></li></ul> <h4 id="removed-from-elements"><a href="#removed-from-elements" class="header-anchor">#</a> Removed from Elements</h4> <ul><li><code>Element.getArea</code></li> <li><code>Element.height</code></li> <li><code>Element.hidden</code> was replaced by chart level status, usable with <code>getDataVisibility(index)</code> / <code>toggleDataVisibility(index)</code></li> <li><code>Element.initialize</code></li> <li><code>Element.inLabelRange</code></li> <li><code>Line.calculatePointY</code></li></ul> <h4 id="removed-from-helpers"><a href="#removed-from-helpers" class="header-anchor">#</a> Removed from Helpers</h4> <ul><li><code>helpers.addEvent</code></li> <li><code>helpers.aliasPixel</code></li> <li><code>helpers.arrayEquals</code></li> <li><code>helpers.configMerge</code></li> <li><code>helpers.findIndex</code></li> <li><code>helpers.findNextWhere</code></li> <li><code>helpers.findPreviousWhere</code></li> <li><code>helpers.extend</code>. Use <code>Object.assign</code> instead</li> <li><code>helpers.getValueAtIndexOrDefault</code>. Use <code>helpers.resolve</code> instead.</li> <li><code>helpers.indexOf</code></li> <li><code>helpers.lineTo</code></li> <li><code>helpers.longestText</code> was made private</li> <li><code>helpers.max</code></li> <li><code>helpers.measureText</code> was made private</li> <li><code>helpers.min</code></li> <li><code>helpers.nextItem</code></li> <li><code>helpers.niceNum</code></li> <li><code>helpers.numberOfLabelLines</code></li> <li><code>helpers.previousItem</code></li> <li><code>helpers.removeEvent</code></li> <li><code>helpers.roundedRect</code></li> <li><code>helpers.scaleMerge</code></li> <li><code>helpers.where</code></li></ul> <h4 id="removed-from-layout"><a href="#removed-from-layout" class="header-anchor">#</a> Removed from Layout</h4> <ul><li><code>Layout.defaults</code></li></ul> <h4 id="removed-from-scales"><a href="#removed-from-scales" class="header-anchor">#</a> Removed from Scales</h4> <ul><li><code>LinearScaleBase.handleDirectionalChanges</code></li> <li><code>LogarithmicScale.minNotZero</code></li> <li><code>Scale.getRightValue</code></li> <li><code>Scale.longestLabelWidth</code></li> <li><code>Scale.longestTextCache</code> is now private</li> <li><code>Scale.margins</code> is now private</li> <li><code>Scale.mergeTicksOptions</code></li> <li><code>Scale.ticksAsNumbers</code></li> <li><code>Scale.tickValues</code> is now private</li> <li><code>TimeScale.getLabelCapacity</code> is now private</li> <li><code>TimeScale.tickFormatFunction</code> is now private</li></ul> <h4 id="removed-from-plugins-legend-title-and-tooltip"><a href="#removed-from-plugins-legend-title-and-tooltip" class="header-anchor">#</a> Removed from Plugins (Legend, Title, and Tooltip)</h4> <ul><li><code>IPlugin.afterScaleUpdate</code>. Use <code>afterLayout</code> instead</li> <li><code>Legend.margins</code> is now private</li> <li>Legend <code>onClick</code>, <code>onHover</code>, and <code>onLeave</code> options now receive the legend as the 3rd argument in addition to implicitly via <code>this</code></li> <li>Legend <code>onClick</code>, <code>onHover</code>, and <code>onLeave</code> options now receive a wrapped <code>event</code> as the first parameter. The previous first parameter value is accessible via <code>event.native</code>.</li> <li><code>Title.margins</code> is now private</li> <li>The tooltip item's <code>x</code> and <code>y</code> attributes were replaced by <code>element</code>. You can use <code>element.x</code> and <code>element.y</code> or <code>element.tooltipPosition()</code> instead.</li></ul> <h4 id="removal-of-public-apis"><a href="#removal-of-public-apis" class="header-anchor">#</a> Removal of Public APIs</h4> <p>The following public APIs were removed.</p> <ul><li><code>getElementAtEvent</code> is replaced with <code>chart.getElementsAtEventForMode(e, 'nearest', { intersect: true }, false)</code></li> <li><code>getElementsAtEvent</code> is replaced with <code>chart.getElementsAtEventForMode(e, 'index', { intersect: true }, false)</code></li> <li><code>getElementsAtXAxis</code> is replaced with <code>chart.getElementsAtEventForMode(e, 'index', { intersect: false }, false)</code></li> <li><code>getDatasetAtEvent</code> is replaced with <code>chart.getElementsAtEventForMode(e, 'dataset', { intersect: true }, false)</code></li></ul> <h4 id="removal-of-private-apis"><a href="#removal-of-private-apis" class="header-anchor">#</a> Removal of private APIs</h4> <p>The following private APIs were removed.</p> <ul><li><code>Chart._bufferedRender</code></li> <li><code>Chart._updating</code></li> <li><code>Chart.data.datasets[datasetIndex]._meta</code></li> <li><code>DatasetController._getIndexScaleId</code></li> <li><code>DatasetController._getIndexScale</code></li> <li><code>DatasetController._getValueScaleId</code></li> <li><code>DatasetController._getValueScale</code></li> <li><code>Element._ctx</code></li> <li><code>Element._model</code></li> <li><code>Element._view</code></li> <li><code>LogarithmicScale._valueOffset</code></li> <li><code>TimeScale.getPixelForOffset</code></li> <li><code>TimeScale.getLabelWidth</code></li> <li><code>Tooltip._lastActive</code></li></ul> <h3 id="renamed"><a href="#renamed" class="header-anchor">#</a> Renamed</h3> <p>The following properties were renamed during v3 development:</p> <ul><li><code>Chart.Animation.animationObject</code> was renamed to <code>Chart.Animation</code></li> <li><code>Chart.Animation.chartInstance</code> was renamed to <code>Chart.Animation.chart</code></li> <li><code>Chart.canvasHelpers</code> was merged with <code>Chart.helpers</code></li> <li><code>Chart.elements.Arc</code> was renamed to <code>Chart.elements.ArcElement</code></li> <li><code>Chart.elements.Line</code> was renamed to <code>Chart.elements.LineElement</code></li> <li><code>Chart.elements.Point</code> was renamed to <code>Chart.elements.PointElement</code></li> <li><code>Chart.elements.Rectangle</code> was renamed to <code>Chart.elements.BarElement</code></li> <li><code>Chart.layoutService</code> was renamed to <code>Chart.layouts</code></li> <li><code>Chart.pluginService</code> was renamed to <code>Chart.plugins</code></li> <li><code>helpers.callCallback</code> was renamed to <code>helpers.callback</code></li> <li><code>helpers.drawRoundedRectangle</code> was renamed to <code>helpers.roundedRect</code></li> <li><code>helpers.getValueOrDefault</code> was renamed to <code>helpers.valueOrDefault</code></li> <li><code>LayoutItem.fullWidth</code> was renamed to <code>LayoutItem.fullSize</code></li> <li><code>Point.controlPointPreviousX</code> was renamed to <code>Point.cp1x</code></li> <li><code>Point.controlPointPreviousY</code> was renamed to <code>Point.cp1y</code></li> <li><code>Point.controlPointNextX</code> was renamed to <code>Point.cp2x</code></li> <li><code>Point.controlPointNextY</code> was renamed to <code>Point.cp2y</code></li> <li><code>Scale.calculateTickRotation</code> was renamed to <code>Scale.calculateLabelRotation</code></li> <li><code>Tooltip.options.legendColorBackgroupd</code> was renamed to <code>Tooltip.options.multiKeyBackground</code></li></ul> <h4 id="renamed-private-apis"><a href="#renamed-private-apis" class="header-anchor">#</a> Renamed private APIs</h4> <p>The private APIs listed below were renamed:</p> <ul><li><code>BarController.calculateBarIndexPixels</code> was renamed to <code>BarController._calculateBarIndexPixels</code></li> <li><code>BarController.calculateBarValuePixels</code> was renamed to <code>BarController._calculateBarValuePixels</code></li> <li><code>BarController.getStackCount</code> was renamed to <code>BarController._getStackCount</code></li> <li><code>BarController.getStackIndex</code> was renamed to <code>BarController._getStackIndex</code></li> <li><code>BarController.getRuler</code> was renamed to <code>BarController._getRuler</code></li> <li><code>Chart.destroyDatasetMeta</code> was renamed to <code>Chart._destroyDatasetMeta</code></li> <li><code>Chart.drawDataset</code> was renamed to <code>Chart._drawDataset</code></li> <li><code>Chart.drawDatasets</code> was renamed to <code>Chart._drawDatasets</code></li> <li><code>Chart.eventHandler</code> was renamed to <code>Chart._eventHandler</code></li> <li><code>Chart.handleEvent</code> was renamed to <code>Chart._handleEvent</code></li> <li><code>Chart.initialize</code> was renamed to <code>Chart._initialize</code></li> <li><code>Chart.resetElements</code> was renamed to <code>Chart._resetElements</code></li> <li><code>Chart.unbindEvents</code> was renamed to <code>Chart._unbindEvents</code></li> <li><code>Chart.updateDataset</code> was renamed to <code>Chart._updateDataset</code></li> <li><code>Chart.updateDatasets</code> was renamed to <code>Chart._updateDatasets</code></li> <li><code>Chart.updateLayout</code> was renamed to <code>Chart._updateLayout</code></li> <li><code>DatasetController.destroy</code> was renamed to <code>DatasetController._destroy</code></li> <li><code>DatasetController.insertElements</code> was renamed to <code>DatasetController._insertElements</code></li> <li><code>DatasetController.onDataPop</code> was renamed to <code>DatasetController._onDataPop</code></li> <li><code>DatasetController.onDataPush</code> was renamed to <code>DatasetController._onDataPush</code></li> <li><code>DatasetController.onDataShift</code> was renamed to <code>DatasetController._onDataShift</code></li> <li><code>DatasetController.onDataSplice</code> was renamed to <code>DatasetController._onDataSplice</code></li> <li><code>DatasetController.onDataUnshift</code> was renamed to <code>DatasetController._onDataUnshift</code></li> <li><code>DatasetController.removeElements</code> was renamed to <code>DatasetController._removeElements</code></li> <li><code>DatasetController.resyncElements</code> was renamed to <code>DatasetController._resyncElements</code></li> <li><code>LayoutItem.isFullWidth</code> was renamed to <code>LayoutItem.isFullSize</code></li> <li><code>RadialLinearScale.setReductions</code> was renamed to <code>RadialLinearScale._setReductions</code></li> <li><code>RadialLinearScale.pointLabels</code> was renamed to <code>RadialLinearScale._pointLabels</code></li> <li><code>Scale.handleMargins</code> was renamed to <code>Scale._handleMargins</code></li></ul> <h3 id="changed"><a href="#changed" class="header-anchor">#</a> Changed</h3> <p>The APIs listed in this section have changed in signature or behaviour from version 2.</p> <h4 id="changed-in-scales"><a href="#changed-in-scales" class="header-anchor">#</a> Changed in Scales</h4> <ul><li><code>Scale.getLabelForIndex</code> was replaced by <code>scale.getLabelForValue</code></li> <li><code>Scale.getPixelForValue</code> now has only one parameter. For the <code>TimeScale</code> that parameter must be millis since the epoch</li></ul> <h5 id="changed-in-ticks"><a href="#changed-in-ticks" class="header-anchor">#</a> Changed in Ticks</h5> <ul><li><code>Scale.afterBuildTicks</code> now has no parameters like the other callbacks</li> <li><code>Scale.buildTicks</code> is now expected to return tick objects</li> <li><code>Scale.convertTicksToLabels</code> was renamed to <code>generateTickLabels</code>. It is now expected to set the label property on the ticks given as input</li> <li><code>Scale.ticks</code> now contains objects instead of strings</li> <li>When the <code>autoSkip</code> option is enabled, <code>Scale.ticks</code> now contains only the non-skipped ticks instead of all ticks.</li> <li>Ticks are now always generated in monotonically increasing order</li></ul> <h5 id="changed-in-time-scale"><a href="#changed-in-time-scale" class="header-anchor">#</a> Changed in Time Scale</h5> <ul><li><code>getValueForPixel</code> now returns milliseconds since the epoch</li></ul> <h4 id="changed-in-controllers"><a href="#changed-in-controllers" class="header-anchor">#</a> Changed in Controllers</h4> <h5 id="core-controller"><a href="#core-controller" class="header-anchor">#</a> Core Controller</h5> <ul><li>The first parameter to <code>updateHoverStyle</code> is now an array of objects containing the <code>element</code>, <code>datasetIndex</code>, and <code>index</code></li> <li>The signature or <code>resize</code> changed, the first <code>silent</code> parameter was removed.</li></ul> <h5 id="dataset-controllers"><a href="#dataset-controllers" class="header-anchor">#</a> Dataset Controllers</h5> <ul><li><code>updateElement</code> was replaced with <code>updateElements</code> now taking the elements to update, the <code>start</code> index, <code>count</code>, and <code>mode</code></li> <li><code>setHoverStyle</code> and <code>removeHoverStyle</code> now additionally take the <code>datasetIndex</code> and <code>index</code></li></ul> <h4 id="changed-in-interactions"><a href="#changed-in-interactions" class="header-anchor">#</a> Changed in Interactions</h4> <ul><li>Interaction mode methods now return an array of objects containing the <code>element</code>, <code>datasetIndex</code>, and <code>index</code></li></ul> <h4 id="changed-in-layout"><a href="#changed-in-layout" class="header-anchor">#</a> Changed in Layout</h4> <ul><li><code>ILayoutItem.update</code> no longer has a return value</li></ul> <h4 id="changed-in-helpers"><a href="#changed-in-helpers" class="header-anchor">#</a> Changed in Helpers</h4> <p>All helpers are now exposed in a flat hierarchy, e.g., <code>Chart.helpers.canvas.clipArea</code> -> <code>Chart.helpers.clipArea</code></p> <h5 id="canvas-helper"><a href="#canvas-helper" class="header-anchor">#</a> Canvas Helper</h5> <ul><li>The second parameter to <code>drawPoint</code> is now the full options object, so <code>style</code>, <code>rotation</code>, and <code>radius</code> are no longer passed explicitly</li> <li><code>helpers.getMaximumHeight</code> was replaced by <code>helpers.dom.getMaximumSize</code></li> <li><code>helpers.getMaximumWidth</code> was replaced by <code>helpers.dom.getMaximumSize</code></li> <li><code>helpers.clear</code> was renamed to <code>helpers.clearCanvas</code> and now takes <code>canvas</code> and optionally <code>ctx</code> as parameter(s).</li> <li><code>helpers.retinaScale</code> accepts optional third parameter <code>forceStyle</code>, which forces overriding current canvas style. <code>forceRatio</code> no longer falls back to <code>window.devicePixelRatio</code>, instead it defaults to <code>1</code>.</li></ul> <h4 id="changed-in-platform"><a href="#changed-in-platform" class="header-anchor">#</a> Changed in Platform</h4> <ul><li><code>Chart.platform</code> is no longer the platform object used by charts. Every chart instance now has a separate platform instance.</li> <li><code>Chart.platforms</code> is an object that contains two usable platform classes, <code>BasicPlatform</code> and <code>DomPlatform</code>. It also contains <code>BasePlatform</code>, a class that all platforms must extend from.</li> <li>If the canvas passed in is an instance of <code>OffscreenCanvas</code>, the <code>BasicPlatform</code> is automatically used.</li> <li><code>isAttached</code> method was added to platform.</li></ul> <h4 id="changed-in-iplugin-interface"><a href="#changed-in-iplugin-interface" class="header-anchor">#</a> Changed in IPlugin interface</h4> <ul><li>All plugin hooks have unified signature with 3 arguments: <code>chart</code>, <code>args</code> and <code>options</code>. This means change in signature for these hooks: <code>beforeInit</code>, <code>afterInit</code>, <code>reset</code>, <code>beforeLayout</code>, <code>afterLayout</code>, <code>beforeRender</code>, <code>afterRender</code>, <code>beforeDraw</code>, <code>afterDraw</code>, <code>beforeDatasetsDraw</code>, <code>afterDatasetsDraw</code>, <code>beforeEvent</code>, <code>afterEvent</code>, <code>resize</code>, <code>destroy</code>.</li> <li><code>afterDatasetsUpdate</code>, <code>afterUpdate</code>, <code>beforeDatasetsUpdate</code>, and <code>beforeUpdate</code> now receive <code>args</code> object as second argument. <code>options</code> argument is always the last and thus was moved from 2nd to 3rd place.</li> <li><code>afterEvent</code> and <code>beforeEvent</code> now receive a wrapped <code>event</code> as the <code>event</code> property of the second argument. The native event is available via <code>args.event.native</code>.</li> <li>Initial <code>resize</code> is no longer silent. Meaning that <code>resize</code> event can fire between <code>beforeInit</code> and <code>afterInit</code></li> <li>New hooks: <code>install</code>, <code>start</code>, <code>stop</code>, and <code>uninstall</code></li> <li><code>afterEvent</code> should notify about changes that need a render by setting <code>args.changed</code> to true. Because the <code>args</code> are shared with all plugins, it should only be set to true and not false.</li></ul></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">Last Updated:</span> <span class="time">4/4/2021, 1:26:41 PM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
←
<a href="/docs/3.0.2/getting-started/usage.html" class="prev">
Usage
</a></span> <span class="next"><a href="/docs/3.0.2/general/data-structures.html">
Data structures
</a>
→
</span></p></div> </main></div><div class="global-ui"></div></div>
<script src="/docs/3.0.2/assets/js/app.6bf3e574.js" defer></script><script src="/docs/3.0.2/assets/js/2.12eeefd0.js" defer></script><script src="/docs/3.0.2/assets/js/171.768b5d41.js" defer></script>
</body>
</html>