Add demo functions
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Chart.js API · GitBook</title>
|
||||
<title>Chart.js API · Chart.js documentation</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.2">
|
||||
@@ -195,7 +195,20 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/interactions/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/device-pixel-ratio.html">
|
||||
|
||||
<a href="../general/device-pixel-ratio.html">
|
||||
|
||||
|
||||
Pixel Ratio
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/interactions/">
|
||||
|
||||
<a href="../general/interactions/">
|
||||
|
||||
@@ -209,7 +222,7 @@
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.2.1" data-path="../general/interactions/events.html">
|
||||
<li class="chapter " data-level="1.3.3.1" data-path="../general/interactions/events.html">
|
||||
|
||||
<a href="../general/interactions/events.html">
|
||||
|
||||
@@ -222,7 +235,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2.2" data-path="../general/interactions/modes.html">
|
||||
<li class="chapter " data-level="1.3.3.2" data-path="../general/interactions/modes.html">
|
||||
|
||||
<a href="../general/interactions/modes.html">
|
||||
|
||||
@@ -240,7 +253,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/options.html">
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/options.html">
|
||||
|
||||
<a href="../general/options.html">
|
||||
|
||||
@@ -253,7 +266,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/colors.html">
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/colors.html">
|
||||
|
||||
<a href="../general/colors.html">
|
||||
|
||||
@@ -266,7 +279,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/fonts.html">
|
||||
<li class="chapter " data-level="1.3.6" data-path="../general/fonts.html">
|
||||
|
||||
<a href="../general/fonts.html">
|
||||
|
||||
@@ -950,9 +963,9 @@ myLineChart.clear();
|
||||
</code></pre>
|
||||
<p>To get an item that was clicked on, <code>getElementAtEvent</code> can be used.</p>
|
||||
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">clickHandler</span>(<span class="hljs-params">evt</span>) </span>{
|
||||
<span class="hljs-keyword">var</span> item = myChart.getElementAtEvent(evt)[<span class="hljs-number">0</span>];
|
||||
<span class="hljs-keyword">var</span> firstPoint = myChart.getElementAtEvent(evt)[<span class="hljs-number">0</span>];
|
||||
|
||||
<span class="hljs-keyword">if</span> (item) {
|
||||
<span class="hljs-keyword">if</span> (firstPoint) {
|
||||
<span class="hljs-keyword">var</span> label = myChart.data.labels[firstPoint._index];
|
||||
<span class="hljs-keyword">var</span> value = myChart.data.datasets[firstPoint._datasetIndex].data[firstPoint._index];
|
||||
}
|
||||
@@ -1022,7 +1035,7 @@ myLineChart.clear();
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Chart.js API","level":"1.7.1","depth":2,"next":{"title":"Updating Charts","level":"1.7.2","depth":2,"path":"developers/updates.md","ref":"developers/updates.md","articles":[]},"previous":{"title":"Developers","level":"1.7","depth":1,"path":"developers/README.md","ref":"developers/README.md","articles":[{"title":"Chart.js API","level":"1.7.1","depth":2,"path":"developers/api.md","ref":"developers/api.md","articles":[]},{"title":"Updating Charts","level":"1.7.2","depth":2,"path":"developers/updates.md","ref":"developers/updates.md","articles":[]},{"title":"Plugins","level":"1.7.3","depth":2,"path":"developers/plugins.md","ref":"developers/plugins.md","articles":[]},{"title":"New Charts","level":"1.7.4","depth":2,"path":"developers/charts.md","ref":"developers/charts.md","articles":[]},{"title":"New Axes","level":"1.7.5","depth":2,"path":"developers/axes.md","ref":"developers/axes.md","articles":[]},{"title":"Contributing","level":"1.7.6","depth":2,"path":"developers/contributing.md","ref":"developers/contributing.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":"developers/api.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":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Chart.js API","level":"1.7.1","depth":2,"next":{"title":"Updating Charts","level":"1.7.2","depth":2,"path":"developers/updates.md","ref":"developers/updates.md","articles":[]},"previous":{"title":"Developers","level":"1.7","depth":1,"path":"developers/README.md","ref":"developers/README.md","articles":[{"title":"Chart.js API","level":"1.7.1","depth":2,"path":"developers/api.md","ref":"developers/api.md","articles":[]},{"title":"Updating Charts","level":"1.7.2","depth":2,"path":"developers/updates.md","ref":"developers/updates.md","articles":[]},{"title":"Plugins","level":"1.7.3","depth":2,"path":"developers/plugins.md","ref":"developers/plugins.md","articles":[]},{"title":"New Charts","level":"1.7.4","depth":2,"path":"developers/charts.md","ref":"developers/charts.md","articles":[]},{"title":"New Axes","level":"1.7.5","depth":2,"path":"developers/axes.md","ref":"developers/axes.md","articles":[]},{"title":"Contributing","level":"1.7.6","depth":2,"path":"developers/contributing.md","ref":"developers/contributing.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":{},"title":"Chart.js documentation","gitbook":"3.2.2"},"file":{"path":"developers/api.md","mtime":"2018-03-01T21:46:31.679Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2018-03-01T21:50:47.970Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
@@ -1040,7 +1053,7 @@ myLineChart.clear();
|
||||
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.1.1/anchor.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>New Axes · GitBook</title>
|
||||
<title>New Axes · Chart.js documentation</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.2">
|
||||
@@ -195,7 +195,20 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/interactions/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/device-pixel-ratio.html">
|
||||
|
||||
<a href="../general/device-pixel-ratio.html">
|
||||
|
||||
|
||||
Pixel Ratio
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/interactions/">
|
||||
|
||||
<a href="../general/interactions/">
|
||||
|
||||
@@ -209,7 +222,7 @@
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.2.1" data-path="../general/interactions/events.html">
|
||||
<li class="chapter " data-level="1.3.3.1" data-path="../general/interactions/events.html">
|
||||
|
||||
<a href="../general/interactions/events.html">
|
||||
|
||||
@@ -222,7 +235,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2.2" data-path="../general/interactions/modes.html">
|
||||
<li class="chapter " data-level="1.3.3.2" data-path="../general/interactions/modes.html">
|
||||
|
||||
<a href="../general/interactions/modes.html">
|
||||
|
||||
@@ -240,7 +253,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/options.html">
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/options.html">
|
||||
|
||||
<a href="../general/options.html">
|
||||
|
||||
@@ -253,7 +266,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/colors.html">
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/colors.html">
|
||||
|
||||
<a href="../general/colors.html">
|
||||
|
||||
@@ -266,7 +279,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/fonts.html">
|
||||
<li class="chapter " data-level="1.3.6" data-path="../general/fonts.html">
|
||||
|
||||
<a href="../general/fonts.html">
|
||||
|
||||
@@ -929,14 +942,14 @@
|
||||
|
||||
<span class="hljs-comment">// Get the pixel (x coordinate for horizontal axis, y coordinate for vertical axis) for a given value</span>
|
||||
<span class="hljs-comment">// @param index: index into the ticks array</span>
|
||||
<span class="hljs-comment">// @param includeOffset: if true, get the pixel halway between the given tick and the next</span>
|
||||
<span class="hljs-comment">// @param includeOffset: if true, get the pixel halfway between the given tick and the next</span>
|
||||
getPixelForTick: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">index, includeOffset</span>) </span>{},
|
||||
|
||||
<span class="hljs-comment">// Get the pixel (x coordinate for horizontal axis, y coordinate for vertical axis) for a given value</span>
|
||||
<span class="hljs-comment">// @param value : the value to get the pixel for</span>
|
||||
<span class="hljs-comment">// @param index : index into the data array of the value</span>
|
||||
<span class="hljs-comment">// @param datasetIndex : index of the dataset the value comes from</span>
|
||||
<span class="hljs-comment">// @param includeOffset : if true, get the pixel halway between the given tick and the next</span>
|
||||
<span class="hljs-comment">// @param includeOffset : if true, get the pixel halfway between the given tick and the next</span>
|
||||
getPixelForValue: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">value, index, datasetIndex, includeOffset</span>) </span>{}
|
||||
|
||||
<span class="hljs-comment">// Get the value for a given pixel (x coordinate for horizontal axis, y coordinate for vertical axis)</span>
|
||||
@@ -1018,7 +1031,7 @@
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"New Axes","level":"1.7.5","depth":2,"next":{"title":"Contributing","level":"1.7.6","depth":2,"path":"developers/contributing.md","ref":"developers/contributing.md","articles":[]},"previous":{"title":"New Charts","level":"1.7.4","depth":2,"path":"developers/charts.md","ref":"developers/charts.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":"developers/axes.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":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"New Axes","level":"1.7.5","depth":2,"next":{"title":"Contributing","level":"1.7.6","depth":2,"path":"developers/contributing.md","ref":"developers/contributing.md","articles":[]},"previous":{"title":"New Charts","level":"1.7.4","depth":2,"path":"developers/charts.md","ref":"developers/charts.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":{},"title":"Chart.js documentation","gitbook":"3.2.2"},"file":{"path":"developers/axes.md","mtime":"2018-03-01T21:46:31.679Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2018-03-01T21:50:47.970Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
@@ -1036,7 +1049,7 @@
|
||||
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.1.1/anchor.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>New Charts · GitBook</title>
|
||||
<title>New Charts · Chart.js documentation</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.2">
|
||||
@@ -195,7 +195,20 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/interactions/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/device-pixel-ratio.html">
|
||||
|
||||
<a href="../general/device-pixel-ratio.html">
|
||||
|
||||
|
||||
Pixel Ratio
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/interactions/">
|
||||
|
||||
<a href="../general/interactions/">
|
||||
|
||||
@@ -209,7 +222,7 @@
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.2.1" data-path="../general/interactions/events.html">
|
||||
<li class="chapter " data-level="1.3.3.1" data-path="../general/interactions/events.html">
|
||||
|
||||
<a href="../general/interactions/events.html">
|
||||
|
||||
@@ -222,7 +235,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2.2" data-path="../general/interactions/modes.html">
|
||||
<li class="chapter " data-level="1.3.3.2" data-path="../general/interactions/modes.html">
|
||||
|
||||
<a href="../general/interactions/modes.html">
|
||||
|
||||
@@ -240,7 +253,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/options.html">
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/options.html">
|
||||
|
||||
<a href="../general/options.html">
|
||||
|
||||
@@ -253,7 +266,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/colors.html">
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/colors.html">
|
||||
|
||||
<a href="../general/colors.html">
|
||||
|
||||
@@ -266,7 +279,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/fonts.html">
|
||||
<li class="chapter " data-level="1.3.6" data-path="../general/fonts.html">
|
||||
|
||||
<a href="../general/fonts.html">
|
||||
|
||||
@@ -929,7 +942,7 @@
|
||||
<li><code>Chart.controllers.bubble</code></li>
|
||||
</ul>
|
||||
<p>For example, to derive a new chart type that extends from a bubble chart, you would do the following.</p>
|
||||
<pre><code class="lang-javascript"><span class="hljs-comment">// Sets the default config for 'derivedBubble' to be the same as the bubble defaults. </span>
|
||||
<pre><code class="lang-javascript"><span class="hljs-comment">// Sets the default config for 'derivedBubble' to be the same as the bubble defaults.</span>
|
||||
<span class="hljs-comment">// We look for the defaults by doing Chart.defaults[chartType]</span>
|
||||
<span class="hljs-comment">// It looks like a bug exists when the defaults don't exist</span>
|
||||
Chart.defaults.derivedBubble = Chart.defaults.bubble;
|
||||
@@ -956,7 +969,7 @@ Chart.defaults.derivedBubble = Chart.defaults.bubble;
|
||||
|
||||
<span class="hljs-comment">// Stores the controller so that the chart initialization routine can look it up with</span>
|
||||
<span class="hljs-comment">// Chart.controllers[type]</span>
|
||||
Chart.controllers.derivedBubble = custom;
|
||||
Chart.controllers.derivedBubble = custom;
|
||||
|
||||
<span class="hljs-comment">// Now we can create and use our new chart type</span>
|
||||
<span class="hljs-keyword">new</span> Chart(ctx, {
|
||||
@@ -1010,7 +1023,7 @@ Chart.controllers.derivedBubble = custom;
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"New Charts","level":"1.7.4","depth":2,"next":{"title":"New Axes","level":"1.7.5","depth":2,"path":"developers/axes.md","ref":"developers/axes.md","articles":[]},"previous":{"title":"Plugins","level":"1.7.3","depth":2,"path":"developers/plugins.md","ref":"developers/plugins.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":"developers/charts.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":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"New Charts","level":"1.7.4","depth":2,"next":{"title":"New Axes","level":"1.7.5","depth":2,"path":"developers/axes.md","ref":"developers/axes.md","articles":[]},"previous":{"title":"Plugins","level":"1.7.3","depth":2,"path":"developers/plugins.md","ref":"developers/plugins.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":{},"title":"Chart.js documentation","gitbook":"3.2.2"},"file":{"path":"developers/charts.md","mtime":"2018-03-01T21:46:31.679Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2018-03-01T21:50:47.970Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
@@ -1028,7 +1041,7 @@ Chart.controllers.derivedBubble = custom;
|
||||
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.1.1/anchor.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Contributing · GitBook</title>
|
||||
<title>Contributing · Chart.js documentation</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.2">
|
||||
@@ -195,7 +195,20 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/interactions/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/device-pixel-ratio.html">
|
||||
|
||||
<a href="../general/device-pixel-ratio.html">
|
||||
|
||||
|
||||
Pixel Ratio
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/interactions/">
|
||||
|
||||
<a href="../general/interactions/">
|
||||
|
||||
@@ -209,7 +222,7 @@
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.2.1" data-path="../general/interactions/events.html">
|
||||
<li class="chapter " data-level="1.3.3.1" data-path="../general/interactions/events.html">
|
||||
|
||||
<a href="../general/interactions/events.html">
|
||||
|
||||
@@ -222,7 +235,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2.2" data-path="../general/interactions/modes.html">
|
||||
<li class="chapter " data-level="1.3.3.2" data-path="../general/interactions/modes.html">
|
||||
|
||||
<a href="../general/interactions/modes.html">
|
||||
|
||||
@@ -240,7 +253,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/options.html">
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/options.html">
|
||||
|
||||
<a href="../general/options.html">
|
||||
|
||||
@@ -253,7 +266,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/colors.html">
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/colors.html">
|
||||
|
||||
<a href="../general/colors.html">
|
||||
|
||||
@@ -266,7 +279,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/fonts.html">
|
||||
<li class="chapter " data-level="1.3.6" data-path="../general/fonts.html">
|
||||
|
||||
<a href="../general/fonts.html">
|
||||
|
||||
@@ -877,7 +890,7 @@
|
||||
<li>Avoid breaking changes unless there is an upcoming major release, which are infrequent. We encourage people to write plugins for most new advanced features, so care a lot about backwards compatibility.</li>
|
||||
</ul>
|
||||
<h1 id="joining-the-project">Joining the project</h1>
|
||||
<p> Active committers and contributors are invited to introduce yourself and request commit access to this project. We have a very active Slack community that you can join <a href="https://chart-js-automation.herokuapp.com/" target="_blank">here</a>. If you think you can help, we'd love to have you!</p>
|
||||
<p> Active committers and contributors are invited to introduce yourself and request commit access to this project. We have a very active Slack community that you can join <a href="https://chartjs-slack.herokuapp.com/" target="_blank">here</a>. If you think you can help, we'd love to have you!</p>
|
||||
<h1 id="building-and-testing">Building and Testing</h1>
|
||||
<p>Chart.js uses <a href="http://gulpjs.com/" target="_blank">gulp</a> to build the library into a single JavaScript file.</p>
|
||||
<p>Firstly, we need to ensure development dependencies are installed. With node and npm installed, after cloning the Chart.js repo to a local directory, and navigating to that directory in the command line, we can run the following:</p>
|
||||
@@ -948,7 +961,7 @@
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Contributing","level":"1.7.6","depth":2,"next":{"title":"Additional Notes","level":"1.8","depth":1,"path":"notes/README.md","ref":"notes/README.md","articles":[{"title":"Comparison Table","level":"1.8.1","depth":2,"path":"notes/comparison.md","ref":"notes/comparison.md","articles":[]},{"title":"Popular Extensions","level":"1.8.2","depth":2,"path":"notes/extensions.md","ref":"notes/extensions.md","articles":[]},{"title":"License","level":"1.8.3","depth":2,"path":"notes/license.md","ref":"notes/license.md","articles":[]}]},"previous":{"title":"New Axes","level":"1.7.5","depth":2,"path":"developers/axes.md","ref":"developers/axes.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":"developers/contributing.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":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Contributing","level":"1.7.6","depth":2,"next":{"title":"Additional Notes","level":"1.8","depth":1,"path":"notes/README.md","ref":"notes/README.md","articles":[{"title":"Comparison Table","level":"1.8.1","depth":2,"path":"notes/comparison.md","ref":"notes/comparison.md","articles":[]},{"title":"Popular Extensions","level":"1.8.2","depth":2,"path":"notes/extensions.md","ref":"notes/extensions.md","articles":[]},{"title":"License","level":"1.8.3","depth":2,"path":"notes/license.md","ref":"notes/license.md","articles":[]}]},"previous":{"title":"New Axes","level":"1.7.5","depth":2,"path":"developers/axes.md","ref":"developers/axes.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":{},"title":"Chart.js documentation","gitbook":"3.2.2"},"file":{"path":"developers/contributing.md","mtime":"2018-03-01T21:46:31.679Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2018-03-01T21:50:47.970Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
@@ -966,7 +979,7 @@
|
||||
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.1.1/anchor.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Developers · GitBook</title>
|
||||
<title>Developers · Chart.js documentation</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.2">
|
||||
@@ -195,7 +195,20 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/interactions/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/device-pixel-ratio.html">
|
||||
|
||||
<a href="../general/device-pixel-ratio.html">
|
||||
|
||||
|
||||
Pixel Ratio
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/interactions/">
|
||||
|
||||
<a href="../general/interactions/">
|
||||
|
||||
@@ -209,7 +222,7 @@
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.2.1" data-path="../general/interactions/events.html">
|
||||
<li class="chapter " data-level="1.3.3.1" data-path="../general/interactions/events.html">
|
||||
|
||||
<a href="../general/interactions/events.html">
|
||||
|
||||
@@ -222,7 +235,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2.2" data-path="../general/interactions/modes.html">
|
||||
<li class="chapter " data-level="1.3.3.2" data-path="../general/interactions/modes.html">
|
||||
|
||||
<a href="../general/interactions/modes.html">
|
||||
|
||||
@@ -240,7 +253,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/options.html">
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/options.html">
|
||||
|
||||
<a href="../general/options.html">
|
||||
|
||||
@@ -253,7 +266,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/colors.html">
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/colors.html">
|
||||
|
||||
<a href="../general/colors.html">
|
||||
|
||||
@@ -266,7 +279,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/fonts.html">
|
||||
<li class="chapter " data-level="1.3.6" data-path="../general/fonts.html">
|
||||
|
||||
<a href="../general/fonts.html">
|
||||
|
||||
@@ -945,7 +958,7 @@
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Developers","level":"1.7","depth":1,"next":{"title":"Chart.js API","level":"1.7.1","depth":2,"path":"developers/api.md","ref":"developers/api.md","articles":[]},"previous":{"title":"Styling","level":"1.6.4","depth":2,"path":"axes/styling.md","ref":"axes/styling.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":"developers/README.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":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Developers","level":"1.7","depth":1,"next":{"title":"Chart.js API","level":"1.7.1","depth":2,"path":"developers/api.md","ref":"developers/api.md","articles":[]},"previous":{"title":"Styling","level":"1.6.4","depth":2,"path":"axes/styling.md","ref":"axes/styling.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":{},"title":"Chart.js documentation","gitbook":"3.2.2"},"file":{"path":"developers/README.md","mtime":"2018-03-01T21:46:31.679Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2018-03-01T21:50:47.970Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
@@ -963,7 +976,7 @@
|
||||
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.1.1/anchor.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Plugins · GitBook</title>
|
||||
<title>Plugins · Chart.js documentation</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.2">
|
||||
@@ -195,7 +195,20 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/interactions/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/device-pixel-ratio.html">
|
||||
|
||||
<a href="../general/device-pixel-ratio.html">
|
||||
|
||||
|
||||
Pixel Ratio
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/interactions/">
|
||||
|
||||
<a href="../general/interactions/">
|
||||
|
||||
@@ -209,7 +222,7 @@
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.2.1" data-path="../general/interactions/events.html">
|
||||
<li class="chapter " data-level="1.3.3.1" data-path="../general/interactions/events.html">
|
||||
|
||||
<a href="../general/interactions/events.html">
|
||||
|
||||
@@ -222,7 +235,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2.2" data-path="../general/interactions/modes.html">
|
||||
<li class="chapter " data-level="1.3.3.2" data-path="../general/interactions/modes.html">
|
||||
|
||||
<a href="../general/interactions/modes.html">
|
||||
|
||||
@@ -240,7 +253,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/options.html">
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/options.html">
|
||||
|
||||
<a href="../general/options.html">
|
||||
|
||||
@@ -253,7 +266,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/colors.html">
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/colors.html">
|
||||
|
||||
<a href="../general/colors.html">
|
||||
|
||||
@@ -266,7 +279,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/fonts.html">
|
||||
<li class="chapter " data-level="1.3.6" data-path="../general/fonts.html">
|
||||
|
||||
<a href="../general/fonts.html">
|
||||
|
||||
@@ -1015,7 +1028,7 @@
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Plugins","level":"1.7.3","depth":2,"next":{"title":"New Charts","level":"1.7.4","depth":2,"path":"developers/charts.md","ref":"developers/charts.md","articles":[]},"previous":{"title":"Updating Charts","level":"1.7.2","depth":2,"path":"developers/updates.md","ref":"developers/updates.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":"developers/plugins.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":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Plugins","level":"1.7.3","depth":2,"next":{"title":"New Charts","level":"1.7.4","depth":2,"path":"developers/charts.md","ref":"developers/charts.md","articles":[]},"previous":{"title":"Updating Charts","level":"1.7.2","depth":2,"path":"developers/updates.md","ref":"developers/updates.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":{},"title":"Chart.js documentation","gitbook":"3.2.2"},"file":{"path":"developers/plugins.md","mtime":"2018-03-01T21:46:31.679Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2018-03-01T21:50:47.970Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
@@ -1033,7 +1046,7 @@
|
||||
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.1.1/anchor.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
||||
<title>Updating Charts · GitBook</title>
|
||||
<title>Updating Charts · Chart.js documentation</title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="description" content="">
|
||||
<meta name="generator" content="GitBook 3.2.2">
|
||||
@@ -195,7 +195,20 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/interactions/">
|
||||
<li class="chapter " data-level="1.3.2" data-path="../general/device-pixel-ratio.html">
|
||||
|
||||
<a href="../general/device-pixel-ratio.html">
|
||||
|
||||
|
||||
Pixel Ratio
|
||||
|
||||
</a>
|
||||
|
||||
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/interactions/">
|
||||
|
||||
<a href="../general/interactions/">
|
||||
|
||||
@@ -209,7 +222,7 @@
|
||||
<ul class="articles">
|
||||
|
||||
|
||||
<li class="chapter " data-level="1.3.2.1" data-path="../general/interactions/events.html">
|
||||
<li class="chapter " data-level="1.3.3.1" data-path="../general/interactions/events.html">
|
||||
|
||||
<a href="../general/interactions/events.html">
|
||||
|
||||
@@ -222,7 +235,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.2.2" data-path="../general/interactions/modes.html">
|
||||
<li class="chapter " data-level="1.3.3.2" data-path="../general/interactions/modes.html">
|
||||
|
||||
<a href="../general/interactions/modes.html">
|
||||
|
||||
@@ -240,7 +253,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.3" data-path="../general/options.html">
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/options.html">
|
||||
|
||||
<a href="../general/options.html">
|
||||
|
||||
@@ -253,7 +266,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.4" data-path="../general/colors.html">
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/colors.html">
|
||||
|
||||
<a href="../general/colors.html">
|
||||
|
||||
@@ -266,7 +279,7 @@
|
||||
|
||||
</li>
|
||||
|
||||
<li class="chapter " data-level="1.3.5" data-path="../general/fonts.html">
|
||||
<li class="chapter " data-level="1.3.6" data-path="../general/fonts.html">
|
||||
|
||||
<a href="../general/fonts.html">
|
||||
|
||||
@@ -866,7 +879,7 @@
|
||||
<section class="normal markdown-section">
|
||||
|
||||
<h1 id="updating-charts">Updating Charts</h1>
|
||||
<p>It's pretty common to want to update charts after they've been created. When the chart data is changed, Chart.js will animate to the new data values. </p>
|
||||
<p>It's pretty common to want to update charts after they've been created. When the chart data or options are changed, Chart.js will animate to the new data values and options.</p>
|
||||
<h2 id="adding-or-removing-data">Adding or Removing Data</h2>
|
||||
<p>Adding and removing data is supported by changing the data array. To add data, just add data into the data array as seen in this example.</p>
|
||||
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">addData</span>(<span class="hljs-params">chart, label, data</span>) </span>{
|
||||
@@ -876,8 +889,8 @@
|
||||
});
|
||||
chart.update();
|
||||
}
|
||||
</code></pre>
|
||||
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">removeData</span>(<span class="hljs-params">chart</span>) </span>{
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">removeData</span>(<span class="hljs-params">chart</span>) </span>{
|
||||
chart.data.labels.pop();
|
||||
chart.data.datasets.forEach((dataset) => {
|
||||
dataset.data.pop();
|
||||
@@ -885,6 +898,67 @@
|
||||
chart.update();
|
||||
}
|
||||
</code></pre>
|
||||
<h2 id="updating-options">Updating Options</h2>
|
||||
<p>To update the options, mutating the options property in place or passing in a new options object are supported.</p>
|
||||
<ul>
|
||||
<li>If the options are mutated in place, other option properties would be preserved, including those calculated by Chart.js.</li>
|
||||
<li>If created as a new object, it would be like creating a new chart with the options - old options would be discarded.</li>
|
||||
</ul>
|
||||
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">updateConfigByMutating</span>(<span class="hljs-params">chart</span>) </span>{
|
||||
chart.options.title.text = <span class="hljs-string">'new title'</span>;
|
||||
chart.update();
|
||||
}
|
||||
|
||||
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">updateConfigAsNewObject</span>(<span class="hljs-params">chart</span>) </span>{
|
||||
chart.options = {
|
||||
responsive: <span class="hljs-literal">true</span>,
|
||||
title:{
|
||||
display:<span class="hljs-literal">true</span>,
|
||||
text: <span class="hljs-string">'Chart.js'</span>
|
||||
},
|
||||
scales: {
|
||||
xAxes: [{
|
||||
display: <span class="hljs-literal">true</span>
|
||||
}],
|
||||
yAxes: [{
|
||||
display: <span class="hljs-literal">true</span>
|
||||
}]
|
||||
}
|
||||
}
|
||||
chart.update();
|
||||
}
|
||||
</code></pre>
|
||||
<p>Scales can be updated separately without changing other options.
|
||||
To update the scales, pass in an object containing all the customization including those unchanged ones.</p>
|
||||
<p>Variables referencing any one from <code>chart.scales</code> would be lost after updating scales with a new <code>id</code> or the changed <code>type</code>.</p>
|
||||
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">updateScales</span>(<span class="hljs-params">chart</span>) </span>{
|
||||
<span class="hljs-keyword">var</span> xScale = chart.scales[<span class="hljs-string">'x-axis-0'</span>];
|
||||
<span class="hljs-keyword">var</span> yScale = chart.scales[<span class="hljs-string">'y-axis-0'</span>];
|
||||
chart.options.scales = {
|
||||
xAxes: [{
|
||||
id: <span class="hljs-string">'newId'</span>,
|
||||
display: <span class="hljs-literal">true</span>
|
||||
}],
|
||||
yAxes: [{
|
||||
display: <span class="hljs-literal">true</span>,
|
||||
type: <span class="hljs-string">'logarithmic'</span>
|
||||
}]
|
||||
}
|
||||
chart.update();
|
||||
<span class="hljs-comment">// need to update the reference</span>
|
||||
xScale = chart.scales[<span class="hljs-string">'newId'</span>];
|
||||
yScale = chart.scales[<span class="hljs-string">'y-axis-0'</span>];
|
||||
}
|
||||
</code></pre>
|
||||
<p>You can also update a specific scale either by specifying its index or id.</p>
|
||||
<pre><code class="lang-javascript"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">updateScale</span>(<span class="hljs-params">chart</span>) </span>{
|
||||
chart.options.scales.yAxes[<span class="hljs-number">0</span>] = {
|
||||
type: <span class="hljs-string">'logarithmic'</span>
|
||||
}
|
||||
chart.update();
|
||||
}
|
||||
</code></pre>
|
||||
<p>Code sample for updating options can be found in <a href="../../samples/scales/toggle-scale-type.html">toggle-scale-type.html</a>.</p>
|
||||
<h2 id="preventing-animations">Preventing Animations</h2>
|
||||
<p>Sometimes when a chart updates, you may not want an animation. To achieve this you can call <code>update</code> with a duration of <code>0</code>. This will render the chart synchronously and without an animation.</p>
|
||||
|
||||
@@ -930,7 +1004,7 @@
|
||||
<script>
|
||||
var gitbook = gitbook || [];
|
||||
gitbook.push(function() {
|
||||
gitbook.page.hasChanged({"page":{"title":"Updating Charts","level":"1.7.2","depth":2,"next":{"title":"Plugins","level":"1.7.3","depth":2,"path":"developers/plugins.md","ref":"developers/plugins.md","articles":[]},"previous":{"title":"Chart.js API","level":"1.7.1","depth":2,"path":"developers/api.md","ref":"developers/api.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":"developers/updates.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":""}});
|
||||
gitbook.page.hasChanged({"page":{"title":"Updating Charts","level":"1.7.2","depth":2,"next":{"title":"Plugins","level":"1.7.3","depth":2,"path":"developers/plugins.md","ref":"developers/plugins.md","articles":[]},"previous":{"title":"Chart.js API","level":"1.7.1","depth":2,"path":"developers/api.md","ref":"developers/api.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":{},"title":"Chart.js documentation","gitbook":"3.2.2"},"file":{"path":"developers/updates.md","mtime":"2018-03-01T21:46:31.679Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2018-03-01T21:50:47.970Z"},"basePath":"..","book":{"language":""}});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
@@ -948,7 +1022,7 @@
|
||||
|
||||
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/3.1.1/anchor.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user