Inject the GA tracking snippet for all samples, including the index page. Also update README.md badges using the shields.io service for consistency with flat-square style and cache, and add release badges to the installation documentation page.
# Chart.js
-[](https://travis-ci.org/chartjs/Chart.js) [](https://codeclimate.com/github/chartjs/Chart.js) [](https://coveralls.io/github/chartjs/Chart.js?branch=master)
-
-[](https://chart-js-automation.herokuapp.com/)
+[](https://travis-ci.org/chartjs/Chart.js) [](https://codeclimate.com/github/chartjs/Chart.js) [](https://coveralls.io/github/chartjs/Chart.js?branch=master) [](https://chart-js-automation.herokuapp.com/)
*Simple HTML5 Charts using the canvas element* [chartjs.org](http://www.chartjs.org)
# Chart.js
-[](https://chart-js-automation.herokuapp.com/)
+[](https://chart-js-automation.herokuapp.com/)
## Installation
Chart.js can be installed via npm or bower. It is recommended to get Chart.js this way.
## npm
+[](https://npmjs.com/package/chart.js)
```bash
npm install chart.js --save
```
## Bower
+[](https://libraries.io/bower/chartjs)
```bash
bower install chart.js --save
```
## CDN
-or just use these [Chart.js CDN](https://cdnjs.com/libraries/Chart.js) links.
+[](https://cdnjs.com/libraries/Chart.js)
+or just use these [Chart.js CDN](https://cdnjs.com/libraries/Chart.js) links.
## Github
+[](https://github.com/chartjs/Chart.js/releases/latest)
+
You can download the latest version of [Chart.js on GitHub](https://github.com/chartjs/Chart.js/releases/latest).
If you download or clone the repository, you must [build](../developers/contributing.md#building-chartjs) Chart.js to generate the dist files. Chart.js no longer comes with prebuilt release versions, so an alternative option to downloading the repo is **strongly** advised.
* `dist/Chart.bundle.js`
* `dist/Chart.bundle.min.js`
-The bundled version includes Moment.js built into the same file. This version should be used if you wish to use time axes and want a single file to include. Do not use this build if your application already includes Moment.js. If you do, Moment.js will be included twice, increasing the page load time and potentially introducing version issues.
\ No newline at end of file
+The bundled version includes Moment.js built into the same file. This version should be used if you wish to use time axes and want a single file to include. Do not use this build if your application already includes Moment.js. If you do, Moment.js will be included twice, increasing the page load time and potentially introducing version issues.
};
function generateData(config) {
- return utils.numbers(utils.merge(inputs, config || {}));
+ return utils.numbers(Chart.helpers.merge(inputs, config || {}));
}
function generateLabels(config) {
- return utils.months(utils.merge({
+ return utils.months(Chart.helpers.merge({
count: inputs.count,
section: 3
}, config || {}));
fill: boundary
}]
},
- options: utils.merge(options, {
+ options: Chart.helpers.merge(options, {
title: {
text: 'fill: ' + boundary,
display: true
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="icon" href="favicon.ico">
<script src="samples.js"></script>
+ <script src="utils.js"></script>
<title>Chart.js samples</title>
</head>
<body>
-/* global Chart */
-
'use strict';
window.chartColors = {
];
var Samples = global.Samples || (global.Samples = {});
+ var Color = global.Color;
+
Samples.utils = {
// Adapted from http://indiegamr.com/generate-repeatable-random-numbers-in-js/
srand: function(seed) {
transparentize: function(color, opacity) {
var alpha = opacity === undefined ? 0.5 : 1 - opacity;
- return Chart.helpers.color(color).alpha(alpha).rgbString();
- },
-
- merge: Chart.helpers.configMerge
+ return Color(color).alpha(alpha).rgbString();
+ }
};
- Samples.utils.srand(Date.now());
-
// DEPRECATED
window.randomScalingFactor = function() {
return Math.round(Samples.utils.rand(-100, 100));
};
-}(this));
+ // INITIALIZATION
+
+ Samples.utils.srand(Date.now());
+ // Google Analytics
+ /* eslint-disable */
+ if (document.location.hostname.match(/^(www\.)?chartjs\.org$/)) {
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+ ga('create', 'UA-28909194-3', 'auto');
+ ga('send', 'pageview');
+ }
+ /* eslint-enable */
+
+}(this));