polar.html 22 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  1. <!DOCTYPE HTML>
  2. <html lang="" >
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  6. <title>Polar Area · GitBook</title>
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  8. <meta name="description" content="">
  9. <meta name="generator" content="GitBook 3.2.2">
  10. <meta name="author" content="chartjs">
  11. <link rel="stylesheet" href="../gitbook/style.css">
  12. <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
  13. <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
  14. <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
  15. <link rel="stylesheet" href="../style.css">
  16. <meta name="HandheldFriendly" content="true"/>
  17. <meta name="viewport" content="width=device-width, initial-scale=1">
  18. <meta name="apple-mobile-web-app-capable" content="yes">
  19. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  20. <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
  21. <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">
  22. <link rel="next" href="bubble.html" />
  23. <link rel="prev" href="doughnut.html" />
  24. <link rel="stylesheet" href="../gitbook/gitbook-plugin-chartjs/style.css">
  25. <script src="../gitbook/gitbook-plugin-chartjs/Chart.bundle.js"></script>
  26. <script src="../gitbook/gitbook-plugin-chartjs/chartjs-plugin-deferred.js"></script>
  27. </head>
  28. <body>
  29. <div class="book">
  30. <div class="book-summary">
  31. <div id="book-search-input" role="search">
  32. <input type="text" placeholder="Type to search" />
  33. </div>
  34. <nav role="navigation">
  35. <ul class="summary">
  36. <li class="chapter " data-level="1.1" data-path="../">
  37. <a href="../">
  38. Chart.js
  39. </a>
  40. </li>
  41. <li class="chapter " data-level="1.2" data-path="../getting-started/">
  42. <a href="../getting-started/">
  43. Getting Started
  44. </a>
  45. <ul class="articles">
  46. <li class="chapter " data-level="1.2.1" data-path="../getting-started/installation.html">
  47. <a href="../getting-started/installation.html">
  48. Installation
  49. </a>
  50. </li>
  51. <li class="chapter " data-level="1.2.2" data-path="../getting-started/integration.html">
  52. <a href="../getting-started/integration.html">
  53. Integration
  54. </a>
  55. </li>
  56. <li class="chapter " data-level="1.2.3" data-path="../getting-started/usage.html">
  57. <a href="../getting-started/usage.html">
  58. Usage
  59. </a>
  60. </li>
  61. </ul>
  62. </li>
  63. <li class="chapter " data-level="1.3" data-path="../general/">
  64. <a href="../general/">
  65. General
  66. </a>
  67. <ul class="articles">
  68. <li class="chapter " data-level="1.3.1" data-path="../general/responsive.html">
  69. <a href="../general/responsive.html">
  70. Responsive
  71. </a>
  72. </li>
  73. <li class="chapter " data-level="1.3.2" data-path="../general/interactions/">
  74. <a href="../general/interactions/">
  75. Interactions
  76. </a>
  77. <ul class="articles">
  78. <li class="chapter " data-level="1.3.2.1" data-path="../general/interactions/events.html">
  79. <a href="../general/interactions/events.html">
  80. Events
  81. </a>
  82. </li>
  83. <li class="chapter " data-level="1.3.2.2" data-path="../general/interactions/modes.html">
  84. <a href="../general/interactions/modes.html">
  85. Modes
  86. </a>
  87. </li>
  88. </ul>
  89. </li>
  90. <li class="chapter " data-level="1.3.3" data-path="../general/options.html">
  91. <a href="../general/options.html">
  92. Options
  93. </a>
  94. </li>
  95. <li class="chapter " data-level="1.3.4" data-path="../general/colors.html">
  96. <a href="../general/colors.html">
  97. Colors
  98. </a>
  99. </li>
  100. <li class="chapter " data-level="1.3.5" data-path="../general/fonts.html">
  101. <a href="../general/fonts.html">
  102. Fonts
  103. </a>
  104. </li>
  105. </ul>
  106. </li>
  107. <li class="chapter " data-level="1.4" data-path="../configuration/">
  108. <a href="../configuration/">
  109. Configuration
  110. </a>
  111. <ul class="articles">
  112. <li class="chapter " data-level="1.4.1" data-path="../configuration/animations.html">
  113. <a href="../configuration/animations.html">
  114. Animations
  115. </a>
  116. </li>
  117. <li class="chapter " data-level="1.4.2" data-path="../configuration/layout.html">
  118. <a href="../configuration/layout.html">
  119. Layout
  120. </a>
  121. </li>
  122. <li class="chapter " data-level="1.4.3" data-path="../configuration/legend.html">
  123. <a href="../configuration/legend.html">
  124. Legend
  125. </a>
  126. </li>
  127. <li class="chapter " data-level="1.4.4" data-path="../configuration/title.html">
  128. <a href="../configuration/title.html">
  129. Title
  130. </a>
  131. </li>
  132. <li class="chapter " data-level="1.4.5" data-path="../configuration/tooltip.html">
  133. <a href="../configuration/tooltip.html">
  134. Tooltip
  135. </a>
  136. </li>
  137. <li class="chapter " data-level="1.4.6" data-path="../configuration/elements.html">
  138. <a href="../configuration/elements.html">
  139. Elements
  140. </a>
  141. </li>
  142. </ul>
  143. </li>
  144. <li class="chapter " data-level="1.5" data-path="./">
  145. <a href="./">
  146. Charts
  147. </a>
  148. <ul class="articles">
  149. <li class="chapter " data-level="1.5.1" data-path="line.html">
  150. <a href="line.html">
  151. Line
  152. </a>
  153. </li>
  154. <li class="chapter " data-level="1.5.2" data-path="bar.html">
  155. <a href="bar.html">
  156. Bar
  157. </a>
  158. </li>
  159. <li class="chapter " data-level="1.5.3" data-path="radar.html">
  160. <a href="radar.html">
  161. Radar
  162. </a>
  163. </li>
  164. <li class="chapter " data-level="1.5.4" data-path="doughnut.html">
  165. <a href="doughnut.html">
  166. Doughnut & Pie
  167. </a>
  168. </li>
  169. <li class="chapter active" data-level="1.5.5" data-path="polar.html">
  170. <a href="polar.html">
  171. Polar Area
  172. </a>
  173. </li>
  174. <li class="chapter " data-level="1.5.6" data-path="bubble.html">
  175. <a href="bubble.html">
  176. Bubble
  177. </a>
  178. </li>
  179. <li class="chapter " data-level="1.5.7" data-path="scatter.html">
  180. <a href="scatter.html">
  181. Scatter
  182. </a>
  183. </li>
  184. <li class="chapter " data-level="1.5.8" data-path="area.html">
  185. <a href="area.html">
  186. Area
  187. </a>
  188. </li>
  189. <li class="chapter " data-level="1.5.9" data-path="mixed.html">
  190. <a href="mixed.html">
  191. Mixed
  192. </a>
  193. </li>
  194. </ul>
  195. </li>
  196. <li class="chapter " data-level="1.6" data-path="../axes/">
  197. <a href="../axes/">
  198. Axes
  199. </a>
  200. <ul class="articles">
  201. <li class="chapter " data-level="1.6.1" data-path="../axes/cartesian/">
  202. <a href="../axes/cartesian/">
  203. Cartesian
  204. </a>
  205. <ul class="articles">
  206. <li class="chapter " data-level="1.6.1.1" data-path="../axes/cartesian/category.html">
  207. <a href="../axes/cartesian/category.html">
  208. Category
  209. </a>
  210. </li>
  211. <li class="chapter " data-level="1.6.1.2" data-path="../axes/cartesian/linear.html">
  212. <a href="../axes/cartesian/linear.html">
  213. Linear
  214. </a>
  215. </li>
  216. <li class="chapter " data-level="1.6.1.3" data-path="../axes/cartesian/logarithmic.html">
  217. <a href="../axes/cartesian/logarithmic.html">
  218. Logarithmic
  219. </a>
  220. </li>
  221. <li class="chapter " data-level="1.6.1.4" data-path="../axes/cartesian/time.html">
  222. <a href="../axes/cartesian/time.html">
  223. Time
  224. </a>
  225. </li>
  226. </ul>
  227. </li>
  228. <li class="chapter " data-level="1.6.2" data-path="../axes/radial/">
  229. <a href="../axes/radial/">
  230. Radial
  231. </a>
  232. <ul class="articles">
  233. <li class="chapter " data-level="1.6.2.1" data-path="../axes/radial/linear.html">
  234. <a href="../axes/radial/linear.html">
  235. Linear
  236. </a>
  237. </li>
  238. </ul>
  239. </li>
  240. <li class="chapter " data-level="1.6.3" data-path="../axes/labelling.html">
  241. <a href="../axes/labelling.html">
  242. Labelling
  243. </a>
  244. </li>
  245. <li class="chapter " data-level="1.6.4" data-path="../axes/styling.html">
  246. <a href="../axes/styling.html">
  247. Styling
  248. </a>
  249. </li>
  250. </ul>
  251. </li>
  252. <li class="chapter " data-level="1.7" data-path="../developers/">
  253. <a href="../developers/">
  254. Developers
  255. </a>
  256. <ul class="articles">
  257. <li class="chapter " data-level="1.7.1" data-path="../developers/api.html">
  258. <a href="../developers/api.html">
  259. Chart.js API
  260. </a>
  261. </li>
  262. <li class="chapter " data-level="1.7.2" data-path="../developers/updates.html">
  263. <a href="../developers/updates.html">
  264. Updating Charts
  265. </a>
  266. </li>
  267. <li class="chapter " data-level="1.7.3" data-path="../developers/plugins.html">
  268. <a href="../developers/plugins.html">
  269. Plugins
  270. </a>
  271. </li>
  272. <li class="chapter " data-level="1.7.4" data-path="../developers/charts.html">
  273. <a href="../developers/charts.html">
  274. New Charts
  275. </a>
  276. </li>
  277. <li class="chapter " data-level="1.7.5" data-path="../developers/axes.html">
  278. <a href="../developers/axes.html">
  279. New Axes
  280. </a>
  281. </li>
  282. <li class="chapter " data-level="1.7.6" data-path="../developers/contributing.html">
  283. <a href="../developers/contributing.html">
  284. Contributing
  285. </a>
  286. </li>
  287. </ul>
  288. </li>
  289. <li class="chapter " data-level="1.8" data-path="../notes/">
  290. <a href="../notes/">
  291. Additional Notes
  292. </a>
  293. <ul class="articles">
  294. <li class="chapter " data-level="1.8.1" data-path="../notes/comparison.html">
  295. <a href="../notes/comparison.html">
  296. Comparison Table
  297. </a>
  298. </li>
  299. <li class="chapter " data-level="1.8.2" data-path="../notes/extensions.html">
  300. <a href="../notes/extensions.html">
  301. Popular Extensions
  302. </a>
  303. </li>
  304. <li class="chapter " data-level="1.8.3" data-path="../notes/license.html">
  305. <a href="../notes/license.html">
  306. License
  307. </a>
  308. </li>
  309. </ul>
  310. </li>
  311. <li class="divider"></li>
  312. <li>
  313. <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
  314. Published with GitBook
  315. </a>
  316. </li>
  317. </ul>
  318. </nav>
  319. </div>
  320. <div class="book-body">
  321. <div class="body-inner">
  322. <div class="book-header" role="navigation">
  323. <!-- Title -->
  324. <h1>
  325. <i class="fa fa-circle-o-notch fa-spin"></i>
  326. <a href=".." >Polar Area</a>
  327. </h1>
  328. </div>
  329. <div class="page-wrapper" tabindex="-1" role="main">
  330. <div class="page-inner">
  331. <div class="search-plus" id="book-search-results">
  332. <div class="search-noresults">
  333. <section class="normal markdown-section">
  334. <h1 id="polar-area">Polar Area</h1>
  335. <p>Polar area charts are similar to pie charts, but each segment has the same angle - the radius of the segment differs depending on the value.</p>
  336. <p>This type of chart is often useful when we want to show a comparison data similar to a pie chart, but also show a scale of values for context.</p>
  337. <p><div class="chartjs-wrapper"><canvas id="chartjs-5" class="chartjs" width="undefined" height="undefined"></canvas><script>new Chart(document.getElementById("chartjs-5"),{"type":"polarArea","data":{"labels":["Red","Green","Yellow","Grey","Blue"],"datasets":[{"label":"My First Dataset","data":[11,16,7,3,14],"backgroundColor":["rgb(255, 99, 132)","rgb(75, 192, 192)","rgb(255, 205, 86)","rgb(201, 203, 207)","rgb(54, 162, 235)"]}]}});</script></div></p>
  338. <h2 id="example-usage">Example Usage</h2>
  339. <pre><code class="lang-javascript"><span class="hljs-keyword">new</span> Chart(ctx, {
  340. data: data,
  341. type: <span class="hljs-string">&apos;polarArea&apos;</span>,
  342. options: options
  343. });
  344. </code></pre>
  345. <h2 id="dataset-properties">Dataset Properties</h2>
  346. <p>The following options can be included in a polar area chart dataset to configure options for that specific dataset.</p>
  347. <table>
  348. <thead>
  349. <tr>
  350. <th>Name</th>
  351. <th>Type</th>
  352. <th>Description</th>
  353. </tr>
  354. </thead>
  355. <tbody>
  356. <tr>
  357. <td><code>label</code></td>
  358. <td><code>String</code></td>
  359. <td>The label for the dataset which appears in the legend and tooltips.</td>
  360. </tr>
  361. <tr>
  362. <td><code>backgroundColor</code></td>
  363. <td><code>Color[]</code></td>
  364. <td>The fill color of the arcs in the dataset. See <a href="../general/colors.html#colors">Colors</a></td>
  365. </tr>
  366. <tr>
  367. <td><code>borderColor</code></td>
  368. <td><code>Color[]</code></td>
  369. <td>The border color of the arcs in the dataset. See <a href="../general/colors.html#colors">Colors</a></td>
  370. </tr>
  371. <tr>
  372. <td><code>borderWidth</code></td>
  373. <td><code>Number[]</code></td>
  374. <td>The border width of the arcs in the dataset.</td>
  375. </tr>
  376. <tr>
  377. <td><code>hoverBackgroundColor</code></td>
  378. <td><code>Color[]</code></td>
  379. <td>The fill colour of the arcs when hovered.</td>
  380. </tr>
  381. <tr>
  382. <td><code>hoverBorderColor</code></td>
  383. <td><code>Color[]</code></td>
  384. <td>The stroke colour of the arcs when hovered.</td>
  385. </tr>
  386. <tr>
  387. <td><code>hoverBorderWidth</code></td>
  388. <td><code>Number[]</code></td>
  389. <td>The stroke width of the arcs when hovered.</td>
  390. </tr>
  391. </tbody>
  392. </table>
  393. <h2 id="config-options">Config Options</h2>
  394. <p>These are the customisation options specific to Polar Area charts. These options are merged with the <a href="#default-options">global chart default options</a>, and form the options of the chart.</p>
  395. <table>
  396. <thead>
  397. <tr>
  398. <th>Name</th>
  399. <th>Type</th>
  400. <th>Default</th>
  401. <th>Description</th>
  402. </tr>
  403. </thead>
  404. <tbody>
  405. <tr>
  406. <td><code>startAngle</code></td>
  407. <td><code>Number</code></td>
  408. <td><code>-0.5 * Math.PI</code></td>
  409. <td>Starting angle to draw arcs for the first item in a dataset.</td>
  410. </tr>
  411. <tr>
  412. <td><code>animation.animateRotate</code></td>
  413. <td><code>Boolean</code></td>
  414. <td><code>true</code></td>
  415. <td>If true, the chart will animate in with a rotation animation. This property is in the <code>options.animation</code> object.</td>
  416. </tr>
  417. <tr>
  418. <td><code>animation.animateScale</code></td>
  419. <td><code>Boolean</code></td>
  420. <td><code>true</code></td>
  421. <td>If true, will animate scaling the chart from the center outwards.</td>
  422. </tr>
  423. </tbody>
  424. </table>
  425. <h2 id="default-options">Default Options</h2>
  426. <p>We can also change these defaults values for each PolarArea type that is created, this object is available at <code>Chart.defaults.polarArea</code>. Changing the global options only affects charts created after the change. Existing charts are not changed.</p>
  427. <p>For example, to configure all new polar area charts with <code>animateScale = false</code> you would do:</p>
  428. <pre><code class="lang-javascript">Chart.defaults.polarArea.animation.animateScale = <span class="hljs-literal">false</span>;
  429. </code></pre>
  430. <h2 id="data-structure">Data Structure</h2>
  431. <p>For a polar area chart, datasets need to contain an array of data points. The data points should be a number, Chart.js will total all of the numbers and calculate the relative proportion of each.</p>
  432. <p>You also need to specify an array of labels so that tooltips appear correctly for each slice.</p>
  433. <pre><code class="lang-javascript">data = {
  434. datasets: [{
  435. data: [<span class="hljs-number">10</span>, <span class="hljs-number">20</span>, <span class="hljs-number">30</span>]
  436. }],
  437. <span class="hljs-comment">// These labels appear in the legend and in the tooltips when hovering different arcs</span>
  438. labels: [
  439. <span class="hljs-string">&apos;Red&apos;</span>,
  440. <span class="hljs-string">&apos;Yellow&apos;</span>,
  441. <span class="hljs-string">&apos;Blue&apos;</span>
  442. ]
  443. };
  444. </code></pre>
  445. </section>
  446. </div>
  447. <div class="search-results">
  448. <div class="has-results">
  449. <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
  450. <ul class="search-results-list"></ul>
  451. </div>
  452. <div class="no-results">
  453. <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
  454. </div>
  455. </div>
  456. </div>
  457. </div>
  458. </div>
  459. </div>
  460. <a href="doughnut.html" class="navigation navigation-prev " aria-label="Previous page: Doughnut & Pie">
  461. <i class="fa fa-angle-left"></i>
  462. </a>
  463. <a href="bubble.html" class="navigation navigation-next " aria-label="Next page: Bubble">
  464. <i class="fa fa-angle-right"></i>
  465. </a>
  466. </div>
  467. <script>
  468. var gitbook = gitbook || [];
  469. gitbook.push(function() {
  470. gitbook.page.hasChanged({"page":{"title":"Polar Area","level":"1.5.5","depth":2,"next":{"title":"Bubble","level":"1.5.6","depth":2,"path":"charts/bubble.md","ref":"charts/bubble.md","articles":[]},"previous":{"title":"Doughnut & Pie","level":"1.5.4","depth":2,"path":"charts/doughnut.md","ref":"charts/doughnut.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-lunr","-search","search-plus","anchorjs","chartjs","ga"],"root":"./docs","styles":{"website":"style.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"anchorjs":{"icon":"#","placement":"left","visible":"always"},"ga":{"configuration":"auto","token":"UA-28909194-3"},"theme-default":{"styles":{"website":"style.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"search-plus":{},"chartjs":{"defaults":null},"highlight":{},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2}},"theme":"default","author":"chartjs","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"gitbook":"3.2.2"},"file":{"path":"charts/polar.md","mtime":"2017-10-28T15:03:49.266Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-10-28T15:09:53.587Z"},"basePath":"..","book":{"language":""}});
  471. });
  472. </script>
  473. </div>
  474. <script src="../gitbook/gitbook.js"></script>
  475. <script src="../gitbook/theme.js"></script>
  476. <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
  477. <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
  478. <script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.1.1/anchor.min.js"></script>
  479. <script src="../gitbook/gitbook-plugin-anchorjs/anchor-style.js"></script>
  480. <script src="../gitbook/gitbook-plugin-ga/plugin.js"></script>
  481. <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
  482. <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
  483. </body>
  484. </html>