Statify - Version 1.7.0

Version Description

Download this release

Release Info

Developer patrickrobrecht
Plugin Icon 128x128 Statify
Version 1.7.0
Comparing to
See all releases

Code changes from version 1.6.3 to 1.7.0

CHANGELOG.md ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).
3
+
4
+ ## 1.7.0
5
+ * Fix JavaScript embedding when bots visit before caching (#84) (#86)
6
+ * Fix offset in visitor reporting due to different timezones between PHP and database (#117, props @sophiehuiberts)
7
+ * Fix untranslatable support link (#122) (#126, props @arkonisus)
8
+ * Add separate settings page and reduced widget backview to widget settings only (#111)
9
+ * Add options to track logged in users (#103) (#111)
10
+ * Add option to show total visits (#134, props @yurihs)
11
+ * Refactored JavaScript tracking to use WP AJAX (#109) (#142)
12
+ * Introduced new option to separate display from storage range (#72)
13
+ * Automatically add AMP analytics trigger if official AMP PlugIn is installed (#110) (#116, props @tthemann)
14
+ * Dashboard widget is now scrollable with dynamic point radius to keep long-term statistics readable (#71) (#101, props @manumeter)
15
+ * Improved bot detection (#112) (#125, props @mahype)
16
+ * Updated Chartist JS library for dashboard widget (#132)
17
+ * Skip tracking for favicon.ico redirects (since WP 5.4) (#144)
18
+ * Tested up to WordPress 5.4
19
+
20
+ ## 1.6.3
21
+ * Fix compatibility issue with some PHP implementations not populating `INPUT_SERVER`
22
+ * Fix failing blacklist check for empty referrers
23
+ * JS snippet call properly breaks page generation when tracking is skipped
24
+
25
+ ## 1.6.2
26
+ * Fix compatibility issues with JavaScript optimization plugins
27
+ * Fix tracking issue if JavaScript tracking is disabled
28
+
29
+ ## 1.6.1
30
+ * Scaled datapoint size to number of records in dashboard widget to improve legibility
31
+ * Fix display of larger numbers in the y-axis
32
+ * Added JS source maps to avoid warnings with developer tools
33
+ * Move JS snippet to separate file
34
+ * Add JS snippet to output even if tracking is skipped to avoid caching problems
35
+ * Improve code style
36
+ * Enable nonce-verification in dashboard widget to prevent CSRF
37
+
38
+ ## 1.6.0
39
+ * Added hook statify__visit_saved which is fired after a visit was stored in the database.
40
+ * Migrated dashboard chart to Chartist.
41
+ * Fixed JavaScript tracking not working in some environment which have X-Content-Type: nosniff environment enabled.
42
+
43
+ ## 1.5.3 / 2017-11-28
44
+ * Replace javascript library to fixed several problems. #52
45
+
46
+ ## 1.5.2 / 2017-08-15
47
+ * Switched to minimal WordPress version 4.7, removed fallback code not needed anymore
48
+
49
+ ## 1.5.1 / 2017-05-04
50
+ * Bugfix: Consider filter for skipping tracking correctly if JavaScript tracking is disabled.
51
+ * Bugfix: PHP Notice for empty blacklist value.
52
+
53
+ ## 1.5.0 / 2017-03-23
54
+ * Switched to minimal PHP version 5.3
55
+ * Added more flexible settings for period of data saving and the number of entries shown in top lists
56
+ * Added validation of form data before saving settings
57
+ * Moved all documentation to [wordpress.org](https://wordpress.org/plugins/statify/).
58
+ * Added optional referrer spam protection (can be activated via the Statify settings).
59
+ * Improved conformance to the WordPress coding guidelines
60
+ * Bugfix for multi-site installations: Don't track network admin url.
61
+ * Changed hook name `statify_skip_tracking` to `statify__skip_tracking`.
62
+
63
+ ## 1.4.3 / 15.08.2016
64
+ * Corrected tracking and display in Multisite
65
+ * Minor CSS fixes in the dashboard widget
66
+ * Removed deprecated links and updated URLs for donate and wiki links
67
+ * Administrative updates to plugin header and README
68
+ * Updated [plugin authors](https://gist.github.com/glueckpress/f058c0ab973d45a72720)
69
+
70
+ ## 1.4.2 / 01.05.2015
71
+ * Replace `filter_has_var(INPUT_SERVER)` calls with `isset($_SERVER[])` ([why](https://github.com/wp-stream/stream/issues/254))
72
+
73
+ ## 1.4.1 / 29.04.2015
74
+ * Renew the tracking mechanism
75
+
76
+ ## 1.4.0 / 16.04.2015
77
+ * WordPress 4.2 support
78
+ * Plugin-wide code refactoring
79
+ * Translations for English and Russian
80
+ * [GitHub Repository](https://github.com/pluginkollektiv/statify)
81
+
82
+ ## 1.3.0 / 28.04.2014
83
+ * Sourcecode optimization for plugin-finalization
84
+
85
+ ## 1.2.8 / 19.04.2014
86
+ * JavaScript-Snippet: Relative Path for HTTP(S)-calls
87
+
88
+ ## 1.2.7 / 09.04.2014
89
+ * Support for WordPress 3.9
90
+ * Correction of dashboard links (if WordPress is in subfolder)
91
+
92
+ ## 1.2.6 / 12.12.2013
93
+ * Optimization for WordPress 3.8
94
+ * Control of tracking via `statify_skip_tracking`
95
+
96
+ ## 1.2.5 / 22.08.2013
97
+ * Migration of chart-software
98
+
99
+ ## 1.2.4 / 06.08.2013
100
+ * Compatibility to WordPress 3.6
101
+
102
+ ## 1.2.3 / 06.06.2013
103
+ * Additional protection of PHP classes against direct access
104
+ * Replacement for Deprecated [User Levels](http://codex.wordpress.org/Roles_and_Capabilities#User_Levels)
105
+
106
+ ## 1.2.2 / 14.03.2013
107
+ * No-Cache and No-Content Header for optional Count JavaScript
108
+
109
+ ## 1.2.1 / 18.12.2012
110
+ * Additional periods (up to one year) for statistics
111
+ * WordPress 3.4 as requirement
112
+
113
+ ## 1.2 / 29.11.2012
114
+ * Specially for Chrome Browser developed Statify App (discontinued)
115
+ * Fix for introduced XML-RPC-interface
116
+
117
+ ## 1.1 / 23.11.2012
118
+ * WordPress 3.5 Support
119
+ * Interface via XML-RPC
120
+ * Refactoring of Code Base
121
+ * Revision of Online Documentation
122
+ * Optional Tracking via JavaScript for Caching-Plugins
123
+
124
+ ## 1.0 / 12.06.2012
125
+ * WordPress 3.4 Support
126
+ * [Official Plugin Website](http://statify.de "Statify WordPress Stats")
127
+ * Uncompressed Version of Source Codes
128
+
129
+ ## 0.9 / 23.12.2011
130
+ * Xmas Edition
131
+
132
+ ## 0.8 / 14.12.2011
133
+ * Support für WordPress 3.3
134
+ * Display of Dashboard Widgets also for authors
135
+ * Direct Link to settings on dashboard
136
+ * Filtering der Targets/Referrer on the current date
137
+
138
+ ## 0.7 / 05.07.2011
139
+ * Replacement of Statistic Days
140
+ * Recolouring of Statistics Mark
141
+ * Ignoring XML-RPC-Requests
142
+
143
+ ## 0.6 / 22.06.2011
144
+ * Support for WordPress 3.2
145
+ * Support for WordPress Multisite
146
+ * Adjustment of redundant URL parameters of target pages
147
+ * Interaktive Statistics with further informations
148
+
149
+ ## 0.5 / 15.05.2011
150
+ * Fix: query for missing referrer in dashboard widget
151
+
152
+ ## 0.4 / 16.03.2011
153
+ * Statify goes online
css/chartist.min.css CHANGED
@@ -1 +1 @@
1
- .ct-double-octave:after,.ct-major-eleventh:after,.ct-major-second:after,.ct-major-seventh:after,.ct-major-sixth:after,.ct-major-tenth:after,.ct-major-third:after,.ct-major-twelfth:after,.ct-minor-second:after,.ct-minor-seventh:after,.ct-minor-sixth:after,.ct-minor-third:after,.ct-octave:after,.ct-perfect-fifth:after,.ct-perfect-fourth:after,.ct-square:after{content:"";clear:both}.ct-label{fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:.75rem;line-height:1}.ct-grid-background,.ct-line{fill:none}.ct-chart-bar .ct-label,.ct-chart-line .ct-label{display:block;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex}.ct-chart-donut .ct-label,.ct-chart-pie .ct-label{dominant-baseline:central}.ct-label.ct-horizontal.ct-start{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-label.ct-horizontal.ct-end{-webkit-box-align:flex-start;-webkit-align-items:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-label.ct-vertical.ct-start{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:flex-end;-webkit-justify-content:flex-end;-ms-flex-pack:flex-end;justify-content:flex-end;text-align:right;text-anchor:end}.ct-label.ct-vertical.ct-end{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-chart-bar .ct-label.ct-horizontal.ct-start{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;text-anchor:start}.ct-chart-bar .ct-label.ct-horizontal.ct-end{-webkit-box-align:flex-start;-webkit-align-items:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;text-anchor:start}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-horizontal.ct-start{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-horizontal.ct-end{-webkit-box-align:flex-start;-webkit-align-items:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-vertical.ct-start{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:flex-end;-webkit-justify-content:flex-end;-ms-flex-pack:flex-end;justify-content:flex-end;text-align:right;text-anchor:end}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-vertical.ct-end{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:end}.ct-grid{stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px}.ct-point{stroke-width:10px;stroke-linecap:round}.ct-line{stroke-width:4px}.ct-area{stroke:none;fill-opacity:.1}.ct-bar{fill:none;stroke-width:10px}.ct-slice-donut{fill:none;stroke-width:60px}.ct-series-a .ct-bar,.ct-series-a .ct-line,.ct-series-a .ct-point,.ct-series-a .ct-slice-donut{stroke:#d70206}.ct-series-a .ct-area,.ct-series-a .ct-slice-donut-solid,.ct-series-a .ct-slice-pie{fill:#d70206}.ct-series-b .ct-bar,.ct-series-b .ct-line,.ct-series-b .ct-point,.ct-series-b .ct-slice-donut{stroke:#f05b4f}.ct-series-b .ct-area,.ct-series-b .ct-slice-donut-solid,.ct-series-b .ct-slice-pie{fill:#f05b4f}.ct-series-c .ct-bar,.ct-series-c .ct-line,.ct-series-c .ct-point,.ct-series-c .ct-slice-donut{stroke:#f4c63d}.ct-series-c .ct-area,.ct-series-c .ct-slice-donut-solid,.ct-series-c .ct-slice-pie{fill:#f4c63d}.ct-series-d .ct-bar,.ct-series-d .ct-line,.ct-series-d .ct-point,.ct-series-d .ct-slice-donut{stroke:#d17905}.ct-series-d .ct-area,.ct-series-d .ct-slice-donut-solid,.ct-series-d .ct-slice-pie{fill:#d17905}.ct-series-e .ct-bar,.ct-series-e .ct-line,.ct-series-e .ct-point,.ct-series-e .ct-slice-donut{stroke:#453d3f}.ct-series-e .ct-area,.ct-series-e .ct-slice-donut-solid,.ct-series-e .ct-slice-pie{fill:#453d3f}.ct-series-f .ct-bar,.ct-series-f .ct-line,.ct-series-f .ct-point,.ct-series-f .ct-slice-donut{stroke:#59922b}.ct-series-f .ct-area,.ct-series-f .ct-slice-donut-solid,.ct-series-f .ct-slice-pie{fill:#59922b}.ct-series-g .ct-bar,.ct-series-g .ct-line,.ct-series-g .ct-point,.ct-series-g .ct-slice-donut{stroke:#0544d3}.ct-series-g .ct-area,.ct-series-g .ct-slice-donut-solid,.ct-series-g .ct-slice-pie{fill:#0544d3}.ct-series-h .ct-bar,.ct-series-h .ct-line,.ct-series-h .ct-point,.ct-series-h .ct-slice-donut{stroke:#6b0392}.ct-series-h .ct-area,.ct-series-h .ct-slice-donut-solid,.ct-series-h .ct-slice-pie{fill:#6b0392}.ct-series-i .ct-bar,.ct-series-i .ct-line,.ct-series-i .ct-point,.ct-series-i .ct-slice-donut{stroke:#f05b4f}.ct-series-i .ct-area,.ct-series-i .ct-slice-donut-solid,.ct-series-i .ct-slice-pie{fill:#f05b4f}.ct-series-j .ct-bar,.ct-series-j .ct-line,.ct-series-j .ct-point,.ct-series-j .ct-slice-donut{stroke:#dda458}.ct-series-j .ct-area,.ct-series-j .ct-slice-donut-solid,.ct-series-j .ct-slice-pie{fill:#dda458}.ct-series-k .ct-bar,.ct-series-k .ct-line,.ct-series-k .ct-point,.ct-series-k .ct-slice-donut{stroke:#eacf7d}.ct-series-k .ct-area,.ct-series-k .ct-slice-donut-solid,.ct-series-k .ct-slice-pie{fill:#eacf7d}.ct-series-l .ct-bar,.ct-series-l .ct-line,.ct-series-l .ct-point,.ct-series-l .ct-slice-donut{stroke:#86797d}.ct-series-l .ct-area,.ct-series-l .ct-slice-donut-solid,.ct-series-l .ct-slice-pie{fill:#86797d}.ct-series-m .ct-bar,.ct-series-m .ct-line,.ct-series-m .ct-point,.ct-series-m .ct-slice-donut{stroke:#b2c326}.ct-series-m .ct-area,.ct-series-m .ct-slice-donut-solid,.ct-series-m .ct-slice-pie{fill:#b2c326}.ct-series-n .ct-bar,.ct-series-n .ct-line,.ct-series-n .ct-point,.ct-series-n .ct-slice-donut{stroke:#6188e2}.ct-series-n .ct-area,.ct-series-n .ct-slice-donut-solid,.ct-series-n .ct-slice-pie{fill:#6188e2}.ct-series-o .ct-bar,.ct-series-o .ct-line,.ct-series-o .ct-point,.ct-series-o .ct-slice-donut{stroke:#a748ca}.ct-series-o .ct-area,.ct-series-o .ct-slice-donut-solid,.ct-series-o .ct-slice-pie{fill:#a748ca}.ct-square{display:block;position:relative;width:100%}.ct-square:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:100%}.ct-square:after{display:table}.ct-square>svg{display:block;position:absolute;top:0;left:0}.ct-minor-second{display:block;position:relative;width:100%}.ct-minor-second:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:93.75%}.ct-minor-second:after{display:table}.ct-minor-second>svg{display:block;position:absolute;top:0;left:0}.ct-major-second{display:block;position:relative;width:100%}.ct-major-second:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:88.8888888889%}.ct-major-second:after{display:table}.ct-major-second>svg{display:block;position:absolute;top:0;left:0}.ct-minor-third{display:block;position:relative;width:100%}.ct-minor-third:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:83.3333333333%}.ct-minor-third:after{display:table}.ct-minor-third>svg{display:block;position:absolute;top:0;left:0}.ct-major-third{display:block;position:relative;width:100%}.ct-major-third:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:80%}.ct-major-third:after{display:table}.ct-major-third>svg{display:block;position:absolute;top:0;left:0}.ct-perfect-fourth{display:block;position:relative;width:100%}.ct-perfect-fourth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:75%}.ct-perfect-fourth:after{display:table}.ct-perfect-fourth>svg{display:block;position:absolute;top:0;left:0}.ct-perfect-fifth{display:block;position:relative;width:100%}.ct-perfect-fifth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:66.6666666667%}.ct-perfect-fifth:after{display:table}.ct-perfect-fifth>svg{display:block;position:absolute;top:0;left:0}.ct-minor-sixth{display:block;position:relative;width:100%}.ct-minor-sixth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:62.5%}.ct-minor-sixth:after{display:table}.ct-minor-sixth>svg{display:block;position:absolute;top:0;left:0}.ct-golden-section{display:block;position:relative;width:100%}.ct-golden-section:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:61.804697157%}.ct-golden-section:after{content:"";display:table;clear:both}.ct-golden-section>svg{display:block;position:absolute;top:0;left:0}.ct-major-sixth{display:block;position:relative;width:100%}.ct-major-sixth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:60%}.ct-major-sixth:after{display:table}.ct-major-sixth>svg{display:block;position:absolute;top:0;left:0}.ct-minor-seventh{display:block;position:relative;width:100%}.ct-minor-seventh:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:56.25%}.ct-minor-seventh:after{display:table}.ct-minor-seventh>svg{display:block;position:absolute;top:0;left:0}.ct-major-seventh{display:block;position:relative;width:100%}.ct-major-seventh:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:53.3333333333%}.ct-major-seventh:after{display:table}.ct-major-seventh>svg{display:block;position:absolute;top:0;left:0}.ct-octave{display:block;position:relative;width:100%}.ct-octave:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:50%}.ct-octave:after{display:table}.ct-octave>svg{display:block;position:absolute;top:0;left:0}.ct-major-tenth{display:block;position:relative;width:100%}.ct-major-tenth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:40%}.ct-major-tenth:after{display:table}.ct-major-tenth>svg{display:block;position:absolute;top:0;left:0}.ct-major-eleventh{display:block;position:relative;width:100%}.ct-major-eleventh:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:37.5%}.ct-major-eleventh:after{display:table}.ct-major-eleventh>svg{display:block;position:absolute;top:0;left:0}.ct-major-twelfth{display:block;position:relative;width:100%}.ct-major-twelfth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:33.3333333333%}.ct-major-twelfth:after{display:table}.ct-major-twelfth>svg{display:block;position:absolute;top:0;left:0}.ct-double-octave{display:block;position:relative;width:100%}.ct-double-octave:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:25%}.ct-double-octave:after{display:table}.ct-double-octave>svg{display:block;position:absolute;top:0;left:0}
1
+ .ct-double-octave:after,.ct-golden-section:after,.ct-major-eleventh:after,.ct-major-second:after,.ct-major-seventh:after,.ct-major-sixth:after,.ct-major-tenth:after,.ct-major-third:after,.ct-major-twelfth:after,.ct-minor-second:after,.ct-minor-seventh:after,.ct-minor-sixth:after,.ct-minor-third:after,.ct-octave:after,.ct-perfect-fifth:after,.ct-perfect-fourth:after,.ct-square:after{content:"";clear:both}.ct-label{fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:.75rem;line-height:1}.ct-chart-bar .ct-label,.ct-chart-line .ct-label{display:block;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex}.ct-chart-donut .ct-label,.ct-chart-pie .ct-label{dominant-baseline:central}.ct-label.ct-horizontal.ct-start{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-label.ct-horizontal.ct-end{-webkit-box-align:flex-start;-webkit-align-items:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-label.ct-vertical.ct-start{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:flex-end;-webkit-justify-content:flex-end;-ms-flex-pack:flex-end;justify-content:flex-end;text-align:right;text-anchor:end}.ct-label.ct-vertical.ct-end{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-chart-bar .ct-label.ct-horizontal.ct-start{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;text-anchor:start}.ct-chart-bar .ct-label.ct-horizontal.ct-end{-webkit-box-align:flex-start;-webkit-align-items:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;text-align:center;text-anchor:start}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-horizontal.ct-start{-webkit-box-align:flex-end;-webkit-align-items:flex-end;-ms-flex-align:flex-end;align-items:flex-end;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-horizontal.ct-end{-webkit-box-align:flex-start;-webkit-align-items:flex-start;-ms-flex-align:flex-start;align-items:flex-start;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-vertical.ct-start{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:flex-end;-webkit-justify-content:flex-end;-ms-flex-pack:flex-end;justify-content:flex-end;text-align:right;text-anchor:end}.ct-chart-bar.ct-horizontal-bars .ct-label.ct-vertical.ct-end{-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:flex-start;-webkit-justify-content:flex-start;-ms-flex-pack:flex-start;justify-content:flex-start;text-align:left;text-anchor:end}.ct-grid{stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px}.ct-grid-background{fill:none}.ct-point{stroke-width:10px;stroke-linecap:round}.ct-line{fill:none;stroke-width:4px}.ct-area{stroke:none;fill-opacity:.1}.ct-bar{fill:none;stroke-width:10px}.ct-slice-donut{fill:none;stroke-width:60px}.ct-series-a .ct-bar,.ct-series-a .ct-line,.ct-series-a .ct-point,.ct-series-a .ct-slice-donut{stroke:#d70206}.ct-series-a .ct-area,.ct-series-a .ct-slice-donut-solid,.ct-series-a .ct-slice-pie{fill:#d70206}.ct-series-b .ct-bar,.ct-series-b .ct-line,.ct-series-b .ct-point,.ct-series-b .ct-slice-donut{stroke:#f05b4f}.ct-series-b .ct-area,.ct-series-b .ct-slice-donut-solid,.ct-series-b .ct-slice-pie{fill:#f05b4f}.ct-series-c .ct-bar,.ct-series-c .ct-line,.ct-series-c .ct-point,.ct-series-c .ct-slice-donut{stroke:#f4c63d}.ct-series-c .ct-area,.ct-series-c .ct-slice-donut-solid,.ct-series-c .ct-slice-pie{fill:#f4c63d}.ct-series-d .ct-bar,.ct-series-d .ct-line,.ct-series-d .ct-point,.ct-series-d .ct-slice-donut{stroke:#d17905}.ct-series-d .ct-area,.ct-series-d .ct-slice-donut-solid,.ct-series-d .ct-slice-pie{fill:#d17905}.ct-series-e .ct-bar,.ct-series-e .ct-line,.ct-series-e .ct-point,.ct-series-e .ct-slice-donut{stroke:#453d3f}.ct-series-e .ct-area,.ct-series-e .ct-slice-donut-solid,.ct-series-e .ct-slice-pie{fill:#453d3f}.ct-series-f .ct-bar,.ct-series-f .ct-line,.ct-series-f .ct-point,.ct-series-f .ct-slice-donut{stroke:#59922b}.ct-series-f .ct-area,.ct-series-f .ct-slice-donut-solid,.ct-series-f .ct-slice-pie{fill:#59922b}.ct-series-g .ct-bar,.ct-series-g .ct-line,.ct-series-g .ct-point,.ct-series-g .ct-slice-donut{stroke:#0544d3}.ct-series-g .ct-area,.ct-series-g .ct-slice-donut-solid,.ct-series-g .ct-slice-pie{fill:#0544d3}.ct-series-h .ct-bar,.ct-series-h .ct-line,.ct-series-h .ct-point,.ct-series-h .ct-slice-donut{stroke:#6b0392}.ct-series-h .ct-area,.ct-series-h .ct-slice-donut-solid,.ct-series-h .ct-slice-pie{fill:#6b0392}.ct-series-i .ct-bar,.ct-series-i .ct-line,.ct-series-i .ct-point,.ct-series-i .ct-slice-donut{stroke:#f05b4f}.ct-series-i .ct-area,.ct-series-i .ct-slice-donut-solid,.ct-series-i .ct-slice-pie{fill:#f05b4f}.ct-series-j .ct-bar,.ct-series-j .ct-line,.ct-series-j .ct-point,.ct-series-j .ct-slice-donut{stroke:#dda458}.ct-series-j .ct-area,.ct-series-j .ct-slice-donut-solid,.ct-series-j .ct-slice-pie{fill:#dda458}.ct-series-k .ct-bar,.ct-series-k .ct-line,.ct-series-k .ct-point,.ct-series-k .ct-slice-donut{stroke:#eacf7d}.ct-series-k .ct-area,.ct-series-k .ct-slice-donut-solid,.ct-series-k .ct-slice-pie{fill:#eacf7d}.ct-series-l .ct-bar,.ct-series-l .ct-line,.ct-series-l .ct-point,.ct-series-l .ct-slice-donut{stroke:#86797d}.ct-series-l .ct-area,.ct-series-l .ct-slice-donut-solid,.ct-series-l .ct-slice-pie{fill:#86797d}.ct-series-m .ct-bar,.ct-series-m .ct-line,.ct-series-m .ct-point,.ct-series-m .ct-slice-donut{stroke:#b2c326}.ct-series-m .ct-area,.ct-series-m .ct-slice-donut-solid,.ct-series-m .ct-slice-pie{fill:#b2c326}.ct-series-n .ct-bar,.ct-series-n .ct-line,.ct-series-n .ct-point,.ct-series-n .ct-slice-donut{stroke:#6188e2}.ct-series-n .ct-area,.ct-series-n .ct-slice-donut-solid,.ct-series-n .ct-slice-pie{fill:#6188e2}.ct-series-o .ct-bar,.ct-series-o .ct-line,.ct-series-o .ct-point,.ct-series-o .ct-slice-donut{stroke:#a748ca}.ct-series-o .ct-area,.ct-series-o .ct-slice-donut-solid,.ct-series-o .ct-slice-pie{fill:#a748ca}.ct-square{display:block;position:relative;width:100%}.ct-square:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:100%}.ct-square:after{display:table}.ct-square>svg{display:block;position:absolute;top:0;left:0}.ct-minor-second{display:block;position:relative;width:100%}.ct-minor-second:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:93.75%}.ct-minor-second:after{display:table}.ct-minor-second>svg{display:block;position:absolute;top:0;left:0}.ct-major-second{display:block;position:relative;width:100%}.ct-major-second:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:88.8888888889%}.ct-major-second:after{display:table}.ct-major-second>svg{display:block;position:absolute;top:0;left:0}.ct-minor-third{display:block;position:relative;width:100%}.ct-minor-third:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:83.3333333333%}.ct-minor-third:after{display:table}.ct-minor-third>svg{display:block;position:absolute;top:0;left:0}.ct-major-third{display:block;position:relative;width:100%}.ct-major-third:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:80%}.ct-major-third:after{display:table}.ct-major-third>svg{display:block;position:absolute;top:0;left:0}.ct-perfect-fourth{display:block;position:relative;width:100%}.ct-perfect-fourth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:75%}.ct-perfect-fourth:after{display:table}.ct-perfect-fourth>svg{display:block;position:absolute;top:0;left:0}.ct-perfect-fifth{display:block;position:relative;width:100%}.ct-perfect-fifth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:66.6666666667%}.ct-perfect-fifth:after{display:table}.ct-perfect-fifth>svg{display:block;position:absolute;top:0;left:0}.ct-minor-sixth{display:block;position:relative;width:100%}.ct-minor-sixth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:62.5%}.ct-minor-sixth:after{display:table}.ct-minor-sixth>svg{display:block;position:absolute;top:0;left:0}.ct-golden-section{display:block;position:relative;width:100%}.ct-golden-section:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:61.804697157%}.ct-golden-section:after{display:table}.ct-golden-section>svg{display:block;position:absolute;top:0;left:0}.ct-major-sixth{display:block;position:relative;width:100%}.ct-major-sixth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:60%}.ct-major-sixth:after{display:table}.ct-major-sixth>svg{display:block;position:absolute;top:0;left:0}.ct-minor-seventh{display:block;position:relative;width:100%}.ct-minor-seventh:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:56.25%}.ct-minor-seventh:after{display:table}.ct-minor-seventh>svg{display:block;position:absolute;top:0;left:0}.ct-major-seventh{display:block;position:relative;width:100%}.ct-major-seventh:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:53.3333333333%}.ct-major-seventh:after{display:table}.ct-major-seventh>svg{display:block;position:absolute;top:0;left:0}.ct-octave{display:block;position:relative;width:100%}.ct-octave:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:50%}.ct-octave:after{display:table}.ct-octave>svg{display:block;position:absolute;top:0;left:0}.ct-major-tenth{display:block;position:relative;width:100%}.ct-major-tenth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:40%}.ct-major-tenth:after{display:table}.ct-major-tenth>svg{display:block;position:absolute;top:0;left:0}.ct-major-eleventh{display:block;position:relative;width:100%}.ct-major-eleventh:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:37.5%}.ct-major-eleventh:after{display:table}.ct-major-eleventh>svg{display:block;position:absolute;top:0;left:0}.ct-major-twelfth{display:block;position:relative;width:100%}.ct-major-twelfth:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:33.3333333333%}.ct-major-twelfth:after{display:table}.ct-major-twelfth>svg{display:block;position:absolute;top:0;left:0}.ct-double-octave{display:block;position:relative;width:100%}.ct-double-octave:before{display:block;float:left;content:"";width:0;height:0;padding-bottom:25%}.ct-double-octave:after{display:table}.ct-double-octave>svg{display:block;position:absolute;top:0;left:0}
css/dashboard.css CHANGED
@@ -1,92 +1,115 @@
1
  /* @group Front page */
2
 
3
  #statify_chart {
4
- color: #aaa;
5
- height: 140px;
6
- margin: 0 -4px;
7
- text-align: center;
 
 
 
 
8
  }
 
9
  #statify_chart_data {
10
- display: none;
11
  }
12
 
13
  #statify_chart .ct-label.ct-vertical.ct-start {
14
- -webkit-justify-content: flex-start;
15
- justify-content: flex-start;
16
- text-align: left;
17
- text-anchor: start;
18
  }
19
 
20
  #statify_chart .ct-line {
21
- stroke: #0074a2;
22
- stroke-width: 2px;
23
  }
24
 
25
  #statify_chart .ct-point {
26
- fill: #ffffff;
27
- stroke: #0074a2;
28
- stroke-width: 1.5px;
29
  }
30
 
31
  #statify_chart .ct-area {
32
- fill: #0074a2;
33
  }
34
 
35
  .statify-chartist-tooltip {
36
- border: 1px solid #000000;
37
- background-color: #ffffff;
38
- border-radius: 0.2em;
39
- padding: 0.1em 0.5em;
40
  }
41
 
42
- .statify-chartist-tooltip:before {
43
- border-top-color: #00000099;
44
  }
45
 
46
  .statify-chartist-tooltip .chartist-tooltip-meta {
47
- color: #0074a2;
 
 
 
 
 
 
 
48
  }
49
 
50
  #statify_dashboard .inside {
51
- height: 1%;
52
- margin: 0;
53
- padding-bottom: 0;
54
- overflow: hidden;
55
- position: relative;
56
  }
57
 
58
  #statify_dashboard .table {
59
- padding-bottom: 12px;
60
  }
 
61
  #statify_dashboard .table p.sub {
62
- color: #BBB;
63
- margin: 0 0 -4px;
64
  }
 
65
  #statify_dashboard .table div {
66
- overflow: hidden;
67
  }
68
 
69
  #statify_dashboard .table.referrer {
70
- float: left;
71
- width: 45%;
72
  }
 
73
  #statify_dashboard .table.target {
74
- float: right;
75
- width: 55%;
 
 
 
 
 
 
76
  }
77
 
78
  #statify_dashboard td {
79
- padding: 8px 0 0;
80
- line-height: 1.4em;
81
  }
 
82
  #statify_dashboard td.b {
83
- text-align: right;
84
- padding-right: 4px;
85
- color: #777;
86
  }
 
87
  #statify_dashboard label {
88
- display: block;
89
- margin-bottom: 1.1em !important;
90
  }
91
 
92
  /* @end group */
@@ -95,16 +118,17 @@
95
  /* @group Back stage */
96
 
97
  #statify_dashboard form {
98
- padding: 18px 0;
99
  }
 
100
  #statify_dashboard input[type="number"] {
101
- width: 100px;
102
  }
103
 
104
  #statify_dashboard .meta-links {
105
- float: right;
106
- margin: 0;
107
- line-height: 28px;
108
  }
109
 
110
  /* @end group */
1
  /* @group Front page */
2
 
3
  #statify_chart {
4
+ color: #aaa;
5
+ direction: rtl;
6
+ height: 140px;
7
+ margin: 0 -4px;
8
+ overflow-x: auto;
9
+ overflow-y: hidden;
10
+ text-align: center;
11
+ width: 100%;
12
  }
13
+
14
  #statify_chart_data {
15
+ display: none;
16
  }
17
 
18
  #statify_chart .ct-label.ct-vertical.ct-start {
19
+ -webkit-justify-content: flex-start;
20
+ justify-content: flex-start;
21
+ text-align: left;
22
+ text-anchor: start;
23
  }
24
 
25
  #statify_chart .ct-line {
26
+ stroke: #0074a2;
27
+ stroke-width: 2px;
28
  }
29
 
30
  #statify_chart .ct-point {
31
+ fill: #fff;
32
+ stroke: #0074a2;
33
+ stroke-width: 1.5px;
34
  }
35
 
36
  #statify_chart .ct-area {
37
+ fill: #0074a2;
38
  }
39
 
40
  .statify-chartist-tooltip {
41
+ border: 1px solid #000;
42
+ background-color: #fff;
43
+ border-radius: 0.2em;
44
+ padding: 0.1em 0.5em;
45
  }
46
 
47
+ .statify-chartist-tooltip::before {
48
+ border-top-color: #0009;
49
  }
50
 
51
  .statify-chartist-tooltip .chartist-tooltip-meta {
52
+ color: #0074a2;
53
+ }
54
+
55
+ #statify_dashboard .postbox-title-action a,
56
+ #statify_dashboard .settings-link a {
57
+ display: block;
58
+ line-height: 20px;
59
+ text-decoration: none;
60
  }
61
 
62
  #statify_dashboard .inside {
63
+ height: 1%;
64
+ margin: 0;
65
+ padding-bottom: 0;
66
+ overflow: hidden;
67
+ position: relative;
68
  }
69
 
70
  #statify_dashboard .table {
71
+ padding-bottom: 12px;
72
  }
73
+
74
  #statify_dashboard .table p.sub {
75
+ color: #bbb;
76
+ margin: 0 0 -4px;
77
  }
78
+
79
  #statify_dashboard .table div {
80
+ overflow: hidden;
81
  }
82
 
83
  #statify_dashboard .table.referrer {
84
+ float: left;
85
+ width: 45%;
86
  }
87
+
88
  #statify_dashboard .table.target {
89
+ float: right;
90
+ width: 55%;
91
+ }
92
+
93
+ #statify_dashboard .table.total {
94
+ clear: both;
95
+ float: left;
96
+ width: 45%;
97
  }
98
 
99
  #statify_dashboard td {
100
+ padding: 8px 0 0;
101
+ line-height: 1.4;
102
  }
103
+
104
  #statify_dashboard td.b {
105
+ text-align: right;
106
+ padding-right: 4px;
107
+ color: #777;
108
  }
109
+
110
  #statify_dashboard label {
111
+ display: block;
112
+ margin-bottom: 1.1em !important;
113
  }
114
 
115
  /* @end group */
118
  /* @group Back stage */
119
 
120
  #statify_dashboard form {
121
+ padding: 18px 0;
122
  }
123
+
124
  #statify_dashboard input[type="number"] {
125
+ width: 100px;
126
  }
127
 
128
  #statify_dashboard .meta-links {
129
+ float: right;
130
+ margin: 0;
131
+ line-height: 28px;
132
  }
133
 
134
  /* @end group */
css/dashboard.min.css CHANGED
@@ -1 +1 @@
1
- #statify_chart{color:#aaa;height:140px;margin:0 -4px;text-align:center}#statify_chart_data{display:none}#statify_chart .ct-label.ct-vertical.ct-start{-webkit-justify-content:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}#statify_chart .ct-line{stroke:#0074a2;stroke-width:2px}#statify_chart .ct-point{fill:#fff;stroke:#0074a2;stroke-width:1.5px}#statify_chart .ct-area{fill:#0074a2}.statify-chartist-tooltip{border:1px solid #000;background-color:#fff;border-radius:.2em;padding:.1em .5em}.statify-chartist-tooltip:before{border-top-color:#00000099}.statify-chartist-tooltip .chartist-tooltip-meta{color:#0074a2}#statify_dashboard .inside{height:1%;margin:0;padding-bottom:0;overflow:hidden;position:relative}#statify_dashboard .table{padding-bottom:12px}#statify_dashboard .table p.sub{color:#BBB;margin:0 0 -4px}#statify_dashboard .table div{overflow:hidden}#statify_dashboard .table.referrer{float:left;width:45%}#statify_dashboard .table.target{float:right;width:55%}#statify_dashboard td{padding:8px 0 0;line-height:1.4em}#statify_dashboard td.b{text-align:right;padding-right:4px;color:#777}#statify_dashboard label{display:block;margin-bottom:1.1em!important}#statify_dashboard form{padding:18px 0}#statify_dashboard input[type="number"]{width:100px}#statify_dashboard .meta-links{float:right;margin:0;line-height:28px}
1
+ #statify_chart{color:#aaa;direction:rtl;height:140px;margin:0 -4px;overflow-x:auto;overflow-y:hidden;text-align:center;width:100%}#statify_chart_data{display:none}#statify_chart .ct-label.ct-vertical.ct-start{-webkit-justify-content:flex-start;justify-content:flex-start;text-align:left;text-anchor:start}#statify_chart .ct-line{stroke:#0074a2;stroke-width:2px}#statify_chart .ct-point{fill:#fff;stroke:#0074a2;stroke-width:1.5px}#statify_chart .ct-area{fill:#0074a2}.statify-chartist-tooltip{border:1px solid #000;background-color:#fff;border-radius:.2em;padding:.1em .5em}.statify-chartist-tooltip::before{border-top-color:#0009}.statify-chartist-tooltip .chartist-tooltip-meta{color:#0074a2}#statify_dashboard .postbox-title-action a,#statify_dashboard .settings-link a{display:block;line-height:20px;text-decoration:none}#statify_dashboard .inside{height:1%;margin:0;padding-bottom:0;overflow:hidden;position:relative}#statify_dashboard .table{padding-bottom:12px}#statify_dashboard .table p.sub{color:#bbb;margin:0 0 -4px}#statify_dashboard .table div{overflow:hidden}#statify_dashboard .table.referrer{float:left;width:45%}#statify_dashboard .table.target{float:right;width:55%}#statify_dashboard .table.total{clear:both;float:left;width:45%}#statify_dashboard td{padding:8px 0 0;line-height:1.4}#statify_dashboard td.b{text-align:right;padding-right:4px;color:#777}#statify_dashboard label{display:block;margin-bottom:1.1em!important}#statify_dashboard form{padding:18px 0}#statify_dashboard input[type="number"]{width:100px}#statify_dashboard .meta-links{float:right;margin:0;line-height:28px}
inc/class-statify-backend.php CHANGED
@@ -40,7 +40,7 @@ class Statify_Backend {
40
  $input,
41
  array(
42
  '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Donate', 'statify' ) . '</a>',
43
- '<a href="https://wordpress.org/support/plugin/statify" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Support', 'statify' ) . '</a>',
44
  )
45
  );
46
  }
@@ -58,7 +58,7 @@ class Statify_Backend {
58
  public static function add_action_link( $input ) {
59
 
60
  // Rights?
61
- if ( ! current_user_can( 'edit_dashboard' ) ) {
62
  return $input;
63
  }
64
 
@@ -70,8 +70,8 @@ class Statify_Backend {
70
  /* @lang Disable language injection for Url query argument. */
71
  '<a href="%s">%s</a>',
72
  add_query_arg(
73
- array( 'edit' => 'statify_dashboard#statify_dashboard' ),
74
- admin_url( '/' )
75
  ),
76
  esc_html__( 'Settings', 'statify' )
77
  ),
40
  $input,
41
  array(
42
  '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Donate', 'statify' ) . '</a>',
43
+ '<a href="' . esc_url( __( 'https://wordpress.org/support/plugin/statify', 'statify' ) ) . '" target="_blank" rel="noopener noreferrer">' . esc_html__( 'Support', 'statify' ) . '</a>',
44
  )
45
  );
46
  }
58
  public static function add_action_link( $input ) {
59
 
60
  // Rights?
61
+ if ( ! current_user_can( 'manage_options' ) ) {
62
  return $input;
63
  }
64
 
70
  /* @lang Disable language injection for Url query argument. */
71
  '<a href="%s">%s</a>',
72
  add_query_arg(
73
+ array( 'page' => 'statify-settings' ),
74
+ admin_url( '/options-general.php' )
75
  ),
76
  esc_html__( 'Settings', 'statify' )
77
  ),
inc/class-statify-cron.php CHANGED
@@ -32,7 +32,8 @@ class Statify_Cron extends Statify {
32
  // Remove items.
33
  $wpdb->query(
34
  $wpdb->prepare(
35
- "DELETE FROM `$wpdb->statify` WHERE created <= SUBDATE(CURDATE(), %d)",
 
36
  (int) self::$_options['days']
37
  )
38
  );
32
  // Remove items.
33
  $wpdb->query(
34
  $wpdb->prepare(
35
+ "DELETE FROM `$wpdb->statify` WHERE created <= SUBDATE(%s, %d)",
36
+ current_time( 'Y-m-d' ),
37
  (int) self::$_options['days']
38
  )
39
  );
inc/class-statify-dashboard.php CHANGED
@@ -42,6 +42,9 @@ class Statify_Dashboard extends Statify {
42
  return;
43
  }
44
 
 
 
 
45
  // Load textdomain.
46
  load_plugin_textdomain(
47
  'statify',
@@ -57,7 +60,7 @@ class Statify_Dashboard extends Statify {
57
  'statify_dashboard',
58
  'Statify',
59
  array( __CLASS__, 'print_frontview' ),
60
- array( __CLASS__, 'print_backview' )
61
  );
62
 
63
  // Init CSS.
@@ -183,7 +186,7 @@ class Statify_Dashboard extends Statify {
183
  if ( ! empty( $_POST['statify'] ) ) {
184
  check_admin_referer( 'statify-dashboard' );
185
 
186
- self::_save_options();
187
  }
188
 
189
  // Load view.
@@ -194,36 +197,45 @@ class Statify_Dashboard extends Statify {
194
 
195
 
196
  /**
197
- * Save plugin options
198
  *
199
  * @since 1.4.0
200
- * @version 2017-01-10
 
 
201
  */
202
- private static function _save_options() {
203
  // Check the nonce field from the dashboard form.
204
  if ( ! check_admin_referer( 'statify-dashboard' ) ) {
205
  return;
206
  }
207
 
208
- // Get numeric values from POST variables.
209
- $options = array();
210
- foreach ( array( 'days', 'limit' ) as $option_name ) {
 
 
211
  $options[ $option_name ] = Statify::$_options[ $option_name ];
212
  if ( isset( $_POST['statify'][ $option_name ] ) && (int) $_POST['statify'][ $option_name ] > 0 ) {
213
  $options[ $option_name ] = (int) $_POST['statify'][ $option_name ];
214
  }
215
  }
216
- if ( (int) $options['limit'] > 100 ) {
217
  $options['limit'] = 100;
218
  }
219
 
220
- // Get checkbox values from POST variables.
221
- foreach ( array( 'today', 'snippet', 'blacklist' ) as $option_name ) {
222
- if ( isset( $_POST['statify'][ $option_name ] ) && 1 === (int) $_POST['statify'][ $option_name ] ) {
223
- $options[ $option_name ] = 1;
224
- } else {
225
- $options[ $option_name ] = 0;
226
- }
 
 
 
 
 
227
  }
228
 
229
  // Update values.
@@ -305,32 +317,75 @@ class Statify_Dashboard extends Statify {
305
  global $wpdb;
306
 
307
  // Init values.
308
- $days = (int) self::$_options['days'];
309
- $limit = (int) self::$_options['limit'];
310
- $today = (int) self::$_options['today'];
 
311
 
312
- return array(
 
 
313
  'visits' => $wpdb->get_results(
314
  $wpdb->prepare(
315
  "SELECT `created` as `date`, COUNT(`created`) as `count` FROM `$wpdb->statify` GROUP BY `created` ORDER BY `created` DESC LIMIT %d",
316
- $days
317
  ),
318
  ARRAY_A
319
  ),
320
- 'target' => $wpdb->get_results(
 
 
 
321
  $wpdb->prepare(
322
- "SELECT COUNT(`target`) as `count`, `target` as `url` FROM `$wpdb->statify` " . ( $today ? 'WHERE created = DATE(NOW())' : '' ) . ' GROUP BY `target` ORDER BY `count` DESC LIMIT %d',
 
323
  $limit
324
  ),
325
  ARRAY_A
326
- ),
327
- 'referrer' => $wpdb->get_results(
328
  $wpdb->prepare(
329
- "SELECT COUNT(`referrer`) as `count`, `referrer` as `url`, SUBSTRING_INDEX(SUBSTRING_INDEX(TRIM(LEADING 'www.' FROM(TRIM(LEADING 'https://' FROM TRIM(LEADING 'http://' FROM TRIM(`referrer`))))), '/', 1), ':', 1) as `host` FROM `$wpdb->statify` WHERE `referrer` != '' " . ( $today ? 'AND created = DATE(NOW())' : '' ) . ' GROUP BY `host` ORDER BY `count` DESC LIMIT %d',
 
330
  $limit
331
  ),
332
  ARRAY_A
333
- ),
334
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  }
336
  }
42
  return;
43
  }
44
 
45
+ // Check if user can edit the widget.
46
+ $can_edit = apply_filters( 'statify__user_can_see_stats', current_user_can( 'edit_dashboard' ) );
47
+
48
  // Load textdomain.
49
  load_plugin_textdomain(
50
  'statify',
60
  'statify_dashboard',
61
  'Statify',
62
  array( __CLASS__, 'print_frontview' ),
63
+ $can_edit ? array( __CLASS__, 'print_backview' ) : null
64
  );
65
 
66
  // Init CSS.
186
  if ( ! empty( $_POST['statify'] ) ) {
187
  check_admin_referer( 'statify-dashboard' );
188
 
189
+ self::_save_widget_options();
190
  }
191
 
192
  // Load view.
197
 
198
 
199
  /**
200
+ * Save dashboard widget options.
201
  *
202
  * @since 1.4.0
203
+ * @sicnce 1.7.0 Renamed to _save_widget_options()
204
+ *
205
+ * @return void
206
  */
207
+ private static function _save_widget_options() {
208
  // Check the nonce field from the dashboard form.
209
  if ( ! check_admin_referer( 'statify-dashboard' ) ) {
210
  return;
211
  }
212
 
213
+ // We only do a partial update, so initialize with current values.
214
+ $options = Statify::$_options;
215
+
216
+ // Parse numeric values.
217
+ foreach ( array( 'days', 'days_show', 'limit' ) as $option_name ) {
218
  $options[ $option_name ] = Statify::$_options[ $option_name ];
219
  if ( isset( $_POST['statify'][ $option_name ] ) && (int) $_POST['statify'][ $option_name ] > 0 ) {
220
  $options[ $option_name ] = (int) $_POST['statify'][ $option_name ];
221
  }
222
  }
223
+ if ( $options['limit'] > 100 ) {
224
  $options['limit'] = 100;
225
  }
226
 
227
+ // Parse "today" checkbox.
228
+ if ( isset( $_POST['statify']['today'] ) && 1 === (int) $_POST['statify']['today'] ) {
229
+ $options['today'] = 1;
230
+ } else {
231
+ $options['today'] = 0;
232
+ }
233
+
234
+ // Parse "show totals" checkbox.
235
+ if ( isset( $_POST['statify']['show_totals'] ) && 1 === (int) $_POST['statify']['show_totals'] ) {
236
+ $options['show_totals'] = 1;
237
+ } else {
238
+ $options['show_totals'] = 0;
239
  }
240
 
241
  // Update values.
317
  global $wpdb;
318
 
319
  // Init values.
320
+ $days_show = (int) self::$_options['days_show'];
321
+ $limit = (int) self::$_options['limit'];
322
+ $today = (int) self::$_options['today'];
323
+ $show_totals = (int) self::$_options['show_totals'];
324
 
325
+ $current_date = current_time( 'Y-m-d' );
326
+
327
+ $data = array(
328
  'visits' => $wpdb->get_results(
329
  $wpdb->prepare(
330
  "SELECT `created` as `date`, COUNT(`created`) as `count` FROM `$wpdb->statify` GROUP BY `created` ORDER BY `created` DESC LIMIT %d",
331
+ $days_show
332
  ),
333
  ARRAY_A
334
  ),
335
+ );
336
+
337
+ if ( $today ) {
338
+ $data['target'] = $wpdb->get_results(
339
  $wpdb->prepare(
340
+ "SELECT COUNT(`target`) as `count`, `target` as `url` FROM `$wpdb->statify` WHERE created = %s GROUP BY `target` ORDER BY `count` DESC LIMIT %d",
341
+ $current_date,
342
  $limit
343
  ),
344
  ARRAY_A
345
+ );
346
+ $data['referrer'] = $wpdb->get_results(
347
  $wpdb->prepare(
348
+ "SELECT COUNT(`referrer`) as `count`, `referrer` as `url`, SUBSTRING_INDEX(SUBSTRING_INDEX(TRIM(LEADING 'www.' FROM(TRIM(LEADING 'https://' FROM TRIM(LEADING 'http://' FROM TRIM(`referrer`))))), '/', 1), ':', 1) as `host` FROM `$wpdb->statify` WHERE `referrer` != '' AND created = %s GROUP BY `host` ORDER BY `count` DESC LIMIT %d",
349
+ $current_date,
350
  $limit
351
  ),
352
  ARRAY_A
353
+ );
354
+ } else {
355
+ $data['target'] = $wpdb->get_results(
356
+ $wpdb->prepare(
357
+ "SELECT COUNT(`target`) as `count`, `target` as `url` FROM `$wpdb->statify` WHERE created >= DATE_SUB(%s, INTERVAL %d DAY) GROUP BY `target` ORDER BY `count` DESC LIMIT %d",
358
+ $current_date,
359
+ $days_show,
360
+ $limit
361
+ ),
362
+ ARRAY_A
363
+ );
364
+ $data['referrer'] = $wpdb->get_results(
365
+ $wpdb->prepare(
366
+ "SELECT COUNT(`referrer`) as `count`, `referrer` as `url`, SUBSTRING_INDEX(SUBSTRING_INDEX(TRIM(LEADING 'www.' FROM(TRIM(LEADING 'https://' FROM TRIM(LEADING 'http://' FROM TRIM(`referrer`))))), '/', 1), ':', 1) as `host` FROM `$wpdb->statify` WHERE `referrer` != '' AND created >= DATE_SUB(%s, INTERVAL %d DAY) GROUP BY `host` ORDER BY `count` DESC LIMIT %d",
367
+ $current_date,
368
+ $days_show,
369
+ $limit
370
+ ),
371
+ ARRAY_A
372
+ );
373
+ }
374
+
375
+ if ( $show_totals ) {
376
+ $data['visit_totals'] = array(
377
+ 'today' => $wpdb->get_var(
378
+ $wpdb->prepare(
379
+ "SELECT COUNT(`created`) FROM `$wpdb->statify` WHERE created = %s",
380
+ $current_date
381
+ )
382
+ ),
383
+ 'since_beginning' => $wpdb->get_var(
384
+ "SELECT COUNT(`created`) FROM `$wpdb->statify`"
385
+ ),
386
+ );
387
+ }
388
+
389
+ return $data;
390
  }
391
  }
inc/class-statify-frontend.php CHANGED
@@ -22,42 +22,47 @@ class Statify_Frontend extends Statify {
22
  * Track the page view
23
  *
24
  * @since 0.1.0
25
- * @version 1.4.2
 
26
  *
27
- * @return bool
 
 
28
  */
29
- public static function track_visit() {
30
 
31
- /* Init vars */
32
  $use_snippet = self::$_options['snippet'];
33
- $is_snippet = $use_snippet && get_query_var( 'statify_target' );
34
 
35
- /* Set target & referrer */
36
- if ( $is_snippet ) {
37
- $target = urldecode( get_query_var( 'statify_target' ) );
38
- $referrer = urldecode( get_query_var( 'statify_referrer' ) );
 
 
 
 
 
 
39
  } elseif ( ! $use_snippet ) {
40
- $target = filter_var(
41
- ( isset( $_SERVER['REQUEST_URI'] ) ? wp_unslash( $_SERVER['REQUEST_URI'] ) : '/' ),
42
- FILTER_SANITIZE_URL
43
- );
44
- if ( is_null( $target ) || false === $target ) {
45
- $target = '/';
46
- } else {
47
- $target = wp_unslash( $target );
48
  }
49
-
50
- $referrer = filter_var(
51
- ( isset( $_SERVER['HTTP_REFERER'] ) ? wp_unslash( $_SERVER['HTTP_REFERER'] ) : '' ),
52
- FILTER_SANITIZE_URL
53
- );
54
- if ( is_null( $referrer ) || false === $referrer ) {
55
- $referrer = '';
56
  }
57
  } else {
58
  return false;
59
  }
60
 
 
 
 
 
 
 
 
 
61
  /* Invalid target? */
62
  if ( empty( $target ) || ! wp_validate_redirect( $target, false ) ) {
63
  return self::_jump_out( $is_snippet );
@@ -116,6 +121,20 @@ class Statify_Frontend extends Statify {
116
  return self::_jump_out( $is_snippet );
117
  }
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  /**
120
  * Find the position of the first occurrence of a substring in a string about a array.
121
  *
@@ -165,14 +184,58 @@ class Statify_Frontend extends Statify {
165
  );
166
  if ( is_null( $user_agent )
167
  || false === $user_agent
168
- || ! preg_match( '/(?:Windows|Macintosh|Linux|iPhone|iPad)/', $user_agent ) ) {
169
  return true;
170
  }
171
 
172
- // Skip tracking via Referrer check and Conditional_Tags.
173
- return ( self::check_referrer() || is_trackback() || is_robots() || is_user_logged_in()
174
- || self::_is_internal()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  );
 
 
 
 
 
 
 
 
176
  }
177
 
178
  /**
@@ -183,7 +246,9 @@ class Statify_Frontend extends Statify {
183
  * @return boolean $skip_hook TRUE if NO tracking is desired
184
  */
185
  private static function _is_internal() {
186
- return is_feed() || is_preview() || is_404() || is_search();
 
 
187
  }
188
 
189
  /**
@@ -298,24 +363,78 @@ class Statify_Frontend extends Statify {
298
  */
299
  public static function wp_footer() {
300
 
301
- /* Skip by option */
302
  if ( ! self::$_options['snippet'] ) {
303
  return;
304
  }
305
 
306
- /* Skip by internal rules (#84) */
307
  if ( self::_is_internal() ) {
308
  return;
309
  }
310
 
311
- /* Load template */
312
- load_template(
313
- wp_normalize_path(
314
- sprintf(
315
- '%s/views/js-snippet.php',
316
- STATIFY_DIR
317
- )
 
 
 
 
 
 
 
 
318
  )
319
  );
320
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
321
  }
22
  * Track the page view
23
  *
24
  * @since 0.1.0
25
+ * @since 1.7.0 $is_snippet parameter added.
26
+ * @version 1.7.0
27
  *
28
+ * @param boolean $is_snippet Is tracking triggered via JS (default: false).
29
+ *
30
+ * @return boolean
31
  */
32
+ public static function track_visit( $is_snippet = false ) {
33
 
34
+ // Check of JS snippet is configured.
35
  $use_snippet = self::$_options['snippet'];
 
36
 
37
+ // Set target & referrer.
38
+ $target = null;
39
+ $referrer = null;
40
+ if ( $use_snippet && $is_snippet ) {
41
+ if ( isset( $_REQUEST['statify_target'] ) ) {
42
+ $target = filter_var( wp_unslash( $_REQUEST['statify_target'] ), FILTER_SANITIZE_URL );
43
+ }
44
+ if ( isset( $_REQUEST['statify_referrer'] ) ) {
45
+ $referrer = filter_var( wp_unslash( $_REQUEST['statify_referrer'] ), FILTER_SANITIZE_URL );
46
+ }
47
  } elseif ( ! $use_snippet ) {
48
+ if ( isset( $_SERVER['REQUEST_URI'] ) ) {
49
+ $target = filter_var( wp_unslash( $_SERVER['REQUEST_URI'] ), FILTER_SANITIZE_URL );
 
 
 
 
 
 
50
  }
51
+ if ( isset( $_SERVER['HTTP_REFERER'] ) ) {
52
+ $referrer = filter_var( wp_unslash( $_SERVER['HTTP_REFERER'] ), FILTER_SANITIZE_URL );
 
 
 
 
 
53
  }
54
  } else {
55
  return false;
56
  }
57
 
58
+ // Fallbacks for uninitialized or omitted target and referrer values.
59
+ if ( is_null( $target ) || false === $target ) {
60
+ $target = '/';
61
+ }
62
+ if ( is_null( $referrer ) || false === $referrer ) {
63
+ $referrer = '';
64
+ }
65
+
66
  /* Invalid target? */
67
  if ( empty( $target ) || ! wp_validate_redirect( $target, false ) ) {
68
  return self::_jump_out( $is_snippet );
121
  return self::_jump_out( $is_snippet );
122
  }
123
 
124
+ /**
125
+ * Track the page view via AJAX.
126
+ *
127
+ * @return void
128
+ */
129
+ public static function track_visit_ajax() {
130
+ // Check AJAX referrer.
131
+ check_ajax_referer( 'statify_track' );
132
+ // Only do something if snippet use is actually configured.
133
+ if ( self::$_options['snippet'] ) {
134
+ self::track_visit( true );
135
+ }
136
+ }
137
+
138
  /**
139
  * Find the position of the first occurrence of a substring in a string about a array.
140
  *
184
  );
185
  if ( is_null( $user_agent )
186
  || false === $user_agent
187
+ || self::is_bot( $user_agent ) ) {
188
  return true;
189
  }
190
 
191
+ // Skip tracking via Referrer check.
192
+ if ( self::check_referrer() ) {
193
+ return true;
194
+ }
195
+
196
+ // Skip for trackbacks and robots.
197
+ if ( is_trackback() || is_robots() ) {
198
+ return true;
199
+ }
200
+
201
+ // Skip logged in users, if enabled.
202
+ if ( self::$_options['skip']['logged_in'] && is_user_logged_in() ) {
203
+ return true;
204
+ }
205
+
206
+ // Skip for "internal" requests.
207
+ return self::_is_internal();
208
+ }
209
+
210
+ /**
211
+ * Checks if user agent is a bot.
212
+ *
213
+ * @since 1.7.0
214
+ *
215
+ * @param string $user_agent Server user agent string.
216
+ *
217
+ * @return boolean $is_bot TRUE if user agent is a bot, FALSE if not.
218
+ */
219
+ private static function is_bot( $user_agent ) {
220
+ $user_agent = strtolower( $user_agent );
221
+
222
+ $identifiers = array(
223
+ 'bot',
224
+ 'slurp',
225
+ 'crawler',
226
+ 'spider',
227
+ 'curl',
228
+ 'facebook',
229
+ 'fetch',
230
  );
231
+
232
+ foreach ( $identifiers as $identifier ) {
233
+ if ( strpos( $user_agent, $identifier ) !== false ) {
234
+ return true;
235
+ }
236
+ }
237
+
238
+ return false;
239
  }
240
 
241
  /**
246
  * @return boolean $skip_hook TRUE if NO tracking is desired
247
  */
248
  private static function _is_internal() {
249
+ // Skip for preview, 404 calls, feed, search and favicon access.
250
+ return is_preview() || is_404() || is_feed() || is_search()
251
+ || ( function_exists( 'is_favicon' ) && is_favicon() );
252
  }
253
 
254
  /**
363
  */
364
  public static function wp_footer() {
365
 
366
+ // Skip by option.
367
  if ( ! self::$_options['snippet'] ) {
368
  return;
369
  }
370
 
371
+ // Skip by internal rules (#84).
372
  if ( self::_is_internal() ) {
373
  return;
374
  }
375
 
376
+ wp_enqueue_script(
377
+ 'statify-js',
378
+ plugins_url( 'js/snippet.min.js', STATIFY_FILE ),
379
+ array(),
380
+ STATIFY_VERSION,
381
+ true
382
+ );
383
+
384
+ // Add endpoint to script.
385
+ wp_localize_script(
386
+ 'statify-js',
387
+ 'statify_ajax',
388
+ array(
389
+ 'url' => admin_url( 'admin-ajax.php' ),
390
+ 'nonce' => wp_create_nonce( 'statify_track' ),
391
  )
392
  );
393
  }
394
+
395
+ /**
396
+ * Add amp-analytics.
397
+ *
398
+ * @see https://amp-wp.org/documentation/playbooks/analytics/
399
+ *
400
+ * @param array $analytics Analytics.
401
+ */
402
+ public static function amp_post_template_analytics( $analytics ) {
403
+ if ( ! is_array( $analytics ) ) {
404
+ $analytics = array();
405
+ }
406
+
407
+ // Analytics script is only relevant, if "JS" tracking is enabled, to prevent double tracking.
408
+ if ( self::$_options['snippet'] ) {
409
+ $analytics['statify'] = array(
410
+ 'type' => '',
411
+ 'attributes' => array(),
412
+ 'config_data' => array(
413
+ 'extraUrlParams' => array(
414
+ 'action' => 'statify_track',
415
+ '_ajax_nonce' => wp_create_nonce( 'statify_track' ),
416
+ 'statify_referrer' => '${documentReferrer}',
417
+ 'statify_target' => '${canonicalPath}amp/',
418
+ ),
419
+ 'requests' => array(
420
+ 'event' => admin_url( 'admin-ajax.php' ),
421
+ ),
422
+ 'triggers' => array(
423
+ 'trackPageview' => array(
424
+ 'on' => 'visible',
425
+ 'request' => 'event',
426
+ 'vars' => array(
427
+ 'eventId' => 'pageview',
428
+ ),
429
+ ),
430
+ ),
431
+ 'transport' => array(
432
+ 'xhrpost' => true,
433
+ ),
434
+ ),
435
+ );
436
+ }
437
+
438
+ return $analytics;
439
+ }
440
  }
inc/class-statify-settings.php ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Statify: Statify_Settings class
4
+ *
5
+ * This file contains the plugin's settings capabilities.
6
+ *
7
+ * @package Statify
8
+ * @since 1.7
9
+ */
10
+
11
+ // Quit ic accessed directly..
12
+ defined( 'ABSPATH' ) || exit;
13
+
14
+ /**
15
+ * Class Statify_Settings
16
+ *
17
+ * @since 1.7
18
+ */
19
+ class Statify_Settings {
20
+
21
+ /**
22
+ * Registers all options using the WP Settings API.
23
+ *
24
+ * @return void
25
+ */
26
+ public static function register_settings() {
27
+ register_setting( 'statify', 'statify', array( __CLASS__, 'sanitize_options' ) );
28
+
29
+ // Global settings.
30
+ add_settings_section(
31
+ 'statify-global',
32
+ __( 'Global settings', 'statify' ),
33
+ null,
34
+ 'statify'
35
+ );
36
+ add_settings_field(
37
+ 'statify-days',
38
+ __( 'Period of data saving', 'statify' ),
39
+ array( __CLASS__, 'options_days' ),
40
+ 'statify',
41
+ 'statify-global',
42
+ array( 'label_for' => 'statify-days' )
43
+ );
44
+ add_settings_field(
45
+ 'statify-snippet',
46
+ __( 'Tracking via JavaScript', 'statify' ),
47
+ array( __CLASS__, 'options_snippet' ),
48
+ 'statify',
49
+ 'statify-global',
50
+ array( 'label_for' => 'statify-snippet' )
51
+ );
52
+
53
+ // Dashboard widget settings.
54
+ add_settings_section(
55
+ 'statify-dashboard',
56
+ __( 'Dashboard Widget', 'statify' ),
57
+ array( __CLASS__, 'header_dashboard' ),
58
+ 'statify'
59
+ );
60
+ add_settings_field(
61
+ 'statify-days_show',
62
+ __( 'Period of data display in Dashboard', 'statify' ),
63
+ array( __CLASS__, 'options_days_show' ),
64
+ 'statify',
65
+ 'statify-dashboard',
66
+ array( 'label_for' => 'statify-days-show' )
67
+ );
68
+ add_settings_field(
69
+ 'statify-limit',
70
+ __( 'Number of entries in top lists', 'statify' ),
71
+ array( __CLASS__, 'options_limit' ),
72
+ 'statify',
73
+ 'statify-dashboard',
74
+ array( 'label_for' => 'statify-limit' )
75
+ );
76
+ add_settings_field(
77
+ 'statify-today',
78
+ __( 'Top lists only for today', 'statify' ),
79
+ array( __CLASS__, 'options_today' ),
80
+ 'statify',
81
+ 'statify-dashboard',
82
+ array( 'label_for' => 'statify-today' )
83
+ );
84
+ add_settings_field(
85
+ 'statify-show-totals',
86
+ __( 'Show totals', 'statify' ),
87
+ array( __CLASS__, 'options_show_totals' ),
88
+ 'statify',
89
+ 'statify-dashboard',
90
+ array( 'label_for' => 'statify-show-totals' )
91
+ );
92
+
93
+ // Exclusion settings.
94
+ add_settings_section(
95
+ 'statify-skip',
96
+ __( 'Skip tracking for ...', 'statify' ),
97
+ array( __CLASS__, 'header_skip' ),
98
+ 'statify'
99
+ );
100
+ add_settings_field(
101
+ 'statify-skip-referrer',
102
+ __( 'Blacklisted referrers', 'statify' ),
103
+ array( __CLASS__, 'options_skip_blacklist' ),
104
+ 'statify',
105
+ 'statify-skip',
106
+ array( 'label_for' => 'statify-skip-referrer' )
107
+ );
108
+ add_settings_field(
109
+ 'statify-skip-logged_in',
110
+ __( 'Logged in users', 'statify' ),
111
+ array( __CLASS__, 'options_skip_logged_in' ),
112
+ 'statify',
113
+ 'statify-skip',
114
+ array( 'label_for' => 'statify-skip-logged_in' )
115
+ );
116
+ }
117
+
118
+ /**
119
+ * Option for data collection period.
120
+ *
121
+ * @return void
122
+ */
123
+ public static function options_days() {
124
+ ?>
125
+ <input id="statify-days" name="statify[days]" type="number" min="1" value="<?php echo esc_attr( Statify::$_options['days'] ); ?>">
126
+ <?php esc_html_e( 'days', 'statify' ); ?>
127
+ (<?php esc_html_e( 'Default', 'statify' ); ?>: 14)
128
+ <?php
129
+ }
130
+
131
+ /**
132
+ * Option for tracking via JS.
133
+ *
134
+ * @return void
135
+ */
136
+ public static function options_snippet() {
137
+ ?>
138
+ <input id="statify-snippet" type="checkbox" name="statify[snippet]" value="1" <?php checked( Statify::$_options['snippet'], 1 ); ?>>
139
+ (<?php esc_html_e( 'Default', 'statify' ); ?>: <?php esc_html_e( 'No', 'statify' ); ?>)
140
+ <br>
141
+ <p class="description"><?php esc_html_e( 'This option is strongly recommended if caching or AMP is in use.', 'statify' ); ?></p>
142
+ <?php
143
+ }
144
+
145
+ /**
146
+ * Section header for "Dashboard Widget" section.
147
+ *
148
+ * @return void
149
+ */
150
+ public static function header_dashboard() {
151
+ ?>
152
+ <p>
153
+ <?php esc_html_e( 'The following options affect the admin dashboard widget.', 'statify' ); ?>
154
+ </p>
155
+ <?php
156
+ }
157
+
158
+ /**
159
+ * Option for data display period.
160
+ *
161
+ * @return void
162
+ */
163
+ public static function options_days_show() {
164
+ ?>
165
+ <input id="statify-days-show" name="statify[days_show]" type="number" min="1" value="<?php echo esc_attr( Statify::$_options['days_show'] ); ?>">
166
+ <?php esc_html_e( 'days', 'statify' ); ?>
167
+ (<?php esc_html_e( 'Default', 'statify' ); ?>: 14)
168
+ <?php
169
+ }
170
+
171
+ /**
172
+ * Option for number of entries in top lists.
173
+ *
174
+ * @return void
175
+ */
176
+ public static function options_limit() {
177
+ ?>
178
+ <input id="statify-limit" name="statify[limit]" type="number" min="1" max="100" value="<?php echo esc_attr( Statify::$_options['limit'] ); ?>">
179
+ (<?php esc_html_e( 'Default', 'statify' ); ?>: 3)
180
+ <?php
181
+ }
182
+
183
+ /**
184
+ * Option for number of entries in top lists.
185
+ *
186
+ * @return void
187
+ */
188
+ public static function options_today() {
189
+ ?>
190
+ <input id="statify-today" type="checkbox" name="statify[today]" value="1" <?php checked( Statify::$_options['today'], 1 ); ?>>
191
+ (<?php esc_html_e( 'Default', 'statify' ); ?>: <?php esc_html_e( 'No', 'statify' ); ?>)
192
+ <?php
193
+ }
194
+
195
+ /**
196
+ * Option for showing visit totals.
197
+ *
198
+ * @return void
199
+ */
200
+ public static function options_show_totals() {
201
+ ?>
202
+ <input id="statify-show-totals" type="checkbox" name="statify[show_totals]" value="1" <?php checked( Statify::$_options['show_totals'], 1 ); ?>>
203
+ (<?php esc_html_e( 'Default', 'statify' ); ?>: <?php esc_html_e( 'No', 'statify' ); ?>)
204
+ <?php
205
+ }
206
+
207
+ /**
208
+ * Section header for "Skip tracking for..." section.
209
+ *
210
+ * @return void
211
+ */
212
+ public static function header_skip() {
213
+ ?>
214
+ <p>
215
+ <?php echo wp_kses( __( 'The following options define cases in which a view will <strong>not</strong> be tracked.', 'statify' ), array( 'strong' => array() ) ); ?>
216
+ </p>
217
+ <?php
218
+ }
219
+
220
+ /**
221
+ * Option to skip tracking for blacklisted referrers.
222
+ *
223
+ * @return void
224
+ */
225
+ public static function options_skip_blacklist() {
226
+ ?>
227
+ <input id="statify-skip-referrer" type="checkbox" name="statify[blacklist]" value="1"<?php checked( Statify::$_options['blacklist'] ); ?>>
228
+ (<?php esc_html_e( 'Default', 'statify' ); ?>: <?php esc_html_e( 'No', 'statify' ); ?>)
229
+ <br>
230
+ <p class="description"><?php esc_html_e( 'Enabling this option excludes any views with referrers listed in the comment blacklist', 'statify' ); ?>.</p>
231
+ <?php
232
+ }
233
+
234
+ /**
235
+ * Option to skip tracking for logged in uses.
236
+ *
237
+ * @return void
238
+ */
239
+ public static function options_skip_logged_in() {
240
+ ?>
241
+ <input id="statify-skip-logged_in" type="checkbox" name="statify[skip][logged_in]" value="1"<?php checked( Statify::$_options['skip']['logged_in'] ); ?>>
242
+ (<?php esc_html_e( 'Default', 'statify' ); ?>: <?php esc_html_e( 'Yes', 'statify' ); ?>)
243
+ <br>
244
+ <p class="description"><?php esc_html_e( 'Enabling this option excludes any views of logged-in users from tracking.', 'statify' ); ?></p>
245
+ <?php
246
+ }
247
+
248
+ /**
249
+ * Validate and sanitize submitted options.
250
+ *
251
+ * @param array $options Original options.
252
+ *
253
+ * @return array Validated and sanitized options.
254
+ */
255
+ public static function sanitize_options( $options ) {
256
+
257
+ // Sanitize numeric values.
258
+ $res = array();
259
+ foreach ( array( 'days', 'days_show', 'limit' ) as $o ) {
260
+ $res[ $o ] = Statify::$_options[ $o ];
261
+ if ( isset( $options[ $o ] ) && (int) $options[ $o ] > 0 ) {
262
+ $res[ $o ] = (int) $options[ $o ];
263
+ }
264
+ }
265
+ if ( $res['limit'] > 100 ) {
266
+ $res['limit'] = 100;
267
+ }
268
+
269
+ // Get checkbox values.
270
+ foreach ( array( 'today', 'snippet', 'blacklist', 'show_totals' ) as $o ) {
271
+ $res[ $o ] = isset( $options[ $o ] ) && 1 === (int) $options[ $o ] ? 1 : 0;
272
+ }
273
+ $res['skip']['logged_in'] = isset( $options['skip']['logged_in'] ) && 1 === (int) $options['skip']['logged_in'] ? 1 : 0;
274
+
275
+ return $res;
276
+ }
277
+
278
+ /**
279
+ * Creates a menu entry in the settings menu.
280
+ *
281
+ * @return void
282
+ */
283
+ public static function add_admin_menu() {
284
+ add_options_page(
285
+ __( 'Statify', 'statify' ),
286
+ __( 'Statify', 'statify' ),
287
+ 'manage_options',
288
+ 'statify-settings',
289
+ array( __CLASS__, 'create_settings_page' )
290
+ );
291
+ }
292
+
293
+ /**
294
+ * Creates the settings pages.
295
+ *
296
+ * @return void
297
+ */
298
+ public static function create_settings_page() {
299
+ ?>
300
+
301
+ <div class="wrap">
302
+ <h1><?php esc_html_e( 'Statify Settings', 'statify' ); ?></h1>
303
+
304
+ <form id="statify-settings" method="post" action="options.php">
305
+ <?php
306
+ settings_fields( 'statify' );
307
+ do_settings_sections( 'statify' );
308
+ submit_button();
309
+ ?>
310
+ <p class="alignright">
311
+ <a href="<?php echo esc_url( __( 'https://wordpress.org/plugins/statify/', 'statify' ) ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Documentation', 'statify' ); ?></a>
312
+ &bull; <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Donate', 'statify' ); ?></a>
313
+ &bull; <a href="<?php echo esc_url( __( 'https://wordpress.org/support/plugin/statify', 'statify' ) ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Support', 'statify' ); ?></a>
314
+ </p>
315
+
316
+ </form>
317
+ </div>
318
+
319
+ <?php
320
+ }
321
+
322
+ }
inc/class-statify-table.php CHANGED
@@ -56,7 +56,7 @@ class Statify_Table {
56
  }
57
 
58
  // Include.
59
- require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
60
 
61
  // Create.
62
  dbDelta(
56
  }
57
 
58
  // Include.
59
+ require_once ABSPATH . 'wp-admin/includes/upgrade.php';
60
 
61
  // Create.
62
  dbDelta(
inc/class-statify-uninstall.php CHANGED
@@ -26,7 +26,7 @@ class Statify_Uninstall {
26
  */
27
  public static function init() {
28
  if ( is_multisite() ) {
29
- $old = get_current_blog_id();
30
  $sites = get_sites();
31
 
32
  foreach ( $sites as $site ) {
26
  */
27
  public static function init() {
28
  if ( is_multisite() ) {
29
+ $old = get_current_blog_id();
30
  $sites = get_sites();
31
 
32
  foreach ( $sites as $site ) {
inc/class-statify.php CHANGED
@@ -26,26 +26,34 @@ class Statify {
26
  */
27
  public static $_options;
28
 
 
 
 
 
 
 
 
 
 
29
 
30
  /**
31
  * Class self initialize.
32
  *
33
- * @since 0.1.0
34
- * @version 0.1.0
35
  */
36
  public static function instance() {
37
- new self();
38
  }
39
 
40
  /**
41
- * Class constructor
42
  *
43
- * @since 0.1.0
44
- * @version 2017-01-10
45
  */
46
- public function __construct() {
47
- // Skip me!
48
- if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
49
  return;
50
  }
51
 
@@ -56,15 +64,25 @@ class Statify {
56
  self::$_options = wp_parse_args(
57
  get_option( 'statify' ),
58
  array(
59
- 'days' => 14,
60
- 'limit' => 3,
61
- 'today' => 0,
62
- 'snippet' => 0,
63
- 'blacklist' => 0,
 
 
 
 
 
64
  )
65
  );
66
 
67
- if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { // XMLRPC.
 
 
 
 
 
68
  add_filter( 'xmlrpc_methods', array( 'Statify_XMLRPC', 'xmlrpc_methods' ) );
69
  } elseif ( defined( 'DOING_CRON' ) && DOING_CRON ) { // Cron.
70
  add_action( 'statify_cleanup', array( 'Statify_Cron', 'cleanup_data' ) );
@@ -74,10 +92,15 @@ class Statify {
74
  add_action( 'wp_dashboard_setup', array( 'Statify_Dashboard', 'init' ) );
75
  add_filter( 'plugin_row_meta', array( 'Statify_Backend', 'add_meta_link' ), 10, 2 );
76
  add_filter( 'plugin_action_links_' . STATIFY_BASE, array( 'Statify_Backend', 'add_action_link' ) );
 
 
77
  } else { // Frontend.
78
  add_action( 'template_redirect', array( 'Statify_Frontend', 'track_visit' ) );
79
  add_filter( 'query_vars', array( 'Statify_Frontend', 'query_vars' ) );
80
  add_action( 'wp_footer', array( 'Statify_Frontend', 'wp_footer' ) );
 
 
 
81
  }
82
  }
83
  }
26
  */
27
  public static $_options;
28
 
29
+ /**
30
+ * Class constructor
31
+ *
32
+ * @since 0.1.0
33
+ * @deprecated As of 1.7 use static method init() to initialize the plugin.
34
+ */
35
+ public function __construct() {
36
+ self::init();
37
+ }
38
 
39
  /**
40
  * Class self initialize.
41
  *
42
+ * @since 0.1.0
43
+ * @deprecated As of 1.7 use init() to initialize the plugin.
44
  */
45
  public static function instance() {
46
+ self::init();
47
  }
48
 
49
  /**
50
+ * Plugin initialization.
51
  *
52
+ * @since 1.7 Replaces previously used instance() and __construct().
 
53
  */
54
+ public static function init() {
55
+ // Nothing to do on autosave.
56
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
57
  return;
58
  }
59
 
64
  self::$_options = wp_parse_args(
65
  get_option( 'statify' ),
66
  array(
67
+ 'days' => 14,
68
+ 'days_show' => 14,
69
+ 'limit' => 3,
70
+ 'today' => 0,
71
+ 'snippet' => 0,
72
+ 'blacklist' => 0,
73
+ 'show_totals' => 0,
74
+ 'skip' => array(
75
+ 'logged_in' => 1,
76
+ ),
77
  )
78
  );
79
 
80
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
81
+ add_action( 'wp_ajax_nopriv_statify_track', array( 'Statify_Frontend', 'track_visit_ajax' ) );
82
+ if ( 0 === self::$_options['skip']['logged_in'] ) {
83
+ add_action( 'wp_ajax_statify_track', array( 'Statify_Frontend', 'track_visit_ajax' ) );
84
+ }
85
+ } elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) { // XMLRPC.
86
  add_filter( 'xmlrpc_methods', array( 'Statify_XMLRPC', 'xmlrpc_methods' ) );
87
  } elseif ( defined( 'DOING_CRON' ) && DOING_CRON ) { // Cron.
88
  add_action( 'statify_cleanup', array( 'Statify_Cron', 'cleanup_data' ) );
92
  add_action( 'wp_dashboard_setup', array( 'Statify_Dashboard', 'init' ) );
93
  add_filter( 'plugin_row_meta', array( 'Statify_Backend', 'add_meta_link' ), 10, 2 );
94
  add_filter( 'plugin_action_links_' . STATIFY_BASE, array( 'Statify_Backend', 'add_action_link' ) );
95
+ add_action( 'admin_init', array( 'Statify_Settings', 'register_settings' ) );
96
+ add_action( 'admin_menu', array( 'Statify_Settings', 'add_admin_menu' ) );
97
  } else { // Frontend.
98
  add_action( 'template_redirect', array( 'Statify_Frontend', 'track_visit' ) );
99
  add_filter( 'query_vars', array( 'Statify_Frontend', 'query_vars' ) );
100
  add_action( 'wp_footer', array( 'Statify_Frontend', 'wp_footer' ) );
101
+ if ( function_exists( 'is_amp_endpoint' ) ) { // Automattic AMP plugin present.
102
+ add_filter( 'amp_post_template_analytics', array( 'Statify_Frontend', 'amp_post_template_analytics' ) );
103
+ }
104
  }
105
  }
106
  }
js/chartist-plugin-tooltip.min.js CHANGED
@@ -1,8 +1,8 @@
1
- /* chartist-plugin-tooltip 0.0.17
2
- * Copyright © 2017 Markus Padourek
3
  * Free to use under the WTFPL license.
4
  * http://www.wtfpl.net/
5
  */
6
 
7
- !function(a,b){"function"==typeof define&&define.amd?define(["chartist"],function(c){return a.returnExportsGlobal=b(c)}):"object"==typeof exports?module.exports=b(require("chartist")):a["Chartist.plugins.tooltip"]=b(Chartist)}(this,function(a){return function(a,b,c){"use strict";function d(a){f(a,"tooltip-show")||(a.className=a.className+" tooltip-show")}function e(a){var b=new RegExp("tooltip-show\\s*","gi");a.className=a.className.replace(b,"").trim()}function f(a,b){return(" "+a.getAttribute("class")+" ").indexOf(" "+b+" ")>-1}function g(a,b){do{a=a.nextSibling}while(a&&!f(a,b));return a}function h(a){return a.innerText||a.textContent}var i={currency:void 0,currencyFormatCallback:void 0,tooltipOffset:{x:0,y:-20},anchorToPoint:!1,appendToBody:!1,class:void 0,pointClass:"ct-point"};c.plugins=c.plugins||{},c.plugins.tooltip=function(j){return j=c.extend({},i,j),function(i){function k(a,b,c){n.addEventListener(a,function(a){b&&!f(a.target,b)||c(a)})}function l(b){p=p||o.offsetHeight,q=q||o.offsetWidth;var c,d,e=-q/2+j.tooltipOffset.x,f=-p+j.tooltipOffset.y;if(j.appendToBody)o.style.top=b.pageY+f+"px",o.style.left=b.pageX+e+"px";else{var g=n.getBoundingClientRect(),h=b.pageX-g.left-a.pageXOffset,i=b.pageY-g.top-a.pageYOffset;!0===j.anchorToPoint&&b.target.x2&&b.target.y2&&(c=parseInt(b.target.x2.baseVal.value),d=parseInt(b.target.y2.baseVal.value)),o.style.top=(d||i)+f+"px",o.style.left=(c||h)+e+"px"}}var m=j.pointClass;i instanceof c.Bar?m="ct-bar":i instanceof c.Pie&&(m=i.options.donut?"ct-slice-donut":"ct-slice-pie");var n=i.container,o=n.querySelector(".chartist-tooltip");o||(o=b.createElement("div"),o.className=j.class?"chartist-tooltip "+j.class:"chartist-tooltip",j.appendToBody?b.body.appendChild(o):n.appendChild(o));var p=o.offsetHeight,q=o.offsetWidth;e(o),k("mouseover",m,function(a){var e=a.target,f="",k=i instanceof c.Pie?e:e.parentNode,m=k?e.parentNode.getAttribute("ct:meta")||e.parentNode.getAttribute("ct:series-name"):"",n=e.getAttribute("ct:meta")||m||"",r=!!n,s=e.getAttribute("ct:value");if(j.transformTooltipTextFnc&&"function"==typeof j.transformTooltipTextFnc&&(s=j.transformTooltipTextFnc(s)),j.tooltipFnc&&"function"==typeof j.tooltipFnc)f=j.tooltipFnc(n,s);else{if(j.metaIsHTML){var t=b.createElement("textarea");t.innerHTML=n,n=t.value}if(n='<span class="chartist-tooltip-meta">'+n+"</span>",r)f+=n+"<br>";else if(i instanceof c.Pie){var u=g(e,"ct-label");u&&(f+=h(u)+"<br>")}s&&(j.currency&&(s=void 0!=j.currencyFormatCallback?j.currencyFormatCallback(s,j):j.currency+s.replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g,"$1,")),s='<span class="chartist-tooltip-value">'+s+"</span>",f+=s)}f&&(o.innerHTML=f,l(a),d(o),p=o.offsetHeight,q=o.offsetWidth)}),k("mouseout",m,function(){e(o)}),k("mousemove",null,function(a){!1===j.anchorToPoint&&l(a)})}}}(window,document,a),a.plugins.tooltip});
8
  //# sourceMappingURL=chartist-plugin-tooltip.min.js.map
1
+ /* chartist-plugin-tooltip 0.1.2
2
+ * Copyright © 2019 Markus Padourek
3
  * Free to use under the WTFPL license.
4
  * http://www.wtfpl.net/
5
  */
6
 
7
+ !function(e,o){void 0===e&&void 0!==window&&(e=window),"function"==typeof define&&define.amd?define(["chartist"],function(t){return e["Chartist.plugins.tooltip"]=o(t)}):"object"==typeof module&&module.exports?module.exports=o(require("chartist")):e["Chartist.plugins.tooltip"]=o(e.Chartist)}(this,function(t){return function(v,x,b){"use strict";var t={currency:void 0,currencyFormatCallback:void 0,tooltipOffset:{x:0,y:-20},anchorToPoint:!1,appendToBody:!0,class:void 0,pointClass:"ct-point"};function T(t,e){return-1<(" "+t.getAttribute("class")+" ").indexOf(" "+e+" ")}function C(t){var e;return C in t?e=(e=t.offsetParent)||x.body.parentElement:(e=t.parentNode)?"static"!==v.getComputedStyle(e).position?e:"BODY"===e.tagName?e.parentElement:C(e):x.body.parentElement}b.plugins=b.plugins||{},b.plugins.tooltip=function(h){return h=b.extend({},t,h),function(c){var t=h.pointClass;c instanceof b.Bar?t="ct-bar":c instanceof b.Pie&&(t=c.options.donut?c.options.donutSolid?"ct-slice-donut-solid":"ct-slice-donut":"ct-slice-pie");var p,f=c.container,u=!1,d=C(f);(p=h.appendToBody?x.querySelector(".chartist-tooltip"):f.querySelector(".chartist-tooltip"))||((p=x.createElement("div")).className=h.class?"chartist-tooltip "+h.class:"chartist-tooltip",h.appendToBody?x.body.appendChild(p):f.appendChild(p));var g=p.offsetHeight,y=p.offsetWidth;function e(t,e,o){f.addEventListener(t,function(t){e&&!T(t.target,e)||o(t)})}function m(t){g=g||p.offsetHeight;var e=-(y=y||p.offsetWidth)/2+h.tooltipOffset.x,o=-g+h.tooltipOffset.y,n=!0===h.anchorToPoint&&t.target.x2&&t.target.y2;if(!0===h.appendToBody)if(n){var i=f.getBoundingClientRect(),a=t.target.x2.baseVal.value+i.left+v.pageXOffset,s=t.target.y2.baseVal.value+i.top+v.pageYOffset;p.style.left=a+e+"px",p.style.top=s+o+"px"}else p.style.left=t.pageX+e+"px",p.style.top=t.pageY+o+"px";else{var l=d.getBoundingClientRect(),r=-l.left-v.scrollX+e,c=-l.top-v.scrollY+o;if(n){i=f.getBoundingClientRect(),a=t.target.x2.baseVal.value+i.left+v.pageXOffset,s=t.target.y2.baseVal.value+i.top+v.pageYOffset;p.style.left=a+r+"px",p.style.top=s+c+"px"}else p.style.left=t.pageX+r+"px",p.style.top=t.pageY+c+"px"}}function o(t){u=!1;var e=new RegExp("tooltip-show\\s*","gi");t.className=t.className.replace(e,"").trim()}o(p),e("mouseover",t,function(t){var e=t.target,o="",n=(c instanceof b.Pie?e:e.parentNode)?e.parentNode.getAttribute("ct:meta")||e.parentNode.getAttribute("ct:series-name"):"",i=e.getAttribute("ct:meta")||n||"",a=!!i,s=e.getAttribute("ct:value");if(h.transformTooltipTextFnc&&"function"==typeof h.transformTooltipTextFnc&&(s=h.transformTooltipTextFnc(s)),h.tooltipFnc&&"function"==typeof h.tooltipFnc)o=h.tooltipFnc(i,s);else{if(h.metaIsHTML){var l=x.createElement("textarea");l.innerHTML=i,i=l.value}if(i='<span class="chartist-tooltip-meta">'+i+"</span>",a)o+=i+"<br>";else if(c instanceof b.Pie){var r=function(t,e){for(;t=t.nextSibling,t&&!T(t,e););return t}(e,"ct-label");r&&(o+=function(t){return t.innerText||t.textContent}(r)+"<br>")}s&&(h.currency&&(s=null!=h.currencyFormatCallback?h.currencyFormatCallback(s,h):h.currency+s.replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g,"$1,")),o+=s='<span class="chartist-tooltip-value">'+s+"</span>")}o&&(p.innerHTML=o,g=p.offsetHeight,y=p.offsetWidth,!0!==h.appendToBody&&(d=C(f)),"absolute"!==p.style.display&&(p.style.display="absolute"),m(t),function(t){u=!0,T(t,"tooltip-show")||(t.className=t.className+" tooltip-show")}(p),g=p.offsetHeight,y=p.offsetWidth)}),e("mouseout",t,function(){o(p)}),e("mousemove",null,function(t){!1===h.anchorToPoint&&u&&m(t)})}}}(window,document,t),t.plugins.tooltip});
8
  //# sourceMappingURL=chartist-plugin-tooltip.min.js.map
js/chartist-plugin-tooltip.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["chartist-plugin-tooltip.js"],"names":["root","factory","define","amd","Chartist","returnExportsGlobal","exports","module","require","this","window","document","show","element","hasClass","className","hide","regex","RegExp","replace","trim","getAttribute","indexOf","next","nextSibling","text","innerText","textContent","defaultOptions","currency","undefined","currencyFormatCallback","tooltipOffset","x","y","anchorToPoint","appendToBody","class","pointClass","plugins","tooltip","options","extend","chart","on","event","selector","callback","$chart","addEventListener","e","target","setPosition","height","$toolTip","offsetHeight","width","offsetWidth","anchorX","anchorY","offsetX","offsetY","style","top","pageY","left","pageX","box","getBoundingClientRect","pageXOffset","pageYOffset","x2","y2","parseInt","baseVal","value","tooltipSelector","Bar","Pie","donut","container","querySelector","createElement","body","appendChild","$point","tooltipText","isPieChart","parentNode","seriesName","meta","hasMeta","transformTooltipTextFnc","tooltipFnc","metaIsHTML","txt","innerHTML","label"],"mappings":";;;;;;CAAC,SAAUA,EAAMC,GACO,kBAAXC,SAAyBA,OAAOC,IAEzCD,QAAQ,YAAa,SAAUE,GAC7B,MAAQJ,GAAKK,oBAAsBJ,EAAQG,KAEjB,gBAAZE,SAIhBC,OAAOD,QAAUL,EAAQO,QAAQ,aAEjCR,EAAK,4BAA8BC,EAAQG,WAE7CK,KAAM,SAAUL,GA6LhB,MAtLC,UAAUM,EAAQC,EAAUP,GAC3B,YAyJA,SAASQ,GAAKC,GACRC,EAASD,EAAS,kBACpBA,EAAQE,UAAYF,EAAQE,UAAY,iBAI5C,QAASC,GAAKH,GACZ,GAAII,GAAQ,GAAIC,QAAO,mBAAyB,KAChDL,GAAQE,UAAYF,EAAQE,UAAUI,QAAQF,EAAO,IAAIG,OAG3D,QAASN,GAASD,EAASE,GACzB,OAAQ,IAAMF,EAAQQ,aAAa,SAAW,KAAKC,QAAQ,IAAMP,EAAY,MAAQ,EAGvF,QAASQ,GAAKV,EAASE,GACrB,GACEF,EAAUA,EAAQW,kBACXX,IAAYC,EAASD,EAASE,GACvC,OAAOF,GAGT,QAASY,GAAKZ,GACZ,MAAOA,GAAQa,WAAab,EAAQc,YA9KtC,GAAIC,IACFC,aAAUC,GACVC,2BAAwBD,GACxBE,eACEC,EAAG,EACHC,GAAI,IAENC,eAAe,EACfC,cAAc,EACdC,U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GAGLD,EAASC,EAASC,aAClBC,EAAQF,EAASG,eAIrBb,EAAG,WAAYgC,EAAiB,WAC9B5D,EAAKsC,KAGPV,EAAG,YAAa,KAAM,SAAUC,IAC1B,IAAUJ,EAAQN,eACpBiB,EAAYP,QAwDnBnC,OAAQC,SAAUP,GAEdA,EAASmC,QAAQC","file":"chartist-plugin-tooltip.min.js","sourcesContent":["(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define([\"chartist\"], function (Chartist) {\n return (root.returnExportsGlobal = factory(Chartist));\n });\n } else if (typeof exports === 'object') {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like enviroments that support module.exports,\n // like Node.\n module.exports = factory(require(\"chartist\"));\n } else {\n root['Chartist.plugins.tooltip'] = factory(Chartist);\n }\n}(this, function (Chartist) {\n\n /**\r\n * Chartist.js plugin to display a data label on top of the points in a line chart.\r\n *\r\n */\r\n /* global Chartist */\r\n (function (window, document, Chartist) {\r\n 'use strict';\r\n\r\n var defaultOptions = {\r\n currency: undefined,\r\n currencyFormatCallback: undefined,\r\n tooltipOffset: {\r\n x: 0,\r\n y: -20\r\n },\r\n anchorToPoint: false,\r\n appendToBody: false,\r\n class: undefined,\r\n pointClass: 'ct-point'\r\n };\r\n\r\n Chartist.plugins = Chartist.plugins || {};\r\n Chartist.plugins.tooltip = function (options) {\r\n options = Chartist.extend({}, defaultOptions, options);\r\n\r\n return function tooltip(chart) {\r\n var tooltipSelector = options.pointClass;\r\n if (chart instanceof Chartist.Bar) {\r\n tooltipSelector = 'ct-bar';\r\n } else if (chart instanceof Chartist.Pie) {\r\n // Added support for donut graph\r\n if (chart.options.donut) {\r\n tooltipSelector = 'ct-slice-donut';\r\n } else {\r\n tooltipSelector = 'ct-slice-pie';\r\n }\r\n }\r\n\r\n var $chart = chart.container;\r\n var $toolTip = $chart.querySelector('.chartist-tooltip');\r\n if (!$toolTip) {\r\n $toolTip = document.createElement('div');\r\n $toolTip.className = (!options.class) ? 'chartist-tooltip' : 'chartist-tooltip ' + options.class;\r\n if (!options.appendToBody) {\r\n $chart.appendChild($toolTip);\r\n } else {\r\n document.body.appendChild($toolTip);\r\n }\r\n }\r\n var height = $toolTip.offsetHeight;\r\n var width = $toolTip.offsetWidth;\r\n\r\n hide($toolTip);\r\n\r\n function on(event, selector, callback) {\r\n $chart.addEventListener(event, function (e) {\r\n if (!selector || hasClass(e.target, selector))\r\n callback(e);\r\n });\r\n }\r\n\r\n on('mouseover', tooltipSelector, function (event) {\r\n var $point = event.target;\r\n var tooltipText = '';\r\n\r\n var isPieChart = (chart instanceof Chartist.Pie) ? $point : $point.parentNode;\r\n var seriesName = (isPieChart) ? $point.parentNode.getAttribute('ct:meta') || $point.parentNode.getAttribute('ct:series-name') : '';\r\n var meta = $point.getAttribute('ct:meta') || seriesName || '';\r\n var hasMeta = !!meta;\r\n var value = $point.getAttribute('ct:value');\r\n\r\n if (options.transformTooltipTextFnc && typeof options.transformTooltipTextFnc === 'function') {\r\n value = options.transformTooltipTextFnc(value);\r\n }\r\n\r\n if (options.tooltipFnc && typeof options.tooltipFnc === 'function') {\r\n tooltipText = options.tooltipFnc(meta, value);\r\n } else {\r\n if (options.metaIsHTML) {\r\n var txt = document.createElement('textarea');\r\n txt.innerHTML = meta;\r\n meta = txt.value;\r\n }\r\n\r\n meta = '<span class=\"chartist-tooltip-meta\">' + meta + '</span>';\r\n\r\n if (hasMeta) {\r\n tooltipText += meta + '<br>';\r\n } else {\r\n // For Pie Charts also take the labels into account\r\n // Could add support for more charts here as well!\r\n if (chart instanceof Chartist.Pie) {\r\n var label = next($point, 'ct-label');\r\n if (label) {\r\n tooltipText += text(label) + '<br>';\r\n }\r\n }\r\n }\r\n\r\n if (value) {\r\n if (options.currency) {\r\n if (options.currencyFormatCallback != undefined) {\r\n value = options.currencyFormatCallback(value, options);\r\n } else {\r\n value = options.currency + value.replace(/(\\d)(?=(\\d{3})+(?:\\.\\d+)?$)/g, '$1,');\r\n }\r\n }\r\n value = '<span class=\"chartist-tooltip-value\">' + value + '</span>';\r\n tooltipText += value;\r\n }\r\n }\r\n\r\n if(tooltipText) {\r\n $toolTip.innerHTML = tooltipText;\r\n setPosition(event);\r\n show($toolTip);\r\n\r\n // Remember height and width to avoid wrong position in IE\r\n height = $toolTip.offsetHeight;\r\n width = $toolTip.offsetWidth;\r\n }\r\n });\r\n\r\n on('mouseout', tooltipSelector, function () {\r\n hide($toolTip);\r\n });\r\n\r\n on('mousemove', null, function (event) {\r\n if (false === options.anchorToPoint)\r\n setPosition(event);\r\n });\r\n\r\n function setPosition(event) {\r\n height = height || $toolTip.offsetHeight;\r\n width = width || $toolTip.offsetWidth;\r\n var offsetX = - width / 2 + options.tooltipOffset.x\r\n var offsetY = - height + options.tooltipOffset.y;\r\n var anchorX, anchorY;\r\n\r\n if (!options.appendToBody) {\r\n var box = $chart.getBoundingClientRect();\r\n var left = event.pageX - box.left - window.pageXOffset ;\r\n var top = event.pageY - box.top - window.pageYOffset ;\r\n\r\n if (true === options.anchorToPoint && event.target.x2 && event.target.y2) {\r\n anchorX = parseInt(event.target.x2.baseVal.value);\r\n anchorY = parseInt(event.target.y2.baseVal.value);\r\n }\r\n\r\n $toolTip.style.top = (anchorY || top) + offsetY + 'px';\r\n $toolTip.style.left = (anchorX || left) + offsetX + 'px';\r\n } else {\r\n $toolTip.style.top = event.pageY + offsetY + 'px';\r\n $toolTip.style.left = event.pageX + offsetX + 'px';\r\n }\r\n }\r\n }\r\n };\r\n\r\n function show(element) {\r\n if(!hasClass(element, 'tooltip-show')) {\r\n element.className = element.className + ' tooltip-show';\r\n }\r\n }\r\n\r\n function hide(element) {\r\n var regex = new RegExp('tooltip-show' + '\\\\s*', 'gi');\r\n element.className = element.className.replace(regex, '').trim();\r\n }\r\n\r\n function hasClass(element, className) {\r\n return (' ' + element.getAttribute('class') + ' ').indexOf(' ' + className + ' ') > -1;\r\n }\r\n\r\n function next(element, className) {\r\n do {\r\n element = element.nextSibling;\r\n } while (element && !hasClass(element, className));\r\n return element;\r\n }\r\n\r\n function text(element) {\r\n return element.innerText || element.textContent;\r\n }\r\n\r\n } (window, document, Chartist));\r\n\n return Chartist.plugins.tooltip;\n\n}));\n"]}
1
+ {"version":3,"sources":["chartist-plugin-tooltip.js"],"names":["root","factory","undefined","window","define","amd","a0","module","exports","require","this","Chartist","document","defaultOptions","currency","currencyFormatCallback","tooltipOffset","x","y","anchorToPoint","appendToBody","class","pointClass","hasClass","element","className","getAttribute","indexOf","offsetParent","elem","parent","body","parentElement","parentNode","getComputedStyle","position","tagName","plugins","tooltip","options","extend","chart","tooltipSelector","Bar","Pie","donut","donutSolid","$toolTip","$chart","container","$toolTipIsShown","$tooltipOffsetParent","querySelector","createElement","appendChild","height","offsetHeight","width","offsetWidth","on","event","selector","callback","addEventListener","e","target","setPosition","offsetX","offsetY","anchor","x2","y2","box","getBoundingClientRect","left","baseVal","value","pageXOffset","top","pageYOffset","style","pageX","pageY","offsetBox","allOffsetLeft","scrollX","allOffsetTop","scrollY","hide","regex","RegExp","replace","trim","$point","tooltipText","seriesName","meta","hasMeta","transformTooltipTextFnc","tooltipFnc","metaIsHTML","txt","innerHTML","label","nextSibling","next","innerText","textContent","text","display","show"],"mappings":";;;;;;CAAC,SAAUA,EAAMC,QACFC,IAATF,QAAiCE,IAAXC,SAAsBH,EAAOG,QACjC,mBAAXC,QAAyBA,OAAOC,IAEzCD,OAAO,CAAC,YAAa,SAAUE,GAC7B,OAAQN,EAAK,4BAA8BC,EAAQK,KAE1B,iBAAXC,QAAuBA,OAAOC,QAI9CD,OAAOC,QAAUP,EAAQQ,QAAQ,aAEjCT,EAAK,4BAA8BC,EAAQD,EAAe,UAb9D,CAeEU,KAAM,SAAUC,GAuRlB,OAhRC,SAAUR,EAAQS,EAAUD,GAC3B,aAEA,IAAIE,EAAiB,CACnBC,cAAUZ,EACVa,4BAAwBb,EACxBc,cAAe,CACbC,EAAG,EACHC,GAAI,IAENC,eAAe,EACfC,cAAc,EACdC,WAAOn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ACV+B,EAAuBvB,EAAaoB,IAEP,aAA3BD,EAASiC,MAAM6B,UACjB9D,EAASiC,MAAM6B,QAAU,YAE3B3C,EAAYN,GA8DhB,SAAcpC,GACZ0B,GAAkB,EACb3B,EAASC,EAAS,kBACrBA,EAAQC,UAAYD,EAAQC,UAAY,iBAhExCqF,CAAK/D,GAGLQ,EAASR,EAASS,aAClBC,EAAQV,EAASW,eAIrBC,EAAG,WAAYjB,EAAiB,WAC9B8C,EAAKzC,KAGPY,EAAG,YAAa,KAAM,SAAUC,IACA,IAA1BrB,EAAQpB,eAA2B+B,GACrCgB,EAAYN,OAnJtB,CA8QEzD,OAAQS,SAAUD,GAEbA,EAAS0B,QAAQC","file":"chartist-plugin-tooltip.min.js"}
js/chartist.min.js CHANGED
@@ -1,10 +1,10 @@
1
- /* Chartist.js 0.11.0
2
- * Copyright © 2017 Gion Kunz
3
  * Free to use under either the WTFPL license or the MIT license.
4
  * https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-WTFPL
5
  * https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-MIT
6
  */
7
 
8
- !function(a,b){"function"==typeof define&&define.amd?define("Chartist",[],function(){return a.Chartist=b()}):"object"==typeof module&&module.exports?module.exports=b():a.Chartist=b()}(this,function(){var a={version:"0.11.0"};return function(a,b,c){"use strict";c.namespaces={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},c.noop=function(a){return a},c.alphaNumerate=function(a){return String.fromCharCode(97+a%26)},c.extend=function(a){var b,d,e;for(a=a||{},b=1;b<arguments.length;b++){d=arguments[b];for(var f in d)e=d[f],"object"!=typeof e||null===e||e instanceof Array?a[f]=e:a[f]=c.extend(a[f],e)}return a},c.replaceAll=function(a,b,c){return a.replace(new RegExp(b,"g"),c)},c.ensureUnit=function(a,b){return"number"==typeof a&&(a+=b),a},c.quantity=function(a){if("string"==typeof a){var b=/^(\d+)\s*(.*)$/g.exec(a);return{value:+b[1],unit:b[2]||void 0}}return{value:a}},c.querySelector=function(a){return a instanceof Node?a:b.querySelector(a)},c.times=function(a){return Array.apply(null,new Array(a))},c.sum=function(a,b){return a+(b?b:0)},c.mapMultiply=function(a){return function(b){return b*a}},c.mapAdd=function(a){return function(b){return b+a}},c.serialMap=function(a,b){var d=[],e=Math.max.apply(null,a.map(function(a){return a.length}));return c.times(e).forEach(function(c,e){var f=a.map(function(a){return a[e]});d[e]=b.apply(null,f)}),d},c.roundWithPrecision=function(a,b){var d=Math.pow(10,b||c.precision);return Math.round(a*d)/d},c.precision=8,c.escapingMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"},c.serialize=function(a){return null===a||void 0===a?a:("number"==typeof a?a=""+a:"object"==typeof a&&(a=JSON.stringify({data:a})),Object.keys(c.escapingMap).reduce(function(a,b){return c.replaceAll(a,b,c.escapingMap[b])},a))},c.deserialize=function(a){if("string"!=typeof a)return a;a=Object.keys(c.escapingMap).reduce(function(a,b){return c.replaceAll(a,c.escapingMap[b],b)},a);try{a=JSON.parse(a),a=void 0!==a.data?a.data:a}catch(b){}return a},c.createSvg=function(a,b,d,e){var f;return b=b||"100%",d=d||"100%",Array.prototype.slice.call(a.querySelectorAll("svg")).filter(function(a){return a.getAttributeNS(c.namespaces.xmlns,"ct")}).forEach(function(b){a.removeChild(b)}),f=new c.Svg("svg").attr({width:b,height:d}).addClass(e),f._node.style.width=b,f._node.style.height=d,a.appendChild(f._node),f},c.normalizeData=function(a,b,d){var e,f={raw:a,normalized:{}};return f.normalized.series=c.getDataArray({series:a.series||[]},b,d),e=f.normalized.series.every(function(a){return a instanceof Array})?Math.max.apply(null,f.normalized.series.map(function(a){return a.length})):f.normalized.series.length,f.normalized.labels=(a.labels||[]).slice(),Array.prototype.push.apply(f.normalized.labels,c.times(Math.max(0,e-f.normalized.labels.length)).map(function(){return""})),b&&c.reverseData(f.normalized),f},c.safeHasProperty=function(a,b){return null!==a&&"object"==typeof a&&a.hasOwnProperty(b)},c.isDataHoleValue=function(a){return null===a||void 0===a||"number"==typeof a&&isNaN(a)},c.reverseData=function(a){a.labels.reverse(),a.series.reverse();for(var b=0;b<a.series.length;b++)"object"==typeof a.series[b]&&void 0!==a.series[b].data?a.series[b].data.reverse():a.series[b]instanceof Array&&a.series[b].reverse()},c.getDataArray=function(a,b,d){function e(a){if(c.safeHasProperty(a,"value"))return e(a.value);if(c.safeHasProperty(a,"data"))return e(a.data);if(a instanceof Array)return a.map(e);if(!c.isDataHoleValue(a)){if(d){var b={};return"string"==typeof d?b[d]=c.getNumberOrUndefined(a):b.y=c.getNumberOrUndefined(a),b.x=a.hasOwnProperty("x")?c.getNumberOrUndefined(a.x):b.x,b.y=a.hasOwnProperty("y")?c.getNumberOrUndefined(a.y):b.y,b}return c.getNumberOrUndefined(a)}}return a.series.map(e)},c.normalizePadding=function(a,b){return b=b||0,"number"==typeof a?{top:a,right:a,bottom:a,left:a}:{top:"number"==typeof a.top?a.top:b,right:"number"==typeof a.right?a.right:b,bottom:"number"==typeof a.bottom?a.bottom:b,left:"number"==typeof a.left?a.left:b}},c.getMetaData=function(a,b){var c=a.data?a.data[b]:a[b];return c?c.meta:void 0},c.orderOfMagnitude=function(a){return Math.floor(Math.log(Math.abs(a))/Math.LN10)},c.projectLength=function(a,b,c){return b/c.range*a},c.getAvailableHeight=function(a,b){return Math.max((c.quantity(b.height).value||a.height())-(b.chartPadding.top+b.chartPadding.bottom)-b.axisX.offset,0)},c.getHighLow=function(a,b,d){function e(a){if(void 0!==a)if(a instanceof Array)for(var b=0;b<a.length;b++)e(a[b]);else{var c=d?+a[d]:+a;g&&c>f.high&&(f.high=c),h&&c<f.low&&(f.low=c)}}b=c.extend({},b,d?b["axis"+d.toUpperCase()]:{});var f={high:void 0===b.high?-Number.MAX_VALUE:+b.high,low:void 0===b.low?Number.MAX_VALUE:+b.low},g=void 0===b.high,h=void 0===b.low;return(g||h)&&e(a),(b.referenceValue||0===b.referenceValue)&&(f.high=Math.max(b.referenceValue,f.high),f.low=Math.min(b.referenceValue,f.low)),f.high<=f.low&&(0===f.low?f.high=1:f.low<0?f.high=0:f.high>0?f.low=0:(f.high=1,f.low=0)),f},c.isNumeric=function(a){return null!==a&&isFinite(a)},c.isFalseyButZero=function(a){return!a&&0!==a},c.getNumberOrUndefined=function(a){return c.isNumeric(a)?+a:void 0},c.isMultiValue=function(a){return"object"==typeof a&&("x"in a||"y"in a)},c.getMultiValue=function(a,b){return c.isMultiValue(a)?c.getNumberOrUndefined(a[b||"y"]):c.getNumberOrUndefined(a)},c.rho=function(a){function b(a,c){return a%c===0?c:b(c,a%c)}function c(a){return a*a+1}if(1===a)return a;var d,e=2,f=2;if(a%2===0)return 2;do e=c(e)%a,f=c(c(f))%a,d=b(Math.abs(e-f),a);while(1===d);return d},c.getBounds=function(a,b,d,e){function f(a,b){return a===(a+=b)&&(a*=1+(b>0?o:-o)),a}var g,h,i,j=0,k={high:b.high,low:b.low};k.valueRange=k.high-k.low,k.oom=c.orderOfMagnitude(k.valueRange),k.step=Math.pow(10,k.oom),k.min=Math.floor(k.low/k.step)*k.step,k.max=Math.ceil(k.high/k.step)*k.step,k.range=k.max-k.min,k.numberOfSteps=Math.round(k.range/k.step);var l=c.projectLength(a,k.step,k),m=l<d,n=e?c.rho(k.range):0;if(e&&c.projectLength(a,1,k)>=d)k.step=1;else if(e&&n<k.step&&c.projectLength(a,n,k)>=d)k.step=n;else for(;;){if(m&&c.projectLength(a,k.step,k)<=d)k.step*=2;else{if(m||!(c.projectLength(a,k.step/2,k)>=d))break;if(k.step/=2,e&&k.step%1!==0){k.step*=2;break}}if(j++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}var o=2.221e-16;for(k.step=Math.max(k.step,o),h=k.min,i=k.max;h+k.step<=k.low;)h=f(h,k.step);for(;i-k.step>=k.high;)i=f(i,-k.step);k.min=h,k.max=i,k.range=k.max-k.min;var p=[];for(g=k.min;g<=k.max;g=f(g,k.step)){var q=c.roundWithPrecision(g);q!==p[p.length-1]&&p.push(q)}return k.values=p,k},c.polarToCartesian=function(a,b,c,d){var e=(d-90)*Math.PI/180;return{x:a+c*Math.cos(e),y:b+c*Math.sin(e)}},c.createChartRect=function(a,b,d){var e=!(!b.axisX&&!b.axisY),f=e?b.axisY.offset:0,g=e?b.axisX.offset:0,h=a.width()||c.quantity(b.width).value||0,i=a.height()||c.quantity(b.height).value||0,j=c.normalizePadding(b.chartPadding,d);h=Math.max(h,f+j.left+j.right),i=Math.max(i,g+j.top+j.bottom);var k={padding:j,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return e?("start"===b.axisX.position?(k.y2=j.top+g,k.y1=Math.max(i-j.bottom,k.y2+1)):(k.y2=j.top,k.y1=Math.max(i-j.bottom-g,k.y2+1)),"start"===b.axisY.position?(k.x1=j.left+f,k.x2=Math.max(h-j.right,k.x1+1)):(k.x1=j.left,k.x2=Math.max(h-j.right-f,k.x1+1))):(k.x1=j.left,k.x2=Math.max(h-j.right,k.x1+1),k.y2=j.top,k.y1=Math.max(i-j.bottom,k.y2+1)),k},c.createGrid=function(a,b,d,e,f,g,h,i){var j={};j[d.units.pos+"1"]=a,j[d.units.pos+"2"]=a,j[d.counterUnits.pos+"1"]=e,j[d.counterUnits.pos+"2"]=e+f;var k=g.elem("line",j,h.join(" "));i.emit("draw",c.extend({type:"grid",axis:d,index:b,group:g,element:k},j))},c.createGridBackground=function(a,b,c,d){var e=a.elem("rect",{x:b.x1,y:b.y2,width:b.width(),height:b.height()},c,!0);d.emit("draw",{type:"gridBackground",group:a,element:e})},c.createLabel=function(a,d,e,f,g,h,i,j,k,l,m){var n,o={};if(o[g.units.pos]=a+i[g.units.pos],o[g.counterUnits.pos]=i[g.counterUnits.pos],o[g.units.len]=d,o[g.counterUnits.len]=Math.max(0,h-10),l){var p=b.createElement("span");p.className=k.join(" "),p.setAttribute("xmlns",c.namespaces.xhtml),p.innerText=f[e],p.style[g.units.len]=Math.round(o[g.units.len])+"px",p.style[g.counterUnits.len]=Math.round(o[g.counterUnits.len])+"px",n=j.foreignObject(p,c.extend({style:"overflow: visible;"},o))}else n=j.elem("text",o,k.join(" ")).text(f[e]);m.emit("draw",c.extend({type:"label",axis:g,index:e,group:j,element:n,text:f[e]},o))},c.getSeriesOption=function(a,b,c){if(a.name&&b.series&&b.series[a.name]){var d=b.series[a.name];return d.hasOwnProperty(c)?d[c]:b[c]}return b[c]},c.optionsProvider=function(b,d,e){function f(b){var f=h;if(h=c.extend({},j),d)for(i=0;i<d.length;i++){var g=a.matchMedia(d[i][0]);g.matches&&(h=c.extend(h,d[i][1]))}e&&b&&e.emit("optionsChanged",{previousOptions:f,currentOptions:h})}function g(){k.forEach(function(a){a.removeListener(f)})}var h,i,j=c.extend({},b),k=[];if(!a.matchMedia)throw"window.matchMedia not found! Make sure you're using a polyfill.";if(d)for(i=0;i<d.length;i++){var l=a.matchMedia(d[i][0]);l.addListener(f),k.push(l)}return f(),{removeMediaQueryListeners:g,getCurrentOptions:function(){return c.extend({},h)}}},c.splitIntoSegments=function(a,b,d){var e={increasingX:!1,fillHoles:!1};d=c.extend({},e,d);for(var f=[],g=!0,h=0;h<a.length;h+=2)void 0===c.getMultiValue(b[h/2].value)?d.fillHoles||(g=!0):(d.increasingX&&h>=2&&a[h]<=a[h-2]&&(g=!0),g&&(f.push({pathCoordinates:[],valueData:[]}),g=!1),f[f.length-1].pathCoordinates.push(a[h],a[h+1]),f[f.length-1].valueData.push(b[h/2]));return f}}(window,document,a),function(a,b,c){"use strict";c.Interpolation={},c.Interpolation.none=function(a){var b={fillHoles:!1};return a=c.extend({},b,a),function(b,d){for(var e=new c.Svg.Path,f=!0,g=0;g<b.length;g+=2){var h=b[g],i=b[g+1],j=d[g/2];void 0!==c.getMultiValue(j.value)?(f?e.move(h,i,!1,j):e.line(h,i,!1,j),f=!1):a.fillHoles||(f=!0)}return e}},c.Interpolation.simple=function(a){var b={divisor:2,fillHoles:!1};a=c.extend({},b,a);var d=1/Math.max(1,a.divisor);return function(b,e){for(var f,g,h,i=new c.Svg.Path,j=0;j<b.length;j+=2){var k=b[j],l=b[j+1],m=(k-f)*d,n=e[j/2];void 0!==n.value?(void 0===h?i.move(k,l,!1,n):i.curve(f+m,g,k-m,l,k,l,!1,n),f=k,g=l,h=n):a.fillHoles||(f=k=h=void 0)}return i}},c.Interpolation.cardinal=function(a){var b={tension:1,fillHoles:!1};a=c.extend({},b,a);var d=Math.min(1,Math.max(0,a.tension)),e=1-d;return function f(b,g){var h=c.splitIntoSegments(b,g,{fillHoles:a.fillHoles});if(h.length){if(h.length>1){var i=[];return h.forEach(function(a){i.push(f(a.pathCoordinates,a.valueData))}),c.Svg.Path.join(i)}if(b=h[0].pathCoordinates,g=h[0].valueData,b.length<=4)return c.Interpolation.none()(b,g);for(var j,k=(new c.Svg.Path).move(b[0],b[1],!1,g[0]),l=0,m=b.length;m-2*!j>l;l+=2){var n=[{x:+b[l-2],y:+b[l-1]},{x:+b[l],y:+b[l+1]},{x:+b[l+2],y:+b[l+3]},{x:+b[l+4],y:+b[l+5]}];j?l?m-4===l?n[3]={x:+b[0],y:+b[1]}:m-2===l&&(n[2]={x:+b[0],y:+b[1]},n[3]={x:+b[2],y:+b[3]}):n[0]={x:+b[m-2],y:+b[m-1]}:m-4===l?n[3]=n[2]:l||(n[0]={x:+b[l],y:+b[l+1]}),k.curve(d*(-n[0].x+6*n[1].x+n[2].x)/6+e*n[2].x,d*(-n[0].y+6*n[1].y+n[2].y)/6+e*n[2].y,d*(n[1].x+6*n[2].x-n[3].x)/6+e*n[2].x,d*(n[1].y+6*n[2].y-n[3].y)/6+e*n[2].y,n[2].x,n[2].y,!1,g[(l+2)/2])}return k}return c.Interpolation.none()([])}},c.Interpolation.monotoneCubic=function(a){var b={fillHoles:!1};return a=c.extend({},b,a),function d(b,e){var f=c.splitIntoSegments(b,e,{fillHoles:a.fillHoles,increasingX:!0});if(f.length){if(f.length>1){var g=[];return f.forEach(function(a){g.push(d(a.pathCoordinates,a.valueData))}),c.Svg.Path.join(g)}if(b=f[0].pathCoordinates,e=f[0].valueData,b.length<=4)return c.Interpolation.none()(b,e);var h,i,j=[],k=[],l=b.length/2,m=[],n=[],o=[],p=[];for(h=0;h<l;h++)j[h]=b[2*h],k[h]=b[2*h+1];for(h=0;h<l-1;h++)o[h]=k[h+1]-k[h],p[h]=j[h+1]-j[h],n[h]=o[h]/p[h];for(m[0]=n[0],m[l-1]=n[l-2],h=1;h<l-1;h++)0===n[h]||0===n[h-1]||n[h-1]>0!=n[h]>0?m[h]=0:(m[h]=3*(p[h-1]+p[h])/((2*p[h]+p[h-1])/n[h-1]+(p[h]+2*p[h-1])/n[h]),isFinite(m[h])||(m[h]=0));for(i=(new c.Svg.Path).move(j[0],k[0],!1,e[0]),h=0;h<l-1;h++)i.curve(j[h]+p[h]/3,k[h]+m[h]*p[h]/3,j[h+1]-p[h]/3,k[h+1]-m[h+1]*p[h]/3,j[h+1],k[h+1],!1,e[h+1]);return i}return c.Interpolation.none()([])}},c.Interpolation.step=function(a){var b={postpone:!0,fillHoles:!1};return a=c.extend({},b,a),function(b,d){for(var e,f,g,h=new c.Svg.Path,i=0;i<b.length;i+=2){var j=b[i],k=b[i+1],l=d[i/2];void 0!==l.value?(void 0===g?h.move(j,k,!1,l):(a.postpone?h.line(j,f,!1,g):h.line(e,k,!1,l),h.line(j,k,!1,l)),e=j,f=k,g=l):a.fillHoles||(e=f=g=void 0)}return h}}}(window,document,a),function(a,b,c){"use strict";c.EventEmitter=function(){function a(a,b){d[a]=d[a]||[],d[a].push(b)}function b(a,b){d[a]&&(b?(d[a].splice(d[a].indexOf(b),1),0===d[a].length&&delete d[a]):delete d[a])}function c(a,b){d[a]&&d[a].forEach(function(a){a(b)}),d["*"]&&d["*"].forEach(function(c){c(a,b)})}var d=[];return{addEventHandler:a,removeEventHandler:b,emit:c}}}(window,document,a),function(a,b,c){"use strict";function d(a){var b=[];if(a.length)for(var c=0;c<a.length;c++)b.push(a[c]);return b}function e(a,b){var d=b||this.prototype||c.Class,e=Object.create(d);c.Class.cloneDefinitions(e,a);var f=function(){var a,b=e.constructor||function(){};return a=this===c?Object.create(e):this,b.apply(a,Array.prototype.slice.call(arguments,0)),a};return f.prototype=e,f["super"]=d,f.extend=this.extend,f}function f(){var a=d(arguments),b=a[0];return a.splice(1,a.length-1).forEach(function(a){Object.getOwnPropertyNames(a).forEach(function(c){delete b[c],Object.defineProperty(b,c,Object.getOwnPropertyDescriptor(a,c))})}),b}c.Class={extend:e,cloneDefinitions:f}}(window,document,a),function(a,b,c){"use strict";function d(a,b,d){return a&&(this.data=a||{},this.data.labels=this.data.labels||[],this.data.series=this.data.series||[],this.eventEmitter.emit("data",{type:"update",data:this.data})),b&&(this.options=c.extend({},d?this.options:this.defaultOptions,b),this.initializeTimeoutId||(this.optionsProvider.removeMediaQueryListeners(),this.optionsProvider=c.optionsProvider(this.options,this.responsiveOptions,this.eventEmitter))),this.initializeTimeoutId||this.createChart(this.optionsProvider.getCurrentOptions()),this}function e(){return this.initializeTimeoutId?a.clearTimeout(this.initializeTimeoutId):(a.removeEventListener("resize",this.resizeListener),this.optionsProvider.removeMediaQueryListeners()),this}function f(a,b){return this.eventEmitter.addEventHandler(a,b),this}function g(a,b){return this.eventEmitter.removeEventHandler(a,b),this}function h(){a.addEventListener("resize",this.resizeListener),this.optionsProvider=c.optionsProvider(this.options,this.responsiveOptions,this.eventEmitter),this.eventEmitter.addEventHandler("optionsChanged",function(){this.update()}.bind(this)),this.options.plugins&&this.options.plugins.forEach(function(a){a instanceof Array?a[0](this,a[1]):a(this)}.bind(this)),this.eventEmitter.emit("data",{type:"initial",data:this.data}),this.createChart(this.optionsProvider.getCurrentOptions()),this.initializeTimeoutId=void 0}function i(a,b,d,e,f){this.container=c.querySelector(a),this.data=b||{},this.data.labels=this.data.labels||[],this.data.series=this.data.series||[],this.defaultOptions=d,this.options=e,this.responsiveOptions=f,this.eventEmitter=c.EventEmitter(),this.supportsForeignObject=c.Svg.isSupported("Extensibility"),this.supportsAnimations=c.Svg.isSupported("AnimationEventsAttribute"),this.resizeListener=function(){this.update()}.bind(this),this.container&&(this.container.__chartist__&&this.container.__chartist__.detach(),this.container.__chartist__=this),this.initializeTimeoutId=setTimeout(h.bind(this),0)}c.Base=c.Class.extend({constructor:i,optionsProvider:void 0,container:void 0,svg:void 0,eventEmitter:void 0,createChart:function(){throw new Error("Base chart type can't be instantiated!")},update:d,detach:e,on:f,off:g,version:c.version,supportsForeignObject:!1})}(window,document,a),function(a,b,c){"use strict";function d(a,d,e,f,g){a instanceof Element?this._node=a:(this._node=b.createElementNS(c.namespaces.svg,a),"svg"===a&&this.attr({"xmlns:ct":c.namespaces.ct})),d&&this.attr(d),e&&this.addClass(e),f&&(g&&f._node.firstChild?f._node.insertBefore(this._node,f._node.firstChild):f._node.appendChild(this._node))}function e(a,b){return"string"==typeof a?b?this._node.getAttributeNS(b,a):this._node.getAttribute(a):(Object.keys(a).forEach(function(b){if(void 0!==a[b])if(b.indexOf(":")!==-1){var d=b.split(":");this._node.setAttributeNS(c.namespaces[d[0]],b,a[b])}else this._node.setAttribute(b,a[b])}.bind(this)),this)}function f(a,b,d,e){return new c.Svg(a,b,d,this,e)}function g(){return this._node.parentNode instanceof SVGElement?new c.Svg(this._node.parentNode):null}function h(){for(var a=this._node;"svg"!==a.nodeName;)a=a.parentNode;return new c.Svg(a)}function i(a){var b=this._node.querySelector(a);return b?new c.Svg(b):null}function j(a){var b=this._node.querySelectorAll(a);return b.length?new c.Svg.List(b):null}function k(){return this._node}function l(a,d,e,f){if("string"==typeof a){var g=b.createElement("div");g.innerHTML=a,a=g.firstChild}a.setAttribute("xmlns",c.namespaces.xmlns);var h=this.elem("foreignObject",d,e,f);return h._node.appendChild(a),h}function m(a){return this._node.appendChild(b.createTextNode(a)),this}function n(){for(;this._node.firstChild;)this._node.removeChild(this._node.firstChild);return this}function o(){return this._node.parentNode.removeChild(this._node),this.parent()}function p(a){return this._node.parentNode.replaceChild(a._node,this._node),a}function q(a,b){return b&&this._node.firstChild?this._node.insertBefore(a._node,this._node.firstChild):this._node.appendChild(a._node),this}function r(){return this._node.getAttribute("class")?this._node.getAttribute("class").trim().split(/\s+/):[]}function s(a){return this._node.setAttribute("class",this.classes(this._node).concat(a.trim().split(/\s+/)).filter(function(a,b,c){return c.indexOf(a)===b}).join(" ")),this}function t(a){var b=a.trim().split(/\s+/);return this._node.setAttribute("class",this.classes(this._node).filter(function(a){return b.indexOf(a)===-1}).join(" ")),this}function u(){return this._node.setAttribute("class",""),this}function v(){return this._node.getBoundingClientRect().height}function w(){return this._node.getBoundingClientRect().width}function x(a,b,d){return void 0===b&&(b=!0),Object.keys(a).forEach(function(e){function f(a,b){var f,g,h,i={};a.easing&&(h=a.easing instanceof Array?a.easing:c.Svg.Easing[a.easing],delete a.easing),a.begin=c.ensureUnit(a.begin,"ms"),a.dur=c.ensureUnit(a.dur,"ms"),h&&(a.calcMode="spline",a.keySplines=h.join(" "),a.keyTimes="0;1"),b&&(a.fill="freeze",i[e]=a.from,this.attr(i),g=c.quantity(a.begin||0).value,a.begin="indefinite"),f=this.elem("animate",c.extend({attributeName:e},a)),b&&setTimeout(function(){try{f._node.beginElement()}catch(b){i[e]=a.to,this.attr(i),f.remove()}}.bind(this),g),d&&f._node.addEventListener("beginEvent",function(){d.emit("animationBegin",{element:this,animate:f._node,params:a})}.bind(this)),f._node.addEventListener("endEvent",function(){d&&d.emit("animationEnd",{element:this,animate:f._node,params:a}),b&&(i[e]=a.to,this.attr(i),f.remove())}.bind(this))}a[e]instanceof Array?a[e].forEach(function(a){f.bind(this)(a,!1)}.bind(this)):f.bind(this)(a[e],b)}.bind(this)),this}function y(a){var b=this;this.svgElements=[];for(var d=0;d<a.length;d++)this.svgElements.push(new c.Svg(a[d]));Object.keys(c.Svg.prototype).filter(function(a){return["constructor","parent","querySelector","querySelectorAll","replace","append","classes","height","width"].indexOf(a)===-1}).forEach(function(a){b[a]=function(){var d=Array.prototype.slice.call(arguments,0);return b.svgElements.forEach(function(b){c.Svg.prototype[a].apply(b,d)}),b}})}c.Svg=c.Class.extend({constructor:d,attr:e,elem:f,parent:g,root:h,querySelector:i,querySelectorAll:j,getNode:k,foreignObject:l,text:m,empty:n,remove:o,replace:p,append:q,classes:r,addClass:s,removeClass:t,removeAllClasses:u,height:v,width:w,animate:x}),c.Svg.isSupported=function(a){return b.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#"+a,"1.1")};var z={easeInSine:[.47,0,.745,.715],easeOutSine:[.39,.575,.565,1],easeInOutSine:[.445,.05,.55,.95],easeInQuad:[.55,.085,.68,.53],easeOutQuad:[.25,.46,.45,.94],easeInOutQuad:[.455,.03,.515,.955],easeInCubic:[.55,.055,.675,.19],easeOutCubic:[.215,.61,.355,1],easeInOutCubic:[.645,.045,.355,1],easeInQuart:[.895,.03,.685,.22],easeOutQuart:[.165,.84,.44,1],easeInOutQuart:[.77,0,.175,1],easeInQuint:[.755,.05,.855,.06],easeOutQuint:[.23,1,.32,1],easeInOutQuint:[.86,0,.07,1],easeInExpo:[.95,.05,.795,.035],easeOutExpo:[.19,1,.22,1],easeInOutExpo:[1,0,0,1],easeInCirc:[.6,.04,.98,.335],easeOutCirc:[.075,.82,.165,1],easeInOutCirc:[.785,.135,.15,.86],easeInBack:[.6,-.28,.735,.045],easeOutBack:[.175,.885,.32,1.275],easeInOutBack:[.68,-.55,.265,1.55]};c.Svg.Easing=z,c.Svg.List=c.Class.extend({constructor:y})}(window,document,a),function(a,b,c){"use strict";function d(a,b,d,e,f,g){var h=c.extend({command:f?a.toLowerCase():a.toUpperCase()},b,g?{data:g}:{});d.splice(e,0,h)}function e(a,b){a.forEach(function(c,d){u[c.command.toLowerCase()].forEach(function(e,f){b(c,e,d,f,a)})})}function f(a,b){this.pathElements=[],this.pos=0,this.close=a,this.options=c.extend({},v,b)}function g(a){return void 0!==a?(this.pos=Math.max(0,Math.min(this.pathElements.length,a)),this):this.pos}function h(a){return this.pathElements.splice(this.pos,a),this}function i(a,b,c,e){return d("M",{x:+a,y:+b},this.pathElements,this.pos++,c,e),this}function j(a,b,c,e){return d("L",{x:+a,y:+b},this.pathElements,this.pos++,c,e),this}function k(a,b,c,e,f,g,h,i){return d("C",{x1:+a,y1:+b,x2:+c,y2:+e,x:+f,y:+g},this.pathElements,this.pos++,h,i),this}function l(a,b,c,e,f,g,h,i,j){return d("A",{rx:+a,ry:+b,xAr:+c,lAf:+e,sf:+f,x:+g,y:+h},this.pathElements,this.pos++,i,j),this}function m(a){var b=a.replace(/([A-Za-z])([0-9])/g,"$1 $2").replace(/([0-9])([A-Za-z])/g,"$1 $2").split(/[\s,]+/).reduce(function(a,b){return b.match(/[A-Za-z]/)&&a.push([]),a[a.length-1].push(b),a},[]);"Z"===b[b.length-1][0].toUpperCase()&&b.pop();var d=b.map(function(a){var b=a.shift(),d=u[b.toLowerCase()];return c.extend({command:b},d.reduce(function(b,c,d){return b[c]=+a[d],b},{}))}),e=[this.pos,0];return Array.prototype.push.apply(e,d),Array.prototype.splice.apply(this.pathElements,e),this.pos+=d.length,this}function n(){var a=Math.pow(10,this.options.accuracy);return this.pathElements.reduce(function(b,c){var d=u[c.command.toLowerCase()].map(function(b){return this.options.accuracy?Math.round(c[b]*a)/a:c[b]}.bind(this));return b+c.command+d.join(",")}.bind(this),"")+(this.close?"Z":"")}function o(a,b){return e(this.pathElements,function(c,d){c[d]*="x"===d[0]?a:b}),this}function p(a,b){return e(this.pathElements,function(c,d){c[d]+="x"===d[0]?a:b}),this}function q(a){return e(this.pathElements,function(b,c,d,e,f){var g=a(b,c,d,e,f);(g||0===g)&&(b[c]=g)}),this}function r(a){var b=new c.Svg.Path(a||this.close);return b.pos=this.pos,b.pathElements=this.pathElements.slice().map(function(a){return c.extend({},a)}),b.options=c.extend({},this.options),b}function s(a){var b=[new c.Svg.Path];return this.pathElements.forEach(function(d){d.command===a.toUpperCase()&&0!==b[b.length-1].pathElements.length&&b.push(new c.Svg.Path),b[b.length-1].pathElements.push(d)}),b}function t(a,b,d){for(var e=new c.Svg.Path(b,d),f=0;f<a.length;f++)for(var g=a[f],h=0;h<g.pathElements.length;h++)e.pathElements.push(g.pathElements[h]);return e}var u={m:["x","y"],l:["x","y"],c:["x1","y1","x2","y2","x","y"],a:["rx","ry","xAr","lAf","sf","x","y"]},v={accuracy:3};c.Svg.Path=c.Class.extend({constructor:f,position:g,remove:h,move:i,line:j,curve:k,arc:l,scale:o,translate:p,transform:q,parse:m,stringify:n,clone:r,splitByCommand:s}),c.Svg.Path.elementDescriptions=u,c.Svg.Path.join=t}(window,document,a),function(a,b,c){"use strict";function d(a,b,c,d){this.units=a,this.counterUnits=a===f.x?f.y:f.x,this.chartRect=b,this.axisLength=b[a.rectEnd]-b[a.rectStart],this.gridOffset=b[a.rectOffset],this.ticks=c,this.options=d}function e(a,b,d,e,f){var g=e["axis"+this.units.pos.toUpperCase()],h=this.ticks.map(this.projectValue.bind(this)),i=this.ticks.map(g.labelInterpolationFnc);h.forEach(function(j,k){var l,m={x:0,y:0};l=h[k+1]?h[k+1]-j:Math.max(this.axisLength-j,30),c.isFalseyButZero(i[k])&&""!==i[k]||("x"===this.units.pos?(j=this.chartRect.x1+j,m.x=e.axisX.labelOffset.x,"start"===e.axisX.position?m.y=this.chartRect.padding.top+e.axisX.labelOffset.y+(d?5:20):m.y=this.chartRect.y1+e.axisX.labelOffset.y+(d?5:20)):(j=this.chartRect.y1-j,m.y=e.axisY.labelOffset.y-(d?l:0),"start"===e.axisY.position?m.x=d?this.chartRect.padding.left+e.axisY.labelOffset.x:this.chartRect.x1-10:m.x=this.chartRect.x2+e.axisY.labelOffset.x+10),g.showGrid&&c.createGrid(j,k,this,this.gridOffset,this.chartRect[this.counterUnits.len](),a,[e.classNames.grid,e.classNames[this.units.dir]],f),g.showLabel&&c.createLabel(j,l,k,i,this,g.offset,m,b,[e.classNames.label,e.classNames[this.units.dir],"start"===g.position?e.classNames[g.position]:e.classNames.end],d,f))}.bind(this))}var f={x:{pos:"x",len:"width",dir:"horizontal",rectStart:"x1",rectEnd:"x2",rectOffset:"y2"},y:{pos:"y",len:"height",dir:"vertical",rectStart:"y2",rectEnd:"y1",rectOffset:"x1"}};c.Axis=c.Class.extend({constructor:d,createGridAndLabels:e,projectValue:function(a,b,c){throw new Error("Base axis can't be instantiated!")}}),c.Axis.units=f}(window,document,a),function(a,b,c){"use strict";function d(a,b,d,e){var f=e.highLow||c.getHighLow(b,e,a.pos);this.bounds=c.getBounds(d[a.rectEnd]-d[a.rectStart],f,e.scaleMinSpace||20,e.onlyInteger),this.range={min:this.bounds.min,max:this.bounds.max},c.AutoScaleAxis["super"].constructor.call(this,a,d,this.bounds.values,e)}function e(a){return this.axisLength*(+c.getMultiValue(a,this.units.pos)-this.bounds.min)/this.bounds.range}c.AutoScaleAxis=c.Axis.extend({constructor:d,projectValue:e})}(window,document,a),function(a,b,c){"use strict";function d(a,b,d,e){var f=e.highLow||c.getHighLow(b,e,a.pos);this.divisor=e.divisor||1,this.ticks=e.ticks||c.times(this.divisor).map(function(a,b){return f.low+(f.high-f.low)/this.divisor*b}.bind(this)),this.ticks.sort(function(a,b){return a-b}),this.range={min:f.low,max:f.high},c.FixedScaleAxis["super"].constructor.call(this,a,d,this.ticks,e),this.stepLength=this.axisLength/this.divisor}function e(a){return this.axisLength*(+c.getMultiValue(a,this.units.pos)-this.range.min)/(this.range.max-this.range.min)}c.FixedScaleAxis=c.Axis.extend({constructor:d,projectValue:e})}(window,document,a),function(a,b,c){"use strict";function d(a,b,d,e){c.StepAxis["super"].constructor.call(this,a,d,e.ticks,e);var f=Math.max(1,e.ticks.length-(e.stretch?1:0));this.stepLength=this.axisLength/f}function e(a,b){return this.stepLength*b}c.StepAxis=c.Axis.extend({constructor:d,projectValue:e})}(window,document,a),function(a,b,c){"use strict";function d(a){var b=c.normalizeData(this.data,a.reverseData,!0);this.svg=c.createSvg(this.container,a.width,a.height,a.classNames.chart);var d,e,g=this.svg.elem("g").addClass(a.classNames.gridGroup),h=this.svg.elem("g"),i=this.svg.elem("g").addClass(a.classNames.labelGroup),j=c.createChartRect(this.svg,a,f.padding);d=void 0===a.axisX.type?new c.StepAxis(c.Axis.units.x,b.normalized.series,j,c.extend({},a.axisX,{ticks:b.normalized.labels,stretch:a.fullWidth})):a.axisX.type.call(c,c.Axis.units.x,b.normalized.series,j,a.axisX),e=void 0===a.axisY.type?new c.AutoScaleAxis(c.Axis.units.y,b.normalized.series,j,c.extend({},a.axisY,{high:c.isNumeric(a.high)?a.high:a.axisY.high,low:c.isNumeric(a.low)?a.low:a.axisY.low})):a.axisY.type.call(c,c.Axis.units.y,b.normalized.series,j,a.axisY),d.createGridAndLabels(g,i,this.supportsForeignObject,a,this.eventEmitter),e.createGridAndLabels(g,i,this.supportsForeignObject,a,this.eventEmitter),a.showGridBackground&&c.createGridBackground(g,j,a.classNames.gridBackground,this.eventEmitter),b.raw.series.forEach(function(f,g){var i=h.elem("g");i.attr({"ct:series-name":f.name,"ct:meta":c.serialize(f.meta)}),i.addClass([a.classNames.series,f.className||a.classNames.series+"-"+c.alphaNumerate(g)].join(" "));var k=[],l=[];b.normalized.series[g].forEach(function(a,h){var i={x:j.x1+d.projectValue(a,h,b.normalized.series[g]),y:j.y1-e.projectValue(a,h,b.normalized.series[g])};k.push(i.x,i.y),l.push({value:a,valueIndex:h,meta:c.getMetaData(f,h)})}.bind(this));var m={lineSmooth:c.getSeriesOption(f,a,"lineSmooth"),showPoint:c.getSeriesOption(f,a,"showPoint"),showLine:c.getSeriesOption(f,a,"showLine"),showArea:c.getSeriesOption(f,a,"showArea"),areaBase:c.getSeriesOption(f,a,"areaBase")},n="function"==typeof m.lineSmooth?m.lineSmooth:m.lineSmooth?c.Interpolation.monotoneCubic():c.Interpolation.none(),o=n(k,l);if(m.showPoint&&o.pathElements.forEach(function(b){var h=i.elem("line",{x1:b.x,y1:b.y,x2:b.x+.01,y2:b.y},a.classNames.point).attr({"ct:value":[b.data.value.x,b.data.value.y].filter(c.isNumeric).join(","),"ct:meta":c.serialize(b.data.meta)});this.eventEmitter.emit("draw",{type:"point",value:b.data.value,index:b.data.valueIndex,meta:b.data.meta,series:f,seriesIndex:g,axisX:d,axisY:e,group:i,element:h,x:b.x,y:b.y})}.bind(this)),m.showLine){var p=i.elem("path",{d:o.stringify()},a.classNames.line,!0);this.eventEmitter.emit("draw",{type:"line",values:b.normalized.series[g],path:o.clone(),chartRect:j,index:g,series:f,seriesIndex:g,seriesMeta:f.meta,axisX:d,axisY:e,group:i,element:p})}if(m.showArea&&e.range){var q=Math.max(Math.min(m.areaBase,e.range.max),e.range.min),r=j.y1-e.projectValue(q);o.splitByCommand("M").filter(function(a){return a.pathElements.length>1}).map(function(a){var b=a.pathElements[0],c=a.pathElements[a.pathElements.length-1];return a.clone(!0).position(0).remove(1).move(b.x,r).line(b.x,b.y).position(a.pathElements.length+1).line(c.x,r)}).forEach(function(c){var h=i.elem("path",{d:c.stringify()},a.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:b.normalized.series[g],path:c.clone(),series:f,seriesIndex:g,axisX:d,axisY:e,chartRect:j,index:g,group:i,element:h})}.bind(this))}}.bind(this)),this.eventEmitter.emit("created",{bounds:e.bounds,chartRect:j,axisX:d,axisY:e,svg:this.svg,options:a})}function e(a,b,d,e){c.Line["super"].constructor.call(this,a,b,f,c.extend({},f,d),e)}var f={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop,type:void 0,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,showGridBackground:!1,low:void 0,high:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:"ct-chart-line",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",line:"ct-line",point:"ct-point",area:"ct-area",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};c.Line=c.Base.extend({constructor:e,createChart:d})}(window,document,a),function(a,b,c){"use strict";function d(a){var b,d;a.distributeSeries?(b=c.normalizeData(this.data,a.reverseData,a.horizontalBars?"x":"y"),b.normalized.series=b.normalized.series.map(function(a){return[a]})):b=c.normalizeData(this.data,a.reverseData,a.horizontalBars?"x":"y"),this.svg=c.createSvg(this.container,a.width,a.height,a.classNames.chart+(a.horizontalBars?" "+a.classNames.horizontalBars:""));var e=this.svg.elem("g").addClass(a.classNames.gridGroup),g=this.svg.elem("g"),h=this.svg.elem("g").addClass(a.classNames.labelGroup);if(a.stackBars&&0!==b.normalized.series.length){var i=c.serialMap(b.normalized.series,function(){
9
- return Array.prototype.slice.call(arguments).map(function(a){return a}).reduce(function(a,b){return{x:a.x+(b&&b.x)||0,y:a.y+(b&&b.y)||0}},{x:0,y:0})});d=c.getHighLow([i],a,a.horizontalBars?"x":"y")}else d=c.getHighLow(b.normalized.series,a,a.horizontalBars?"x":"y");d.high=+a.high||(0===a.high?0:d.high),d.low=+a.low||(0===a.low?0:d.low);var j,k,l,m,n,o=c.createChartRect(this.svg,a,f.padding);k=a.distributeSeries&&a.stackBars?b.normalized.labels.slice(0,1):b.normalized.labels,a.horizontalBars?(j=m=void 0===a.axisX.type?new c.AutoScaleAxis(c.Axis.units.x,b.normalized.series,o,c.extend({},a.axisX,{highLow:d,referenceValue:0})):a.axisX.type.call(c,c.Axis.units.x,b.normalized.series,o,c.extend({},a.axisX,{highLow:d,referenceValue:0})),l=n=void 0===a.axisY.type?new c.StepAxis(c.Axis.units.y,b.normalized.series,o,{ticks:k}):a.axisY.type.call(c,c.Axis.units.y,b.normalized.series,o,a.axisY)):(l=m=void 0===a.axisX.type?new c.StepAxis(c.Axis.units.x,b.normalized.series,o,{ticks:k}):a.axisX.type.call(c,c.Axis.units.x,b.normalized.series,o,a.axisX),j=n=void 0===a.axisY.type?new c.AutoScaleAxis(c.Axis.units.y,b.normalized.series,o,c.extend({},a.axisY,{highLow:d,referenceValue:0})):a.axisY.type.call(c,c.Axis.units.y,b.normalized.series,o,c.extend({},a.axisY,{highLow:d,referenceValue:0})));var p=a.horizontalBars?o.x1+j.projectValue(0):o.y1-j.projectValue(0),q=[];l.createGridAndLabels(e,h,this.supportsForeignObject,a,this.eventEmitter),j.createGridAndLabels(e,h,this.supportsForeignObject,a,this.eventEmitter),a.showGridBackground&&c.createGridBackground(e,o,a.classNames.gridBackground,this.eventEmitter),b.raw.series.forEach(function(d,e){var f,h,i=e-(b.raw.series.length-1)/2;f=a.distributeSeries&&!a.stackBars?l.axisLength/b.normalized.series.length/2:a.distributeSeries&&a.stackBars?l.axisLength/2:l.axisLength/b.normalized.series[e].length/2,h=g.elem("g"),h.attr({"ct:series-name":d.name,"ct:meta":c.serialize(d.meta)}),h.addClass([a.classNames.series,d.className||a.classNames.series+"-"+c.alphaNumerate(e)].join(" ")),b.normalized.series[e].forEach(function(g,k){var r,s,t,u;if(u=a.distributeSeries&&!a.stackBars?e:a.distributeSeries&&a.stackBars?0:k,r=a.horizontalBars?{x:o.x1+j.projectValue(g&&g.x?g.x:0,k,b.normalized.series[e]),y:o.y1-l.projectValue(g&&g.y?g.y:0,u,b.normalized.series[e])}:{x:o.x1+l.projectValue(g&&g.x?g.x:0,u,b.normalized.series[e]),y:o.y1-j.projectValue(g&&g.y?g.y:0,k,b.normalized.series[e])},l instanceof c.StepAxis&&(l.options.stretch||(r[l.units.pos]+=f*(a.horizontalBars?-1:1)),r[l.units.pos]+=a.stackBars||a.distributeSeries?0:i*a.seriesBarDistance*(a.horizontalBars?-1:1)),t=q[k]||p,q[k]=t-(p-r[l.counterUnits.pos]),void 0!==g){var v={};v[l.units.pos+"1"]=r[l.units.pos],v[l.units.pos+"2"]=r[l.units.pos],!a.stackBars||"accumulate"!==a.stackMode&&a.stackMode?(v[l.counterUnits.pos+"1"]=p,v[l.counterUnits.pos+"2"]=r[l.counterUnits.pos]):(v[l.counterUnits.pos+"1"]=t,v[l.counterUnits.pos+"2"]=q[k]),v.x1=Math.min(Math.max(v.x1,o.x1),o.x2),v.x2=Math.min(Math.max(v.x2,o.x1),o.x2),v.y1=Math.min(Math.max(v.y1,o.y2),o.y1),v.y2=Math.min(Math.max(v.y2,o.y2),o.y1);var w=c.getMetaData(d,k);s=h.elem("line",v,a.classNames.bar).attr({"ct:value":[g.x,g.y].filter(c.isNumeric).join(","),"ct:meta":c.serialize(w)}),this.eventEmitter.emit("draw",c.extend({type:"bar",value:g,index:k,meta:w,series:d,seriesIndex:e,axisX:m,axisY:n,chartRect:o,group:h,element:s},v))}}.bind(this))}.bind(this)),this.eventEmitter.emit("created",{bounds:j.bounds,chartRect:o,axisX:m,axisY:n,svg:this.svg,options:a})}function e(a,b,d,e){c.Bar["super"].constructor.call(this,a,b,f,c.extend({},f,d),e)}var f={axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop,scaleMinSpace:30,onlyInteger:!1},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:c.noop,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,high:void 0,low:void 0,referenceValue:0,chartPadding:{top:15,right:15,bottom:5,left:10},seriesBarDistance:15,stackBars:!1,stackMode:"accumulate",horizontalBars:!1,distributeSeries:!1,reverseData:!1,showGridBackground:!1,classNames:{chart:"ct-chart-bar",horizontalBars:"ct-horizontal-bars",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",bar:"ct-bar",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}};c.Bar=c.Base.extend({constructor:e,createChart:d})}(window,document,a),function(a,b,c){"use strict";function d(a,b,c){var d=b.x>a.x;return d&&"explode"===c||!d&&"implode"===c?"start":d&&"implode"===c||!d&&"explode"===c?"end":"middle"}function e(a){var b,e,f,h,i,j=c.normalizeData(this.data),k=[],l=a.startAngle;this.svg=c.createSvg(this.container,a.width,a.height,a.donut?a.classNames.chartDonut:a.classNames.chartPie),e=c.createChartRect(this.svg,a,g.padding),f=Math.min(e.width()/2,e.height()/2),i=a.total||j.normalized.series.reduce(function(a,b){return a+b},0);var m=c.quantity(a.donutWidth);"%"===m.unit&&(m.value*=f/100),f-=a.donut&&!a.donutSolid?m.value/2:0,h="outside"===a.labelPosition||a.donut&&!a.donutSolid?f:"center"===a.labelPosition?0:a.donutSolid?f-m.value/2:f/2,h+=a.labelOffset;var n={x:e.x1+e.width()/2,y:e.y2+e.height()/2},o=1===j.raw.series.filter(function(a){return a.hasOwnProperty("value")?0!==a.value:0!==a}).length;j.raw.series.forEach(function(a,b){k[b]=this.svg.elem("g",null,null)}.bind(this)),a.showLabel&&(b=this.svg.elem("g",null,null)),j.raw.series.forEach(function(e,g){if(0!==j.normalized.series[g]||!a.ignoreEmptyValues){k[g].attr({"ct:series-name":e.name}),k[g].addClass([a.classNames.series,e.className||a.classNames.series+"-"+c.alphaNumerate(g)].join(" "));var p=i>0?l+j.normalized.series[g]/i*360:0,q=Math.max(0,l-(0===g||o?0:.2));p-q>=359.99&&(p=q+359.99);var r,s,t,u=c.polarToCartesian(n.x,n.y,f,q),v=c.polarToCartesian(n.x,n.y,f,p),w=new c.Svg.Path(!a.donut||a.donutSolid).move(v.x,v.y).arc(f,f,0,p-l>180,0,u.x,u.y);a.donut?a.donutSolid&&(t=f-m.value,r=c.polarToCartesian(n.x,n.y,t,l-(0===g||o?0:.2)),s=c.polarToCartesian(n.x,n.y,t,p),w.line(r.x,r.y),w.arc(t,t,0,p-l>180,1,s.x,s.y)):w.line(n.x,n.y);var x=a.classNames.slicePie;a.donut&&(x=a.classNames.sliceDonut,a.donutSolid&&(x=a.classNames.sliceDonutSolid));var y=k[g].elem("path",{d:w.stringify()},x);if(y.attr({"ct:value":j.normalized.series[g],"ct:meta":c.serialize(e.meta)}),a.donut&&!a.donutSolid&&(y._node.style.strokeWidth=m.value+"px"),this.eventEmitter.emit("draw",{type:"slice",value:j.normalized.series[g],totalDataSum:i,index:g,meta:e.meta,series:e,group:k[g],element:y,path:w.clone(),center:n,radius:f,startAngle:l,endAngle:p}),a.showLabel){var z;z=1===j.raw.series.length?{x:n.x,y:n.y}:c.polarToCartesian(n.x,n.y,h,l+(p-l)/2);var A;A=j.normalized.labels&&!c.isFalseyButZero(j.normalized.labels[g])?j.normalized.labels[g]:j.normalized.series[g];var B=a.labelInterpolationFnc(A,g);if(B||0===B){var C=b.elem("text",{dx:z.x,dy:z.y,"text-anchor":d(n,z,a.labelDirection)},a.classNames.label).text(""+B);this.eventEmitter.emit("draw",{type:"label",index:g,group:b,element:C,text:""+B,x:z.x,y:z.y})}}l=p}}.bind(this)),this.eventEmitter.emit("created",{chartRect:e,svg:this.svg,options:a})}function f(a,b,d,e){c.Pie["super"].constructor.call(this,a,b,g,c.extend({},g,d),e)}var g={width:void 0,height:void 0,chartPadding:5,classNames:{chartPie:"ct-chart-pie",chartDonut:"ct-chart-donut",series:"ct-series",slicePie:"ct-slice-pie",sliceDonut:"ct-slice-donut",sliceDonutSolid:"ct-slice-donut-solid",label:"ct-label"},startAngle:0,total:void 0,donut:!1,donutSolid:!1,donutWidth:60,showLabel:!0,labelOffset:0,labelPosition:"inside",labelInterpolationFnc:c.noop,labelDirection:"neutral",reverseData:!1,ignoreEmptyValues:!1};c.Pie=c.Base.extend({constructor:f,createChart:e,determineAnchorPosition:d})}(window,document,a),a});
10
  //# sourceMappingURL=chartist.min.js.map
1
+ /* Chartist.js 0.11.4
2
+ * Copyright © 2019 Gion Kunz
3
  * Free to use under either the WTFPL license or the MIT license.
4
  * https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-WTFPL
5
  * https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-MIT
6
  */
7
 
8
+ !function(a,b){"function"==typeof define&&define.amd?define("Chartist",[],function(){return a.Chartist=b()}):"object"==typeof module&&module.exports?module.exports=b():a.Chartist=b()}(this,function(){var a={version:"0.11.4"};return function(a,b){"use strict";var c=a.window,d=a.document;b.namespaces={svg:"http://www.w3.org/2000/svg",xmlns:"http://www.w3.org/2000/xmlns/",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",ct:"http://gionkunz.github.com/chartist-js/ct"},b.noop=function(a){return a},b.alphaNumerate=function(a){return String.fromCharCode(97+a%26)},b.extend=function(a){var c,d,e;for(a=a||{},c=1;c<arguments.length;c++){d=arguments[c];for(var f in d)e=d[f],"object"!=typeof e||null===e||e instanceof Array?a[f]=e:a[f]=b.extend(a[f],e)}return a},b.replaceAll=function(a,b,c){return a.replace(new RegExp(b,"g"),c)},b.ensureUnit=function(a,b){return"number"==typeof a&&(a+=b),a},b.quantity=function(a){if("string"==typeof a){var b=/^(\d+)\s*(.*)$/g.exec(a);return{value:+b[1],unit:b[2]||void 0}}return{value:a}},b.querySelector=function(a){return a instanceof Node?a:d.querySelector(a)},b.times=function(a){return Array.apply(null,new Array(a))},b.sum=function(a,b){return a+(b?b:0)},b.mapMultiply=function(a){return function(b){return b*a}},b.mapAdd=function(a){return function(b){return b+a}},b.serialMap=function(a,c){var d=[],e=Math.max.apply(null,a.map(function(a){return a.length}));return b.times(e).forEach(function(b,e){var f=a.map(function(a){return a[e]});d[e]=c.apply(null,f)}),d},b.roundWithPrecision=function(a,c){var d=Math.pow(10,c||b.precision);return Math.round(a*d)/d},b.precision=8,b.escapingMap={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"},b.serialize=function(a){return null===a||void 0===a?a:("number"==typeof a?a=""+a:"object"==typeof a&&(a=JSON.stringify({data:a})),Object.keys(b.escapingMap).reduce(function(a,c){return b.replaceAll(a,c,b.escapingMap[c])},a))},b.deserialize=function(a){if("string"!=typeof a)return a;a=Object.keys(b.escapingMap).reduce(function(a,c){return b.replaceAll(a,b.escapingMap[c],c)},a);try{a=JSON.parse(a),a=void 0!==a.data?a.data:a}catch(c){}return a},b.createSvg=function(a,c,d,e){var f;return c=c||"100%",d=d||"100%",Array.prototype.slice.call(a.querySelectorAll("svg")).filter(function(a){return a.getAttributeNS(b.namespaces.xmlns,"ct")}).forEach(function(b){a.removeChild(b)}),f=new b.Svg("svg").attr({width:c,height:d}).addClass(e),f._node.style.width=c,f._node.style.height=d,a.appendChild(f._node),f},b.normalizeData=function(a,c,d){var e,f={raw:a,normalized:{}};return f.normalized.series=b.getDataArray({series:a.series||[]},c,d),e=f.normalized.series.every(function(a){return a instanceof Array})?Math.max.apply(null,f.normalized.series.map(function(a){return a.length})):f.normalized.series.length,f.normalized.labels=(a.labels||[]).slice(),Array.prototype.push.apply(f.normalized.labels,b.times(Math.max(0,e-f.normalized.labels.length)).map(function(){return""})),c&&b.reverseData(f.normalized),f},b.safeHasProperty=function(a,b){return null!==a&&"object"==typeof a&&a.hasOwnProperty(b)},b.isDataHoleValue=function(a){return null===a||void 0===a||"number"==typeof a&&isNaN(a)},b.reverseData=function(a){a.labels.reverse(),a.series.reverse();for(var b=0;b<a.series.length;b++)"object"==typeof a.series[b]&&void 0!==a.series[b].data?a.series[b].data.reverse():a.series[b]instanceof Array&&a.series[b].reverse()},b.getDataArray=function(a,c,d){function e(a){if(b.safeHasProperty(a,"value"))return e(a.value);if(b.safeHasProperty(a,"data"))return e(a.data);if(a instanceof Array)return a.map(e);if(!b.isDataHoleValue(a)){if(d){var c={};return"string"==typeof d?c[d]=b.getNumberOrUndefined(a):c.y=b.getNumberOrUndefined(a),c.x=a.hasOwnProperty("x")?b.getNumberOrUndefined(a.x):c.x,c.y=a.hasOwnProperty("y")?b.getNumberOrUndefined(a.y):c.y,c}return b.getNumberOrUndefined(a)}}return a.series.map(e)},b.normalizePadding=function(a,b){return b=b||0,"number"==typeof a?{top:a,right:a,bottom:a,left:a}:{top:"number"==typeof a.top?a.top:b,right:"number"==typeof a.right?a.right:b,bottom:"number"==typeof a.bottom?a.bottom:b,left:"number"==typeof a.left?a.left:b}},b.getMetaData=function(a,b){var c=a.data?a.data[b]:a[b];return c?c.meta:void 0},b.orderOfMagnitude=function(a){return Math.floor(Math.log(Math.abs(a))/Math.LN10)},b.projectLength=function(a,b,c){return b/c.range*a},b.getAvailableHeight=function(a,c){return Math.max((b.quantity(c.height).value||a.height())-(c.chartPadding.top+c.chartPadding.bottom)-c.axisX.offset,0)},b.getHighLow=function(a,c,d){function e(a){if(void 0!==a)if(a instanceof Array)for(var b=0;b<a.length;b++)e(a[b]);else{var c=d?+a[d]:+a;g&&c>f.high&&(f.high=c),h&&c<f.low&&(f.low=c)}}c=b.extend({},c,d?c["axis"+d.toUpperCase()]:{});var f={high:void 0===c.high?-Number.MAX_VALUE:+c.high,low:void 0===c.low?Number.MAX_VALUE:+c.low},g=void 0===c.high,h=void 0===c.low;return(g||h)&&e(a),(c.referenceValue||0===c.referenceValue)&&(f.high=Math.max(c.referenceValue,f.high),f.low=Math.min(c.referenceValue,f.low)),f.high<=f.low&&(0===f.low?f.high=1:f.low<0?f.high=0:f.high>0?f.low=0:(f.high=1,f.low=0)),f},b.isNumeric=function(a){return null!==a&&isFinite(a)},b.isFalseyButZero=function(a){return!a&&0!==a},b.getNumberOrUndefined=function(a){return b.isNumeric(a)?+a:void 0},b.isMultiValue=function(a){return"object"==typeof a&&("x"in a||"y"in a)},b.getMultiValue=function(a,c){return b.isMultiValue(a)?b.getNumberOrUndefined(a[c||"y"]):b.getNumberOrUndefined(a)},b.rho=function(a){function b(a,c){return a%c===0?c:b(c,a%c)}function c(a){return a*a+1}if(1===a)return a;var d,e=2,f=2;if(a%2===0)return 2;do e=c(e)%a,f=c(c(f))%a,d=b(Math.abs(e-f),a);while(1===d);return d},b.getBounds=function(a,c,d,e){function f(a,b){return a===(a+=b)&&(a*=1+(b>0?o:-o)),a}var g,h,i,j=0,k={high:c.high,low:c.low};k.valueRange=k.high-k.low,k.oom=b.orderOfMagnitude(k.valueRange),k.step=Math.pow(10,k.oom),k.min=Math.floor(k.low/k.step)*k.step,k.max=Math.ceil(k.high/k.step)*k.step,k.range=k.max-k.min,k.numberOfSteps=Math.round(k.range/k.step);var l=b.projectLength(a,k.step,k),m=l<d,n=e?b.rho(k.range):0;if(e&&b.projectLength(a,1,k)>=d)k.step=1;else if(e&&n<k.step&&b.projectLength(a,n,k)>=d)k.step=n;else for(;;){if(m&&b.projectLength(a,k.step,k)<=d)k.step*=2;else{if(m||!(b.projectLength(a,k.step/2,k)>=d))break;if(k.step/=2,e&&k.step%1!==0){k.step*=2;break}}if(j++>1e3)throw new Error("Exceeded maximum number of iterations while optimizing scale step!")}var o=2.221e-16;for(k.step=Math.max(k.step,o),h=k.min,i=k.max;h+k.step<=k.low;)h=f(h,k.step);for(;i-k.step>=k.high;)i=f(i,-k.step);k.min=h,k.max=i,k.range=k.max-k.min;var p=[];for(g=k.min;g<=k.max;g=f(g,k.step)){var q=b.roundWithPrecision(g);q!==p[p.length-1]&&p.push(q)}return k.values=p,k},b.polarToCartesian=function(a,b,c,d){var e=(d-90)*Math.PI/180;return{x:a+c*Math.cos(e),y:b+c*Math.sin(e)}},b.createChartRect=function(a,c,d){var e=!(!c.axisX&&!c.axisY),f=e?c.axisY.offset:0,g=e?c.axisX.offset:0,h=a.width()||b.quantity(c.width).value||0,i=a.height()||b.quantity(c.height).value||0,j=b.normalizePadding(c.chartPadding,d);h=Math.max(h,f+j.left+j.right),i=Math.max(i,g+j.top+j.bottom);var k={padding:j,width:function(){return this.x2-this.x1},height:function(){return this.y1-this.y2}};return e?("start"===c.axisX.position?(k.y2=j.top+g,k.y1=Math.max(i-j.bottom,k.y2+1)):(k.y2=j.top,k.y1=Math.max(i-j.bottom-g,k.y2+1)),"start"===c.axisY.position?(k.x1=j.left+f,k.x2=Math.max(h-j.right,k.x1+1)):(k.x1=j.left,k.x2=Math.max(h-j.right-f,k.x1+1))):(k.x1=j.left,k.x2=Math.max(h-j.right,k.x1+1),k.y2=j.top,k.y1=Math.max(i-j.bottom,k.y2+1)),k},b.createGrid=function(a,c,d,e,f,g,h,i){var j={};j[d.units.pos+"1"]=a,j[d.units.pos+"2"]=a,j[d.counterUnits.pos+"1"]=e,j[d.counterUnits.pos+"2"]=e+f;var k=g.elem("line",j,h.join(" "));i.emit("draw",b.extend({type:"grid",axis:d,index:c,group:g,element:k},j))},b.createGridBackground=function(a,b,c,d){var e=a.elem("rect",{x:b.x1,y:b.y2,width:b.width(),height:b.height()},c,!0);d.emit("draw",{type:"gridBackground",group:a,element:e})},b.createLabel=function(a,c,e,f,g,h,i,j,k,l,m){var n,o={};if(o[g.units.pos]=a+i[g.units.pos],o[g.counterUnits.pos]=i[g.counterUnits.pos],o[g.units.len]=c,o[g.counterUnits.len]=Math.max(0,h-10),l){var p=d.createElement("span");p.className=k.join(" "),p.setAttribute("xmlns",b.namespaces.xhtml),p.innerText=f[e],p.style[g.units.len]=Math.round(o[g.units.len])+"px",p.style[g.counterUnits.len]=Math.round(o[g.counterUnits.len])+"px",n=j.foreignObject(p,b.extend({style:"overflow: visible;"},o))}else n=j.elem("text",o,k.join(" ")).text(f[e]);m.emit("draw",b.extend({type:"label",axis:g,index:e,group:j,element:n,text:f[e]},o))},b.getSeriesOption=function(a,b,c){if(a.name&&b.series&&b.series[a.name]){var d=b.series[a.name];return d.hasOwnProperty(c)?d[c]:b[c]}return b[c]},b.optionsProvider=function(a,d,e){function f(a){var f=h;if(h=b.extend({},j),d)for(i=0;i<d.length;i++){var g=c.matchMedia(d[i][0]);g.matches&&(h=b.extend(h,d[i][1]))}e&&a&&e.emit("optionsChanged",{previousOptions:f,currentOptions:h})}function g(){k.forEach(function(a){a.removeListener(f)})}var h,i,j=b.extend({},a),k=[];if(!c.matchMedia)throw"window.matchMedia not found! Make sure you're using a polyfill.";if(d)for(i=0;i<d.length;i++){var l=c.matchMedia(d[i][0]);l.addListener(f),k.push(l)}return f(),{removeMediaQueryListeners:g,getCurrentOptions:function(){return b.extend({},h)}}},b.splitIntoSegments=function(a,c,d){var e={increasingX:!1,fillHoles:!1};d=b.extend({},e,d);for(var f=[],g=!0,h=0;h<a.length;h+=2)void 0===b.getMultiValue(c[h/2].value)?d.fillHoles||(g=!0):(d.increasingX&&h>=2&&a[h]<=a[h-2]&&(g=!0),g&&(f.push({pathCoordinates:[],valueData:[]}),g=!1),f[f.length-1].pathCoordinates.push(a[h],a[h+1]),f[f.length-1].valueData.push(c[h/2]));return f}}(this||global,a),function(a,b){"use strict";b.Interpolation={},b.Interpolation.none=function(a){var c={fillHoles:!1};return a=b.extend({},c,a),function(c,d){for(var e=new b.Svg.Path,f=!0,g=0;g<c.length;g+=2){var h=c[g],i=c[g+1],j=d[g/2];void 0!==b.getMultiValue(j.value)?(f?e.move(h,i,!1,j):e.line(h,i,!1,j),f=!1):a.fillHoles||(f=!0)}return e}},b.Interpolation.simple=function(a){var c={divisor:2,fillHoles:!1};a=b.extend({},c,a);var d=1/Math.max(1,a.divisor);return function(c,e){for(var f,g,h,i=new b.Svg.Path,j=0;j<c.length;j+=2){var k=c[j],l=c[j+1],m=(k-f)*d,n=e[j/2];void 0!==n.value?(void 0===h?i.move(k,l,!1,n):i.curve(f+m,g,k-m,l,k,l,!1,n),f=k,g=l,h=n):a.fillHoles||(f=k=h=void 0)}return i}},b.Interpolation.cardinal=function(a){var c={tension:1,fillHoles:!1};a=b.extend({},c,a);var d=Math.min(1,Math.max(0,a.tension)),e=1-d;return function f(c,g){var h=b.splitIntoSegments(c,g,{fillHoles:a.fillHoles});if(h.length){if(h.length>1){var i=[];return h.forEach(function(a){i.push(f(a.pathCoordinates,a.valueData))}),b.Svg.Path.join(i)}if(c=h[0].pathCoordinates,g=h[0].valueData,c.length<=4)return b.Interpolation.none()(c,g);for(var j,k=(new b.Svg.Path).move(c[0],c[1],!1,g[0]),l=0,m=c.length;m-2*!j>l;l+=2){var n=[{x:+c[l-2],y:+c[l-1]},{x:+c[l],y:+c[l+1]},{x:+c[l+2],y:+c[l+3]},{x:+c[l+4],y:+c[l+5]}];j?l?m-4===l?n[3]={x:+c[0],y:+c[1]}:m-2===l&&(n[2]={x:+c[0],y:+c[1]},n[3]={x:+c[2],y:+c[3]}):n[0]={x:+c[m-2],y:+c[m-1]}:m-4===l?n[3]=n[2]:l||(n[0]={x:+c[l],y:+c[l+1]}),k.curve(d*(-n[0].x+6*n[1].x+n[2].x)/6+e*n[2].x,d*(-n[0].y+6*n[1].y+n[2].y)/6+e*n[2].y,d*(n[1].x+6*n[2].x-n[3].x)/6+e*n[2].x,d*(n[1].y+6*n[2].y-n[3].y)/6+e*n[2].y,n[2].x,n[2].y,!1,g[(l+2)/2])}return k}return b.Interpolation.none()([])}},b.Interpolation.monotoneCubic=function(a){var c={fillHoles:!1};return a=b.extend({},c,a),function d(c,e){var f=b.splitIntoSegments(c,e,{fillHoles:a.fillHoles,increasingX:!0});if(f.length){if(f.length>1){var g=[];return f.forEach(function(a){g.push(d(a.pathCoordinates,a.valueData))}),b.Svg.Path.join(g)}if(c=f[0].pathCoordinates,e=f[0].valueData,c.length<=4)return b.Interpolation.none()(c,e);var h,i,j=[],k=[],l=c.length/2,m=[],n=[],o=[],p=[];for(h=0;h<l;h++)j[h]=c[2*h],k[h]=c[2*h+1];for(h=0;h<l-1;h++)o[h]=k[h+1]-k[h],p[h]=j[h+1]-j[h],n[h]=o[h]/p[h];for(m[0]=n[0],m[l-1]=n[l-2],h=1;h<l-1;h++)0===n[h]||0===n[h-1]||n[h-1]>0!=n[h]>0?m[h]=0:(m[h]=3*(p[h-1]+p[h])/((2*p[h]+p[h-1])/n[h-1]+(p[h]+2*p[h-1])/n[h]),isFinite(m[h])||(m[h]=0));for(i=(new b.Svg.Path).move(j[0],k[0],!1,e[0]),h=0;h<l-1;h++)i.curve(j[h]+p[h]/3,k[h]+m[h]*p[h]/3,j[h+1]-p[h]/3,k[h+1]-m[h+1]*p[h]/3,j[h+1],k[h+1],!1,e[h+1]);return i}return b.Interpolation.none()([])}},b.Interpolation.step=function(a){var c={postpone:!0,fillHoles:!1};return a=b.extend({},c,a),function(c,d){for(var e,f,g,h=new b.Svg.Path,i=0;i<c.length;i+=2){var j=c[i],k=c[i+1],l=d[i/2];void 0!==l.value?(void 0===g?h.move(j,k,!1,l):(a.postpone?h.line(j,f,!1,g):h.line(e,k,!1,l),h.line(j,k,!1,l)),e=j,f=k,g=l):a.fillHoles||(e=f=g=void 0)}return h}}}(this||global,a),function(a,b){"use strict";b.EventEmitter=function(){function a(a,b){d[a]=d[a]||[],d[a].push(b)}function b(a,b){d[a]&&(b?(d[a].splice(d[a].indexOf(b),1),0===d[a].length&&delete d[a]):delete d[a])}function c(a,b){d[a]&&d[a].forEach(function(a){a(b)}),d["*"]&&d["*"].forEach(function(c){c(a,b)})}var d=[];return{addEventHandler:a,removeEventHandler:b,emit:c}}}(this||global,a),function(a,b){"use strict";function c(a){var b=[];if(a.length)for(var c=0;c<a.length;c++)b.push(a[c]);return b}function d(a,c){var d=c||this.prototype||b.Class,e=Object.create(d);b.Class.cloneDefinitions(e,a);var f=function(){var a,c=e.constructor||function(){};return a=this===b?Object.create(e):this,c.apply(a,Array.prototype.slice.call(arguments,0)),a};return f.prototype=e,f["super"]=d,f.extend=this.extend,f}function e(){var a=c(arguments),b=a[0];return a.splice(1,a.length-1).forEach(function(a){Object.getOwnPropertyNames(a).forEach(function(c){delete b[c],Object.defineProperty(b,c,Object.getOwnPropertyDescriptor(a,c))})}),b}b.Class={extend:d,cloneDefinitions:e}}(this||global,a),function(a,b){"use strict";function c(a,c,d){return a&&(this.data=a||{},this.data.labels=this.data.labels||[],this.data.series=this.data.series||[],this.eventEmitter.emit("data",{type:"update",data:this.data})),c&&(this.options=b.extend({},d?this.options:this.defaultOptions,c),this.initializeTimeoutId||(this.optionsProvider.removeMediaQueryListeners(),this.optionsProvider=b.optionsProvider(this.options,this.responsiveOptions,this.eventEmitter))),this.initializeTimeoutId||this.createChart(this.optionsProvider.getCurrentOptions()),this}function d(){return this.initializeTimeoutId?i.clearTimeout(this.initializeTimeoutId):(i.removeEventListener("resize",this.resizeListener),this.optionsProvider.removeMediaQueryListeners()),this}function e(a,b){return this.eventEmitter.addEventHandler(a,b),this}function f(a,b){return this.eventEmitter.removeEventHandler(a,b),this}function g(){i.addEventListener("resize",this.resizeListener),this.optionsProvider=b.optionsProvider(this.options,this.responsiveOptions,this.eventEmitter),this.eventEmitter.addEventHandler("optionsChanged",function(){this.update()}.bind(this)),this.options.plugins&&this.options.plugins.forEach(function(a){a instanceof Array?a[0](this,a[1]):a(this)}.bind(this)),this.eventEmitter.emit("data",{type:"initial",data:this.data}),this.createChart(this.optionsProvider.getCurrentOptions()),this.initializeTimeoutId=void 0}function h(a,c,d,e,f){this.container=b.querySelector(a),this.data=c||{},this.data.labels=this.data.labels||[],this.data.series=this.data.series||[],this.defaultOptions=d,this.options=e,this.responsiveOptions=f,this.eventEmitter=b.EventEmitter(),this.supportsForeignObject=b.Svg.isSupported("Extensibility"),this.supportsAnimations=b.Svg.isSupported("AnimationEventsAttribute"),this.resizeListener=function(){this.update()}.bind(this),this.container&&(this.container.__chartist__&&this.container.__chartist__.detach(),this.container.__chartist__=this),this.initializeTimeoutId=setTimeout(g.bind(this),0)}var i=a.window;b.Base=b.Class.extend({constructor:h,optionsProvider:void 0,container:void 0,svg:void 0,eventEmitter:void 0,createChart:function(){throw new Error("Base chart type can't be instantiated!")},update:c,detach:d,on:e,off:f,version:b.version,supportsForeignObject:!1})}(this||global,a),function(a,b){"use strict";function c(a,c,d,e,f){a instanceof Element?this._node=a:(this._node=y.createElementNS(b.namespaces.svg,a),"svg"===a&&this.attr({"xmlns:ct":b.namespaces.ct})),c&&this.attr(c),d&&this.addClass(d),e&&(f&&e._node.firstChild?e._node.insertBefore(this._node,e._node.firstChild):e._node.appendChild(this._node))}function d(a,c){return"string"==typeof a?c?this._node.getAttributeNS(c,a):this._node.getAttribute(a):(Object.keys(a).forEach(function(c){if(void 0!==a[c])if(c.indexOf(":")!==-1){var d=c.split(":");this._node.setAttributeNS(b.namespaces[d[0]],c,a[c])}else this._node.setAttribute(c,a[c])}.bind(this)),this)}function e(a,c,d,e){return new b.Svg(a,c,d,this,e)}function f(){return this._node.parentNode instanceof SVGElement?new b.Svg(this._node.parentNode):null}function g(){for(var a=this._node;"svg"!==a.nodeName;)a=a.parentNode;return new b.Svg(a)}function h(a){var c=this._node.querySelector(a);return c?new b.Svg(c):null}function i(a){var c=this._node.querySelectorAll(a);return c.length?new b.Svg.List(c):null}function j(){return this._node}function k(a,c,d,e){if("string"==typeof a){var f=y.createElement("div");f.innerHTML=a,a=f.firstChild}a.setAttribute("xmlns",b.namespaces.xmlns);var g=this.elem("foreignObject",c,d,e);return g._node.appendChild(a),g}function l(a){return this._node.appendChild(y.createTextNode(a)),this}function m(){for(;this._node.firstChild;)this._node.removeChild(this._node.firstChild);return this}function n(){return this._node.parentNode.removeChild(this._node),this.parent()}function o(a){return this._node.parentNode.replaceChild(a._node,this._node),a}function p(a,b){return b&&this._node.firstChild?this._node.insertBefore(a._node,this._node.firstChild):this._node.appendChild(a._node),this}function q(){return this._node.getAttribute("class")?this._node.getAttribute("class").trim().split(/\s+/):[]}function r(a){return this._node.setAttribute("class",this.classes(this._node).concat(a.trim().split(/\s+/)).filter(function(a,b,c){return c.indexOf(a)===b}).join(" ")),this}function s(a){var b=a.trim().split(/\s+/);return this._node.setAttribute("class",this.classes(this._node).filter(function(a){return b.indexOf(a)===-1}).join(" ")),this}function t(){return this._node.setAttribute("class",""),this}function u(){return this._node.getBoundingClientRect().height}function v(){return this._node.getBoundingClientRect().width}function w(a,c,d){return void 0===c&&(c=!0),Object.keys(a).forEach(function(e){function f(a,c){var f,g,h,i={};a.easing&&(h=a.easing instanceof Array?a.easing:b.Svg.Easing[a.easing],delete a.easing),a.begin=b.ensureUnit(a.begin,"ms"),a.dur=b.ensureUnit(a.dur,"ms"),h&&(a.calcMode="spline",a.keySplines=h.join(" "),a.keyTimes="0;1"),c&&(a.fill="freeze",i[e]=a.from,this.attr(i),g=b.quantity(a.begin||0).value,a.begin="indefinite"),f=this.elem("animate",b.extend({attributeName:e},a)),c&&setTimeout(function(){try{f._node.beginElement()}catch(b){i[e]=a.to,this.attr(i),f.remove()}}.bind(this),g),d&&f._node.addEventListener("beginEvent",function(){d.emit("animationBegin",{element:this,animate:f._node,params:a})}.bind(this)),f._node.addEventListener("endEvent",function(){d&&d.emit("animationEnd",{element:this,animate:f._node,params:a}),c&&(i[e]=a.to,this.attr(i),f.remove())}.bind(this))}a[e]instanceof Array?a[e].forEach(function(a){f.bind(this)(a,!1)}.bind(this)):f.bind(this)(a[e],c)}.bind(this)),this}function x(a){var c=this;this.svgElements=[];for(var d=0;d<a.length;d++)this.svgElements.push(new b.Svg(a[d]));Object.keys(b.Svg.prototype).filter(function(a){return["constructor","parent","querySelector","querySelectorAll","replace","append","classes","height","width"].indexOf(a)===-1}).forEach(function(a){c[a]=function(){var d=Array.prototype.slice.call(arguments,0);return c.svgElements.forEach(function(c){b.Svg.prototype[a].apply(c,d)}),c}})}var y=a.document;b.Svg=b.Class.extend({constructor:c,attr:d,elem:e,parent:f,root:g,querySelector:h,querySelectorAll:i,getNode:j,foreignObject:k,text:l,empty:m,remove:n,replace:o,append:p,classes:q,addClass:r,removeClass:s,removeAllClasses:t,height:u,width:v,animate:w}),b.Svg.isSupported=function(a){return y.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#"+a,"1.1")};var z={easeInSine:[.47,0,.745,.715],easeOutSine:[.39,.575,.565,1],easeInOutSine:[.445,.05,.55,.95],easeInQuad:[.55,.085,.68,.53],easeOutQuad:[.25,.46,.45,.94],easeInOutQuad:[.455,.03,.515,.955],easeInCubic:[.55,.055,.675,.19],easeOutCubic:[.215,.61,.355,1],easeInOutCubic:[.645,.045,.355,1],easeInQuart:[.895,.03,.685,.22],easeOutQuart:[.165,.84,.44,1],easeInOutQuart:[.77,0,.175,1],easeInQuint:[.755,.05,.855,.06],easeOutQuint:[.23,1,.32,1],easeInOutQuint:[.86,0,.07,1],easeInExpo:[.95,.05,.795,.035],easeOutExpo:[.19,1,.22,1],easeInOutExpo:[1,0,0,1],easeInCirc:[.6,.04,.98,.335],easeOutCirc:[.075,.82,.165,1],easeInOutCirc:[.785,.135,.15,.86],easeInBack:[.6,-.28,.735,.045],easeOutBack:[.175,.885,.32,1.275],easeInOutBack:[.68,-.55,.265,1.55]};b.Svg.Easing=z,b.Svg.List=b.Class.extend({constructor:x})}(this||global,a),function(a,b){"use strict";function c(a,c,d,e,f,g){var h=b.extend({command:f?a.toLowerCase():a.toUpperCase()},c,g?{data:g}:{});d.splice(e,0,h)}function d(a,b){a.forEach(function(c,d){t[c.command.toLowerCase()].forEach(function(e,f){b(c,e,d,f,a)})})}function e(a,c){this.pathElements=[],this.pos=0,this.close=a,this.options=b.extend({},u,c)}function f(a){return void 0!==a?(this.pos=Math.max(0,Math.min(this.pathElements.length,a)),this):this.pos}function g(a){return this.pathElements.splice(this.pos,a),this}function h(a,b,d,e){return c("M",{x:+a,y:+b},this.pathElements,this.pos++,d,e),this}function i(a,b,d,e){return c("L",{x:+a,y:+b},this.pathElements,this.pos++,d,e),this}function j(a,b,d,e,f,g,h,i){return c("C",{x1:+a,y1:+b,x2:+d,y2:+e,x:+f,y:+g},this.pathElements,this.pos++,h,i),this}function k(a,b,d,e,f,g,h,i,j){return c("A",{rx:+a,ry:+b,xAr:+d,lAf:+e,sf:+f,x:+g,y:+h},this.pathElements,this.pos++,i,j),this}function l(a){var c=a.replace(/([A-Za-z])([0-9])/g,"$1 $2").replace(/([0-9])([A-Za-z])/g,"$1 $2").split(/[\s,]+/).reduce(function(a,b){return b.match(/[A-Za-z]/)&&a.push([]),a[a.length-1].push(b),a},[]);"Z"===c[c.length-1][0].toUpperCase()&&c.pop();var d=c.map(function(a){var c=a.shift(),d=t[c.toLowerCase()];return b.extend({command:c},d.reduce(function(b,c,d){return b[c]=+a[d],b},{}))}),e=[this.pos,0];return Array.prototype.push.apply(e,d),Array.prototype.splice.apply(this.pathElements,e),this.pos+=d.length,this}function m(){var a=Math.pow(10,this.options.accuracy);return this.pathElements.reduce(function(b,c){var d=t[c.command.toLowerCase()].map(function(b){return this.options.accuracy?Math.round(c[b]*a)/a:c[b]}.bind(this));return b+c.command+d.join(",")}.bind(this),"")+(this.close?"Z":"")}function n(a,b){return d(this.pathElements,function(c,d){c[d]*="x"===d[0]?a:b}),this}function o(a,b){return d(this.pathElements,function(c,d){c[d]+="x"===d[0]?a:b}),this}function p(a){return d(this.pathElements,function(b,c,d,e,f){var g=a(b,c,d,e,f);(g||0===g)&&(b[c]=g)}),this}function q(a){var c=new b.Svg.Path(a||this.close);return c.pos=this.pos,c.pathElements=this.pathElements.slice().map(function(a){return b.extend({},a)}),c.options=b.extend({},this.options),c}function r(a){var c=[new b.Svg.Path];return this.pathElements.forEach(function(d){d.command===a.toUpperCase()&&0!==c[c.length-1].pathElements.length&&c.push(new b.Svg.Path),c[c.length-1].pathElements.push(d)}),c}function s(a,c,d){for(var e=new b.Svg.Path(c,d),f=0;f<a.length;f++)for(var g=a[f],h=0;h<g.pathElements.length;h++)e.pathElements.push(g.pathElements[h]);return e}var t={m:["x","y"],l:["x","y"],c:["x1","y1","x2","y2","x","y"],a:["rx","ry","xAr","lAf","sf","x","y"]},u={accuracy:3};b.Svg.Path=b.Class.extend({constructor:e,position:f,remove:g,move:h,line:i,curve:j,arc:k,scale:n,translate:o,transform:p,parse:l,stringify:m,clone:q,splitByCommand:r}),b.Svg.Path.elementDescriptions=t,b.Svg.Path.join=s}(this||global,a),function(a,b){"use strict";function c(a,b,c,d){this.units=a,this.counterUnits=a===e.x?e.y:e.x,this.chartRect=b,this.axisLength=b[a.rectEnd]-b[a.rectStart],this.gridOffset=b[a.rectOffset],this.ticks=c,this.options=d}function d(a,c,d,e,f){var g=e["axis"+this.units.pos.toUpperCase()],h=this.ticks.map(this.projectValue.bind(this)),i=this.ticks.map(g.labelInterpolationFnc);h.forEach(function(j,k){var l,m={x:0,y:0};l=h[k+1]?h[k+1]-j:Math.max(this.axisLength-j,30),b.isFalseyButZero(i[k])&&""!==i[k]||("x"===this.units.pos?(j=this.chartRect.x1+j,m.x=e.axisX.labelOffset.x,"start"===e.axisX.position?m.y=this.chartRect.padding.top+e.axisX.labelOffset.y+(d?5:20):m.y=this.chartRect.y1+e.axisX.labelOffset.y+(d?5:20)):(j=this.chartRect.y1-j,m.y=e.axisY.labelOffset.y-(d?l:0),"start"===e.axisY.position?m.x=d?this.chartRect.padding.left+e.axisY.labelOffset.x:this.chartRect.x1-10:m.x=this.chartRect.x2+e.axisY.labelOffset.x+10),g.showGrid&&b.createGrid(j,k,this,this.gridOffset,this.chartRect[this.counterUnits.len](),a,[e.classNames.grid,e.classNames[this.units.dir]],f),g.showLabel&&b.createLabel(j,l,k,i,this,g.offset,m,c,[e.classNames.label,e.classNames[this.units.dir],"start"===g.position?e.classNames[g.position]:e.classNames.end],d,f))}.bind(this))}var e=(a.window,a.document,{x:{pos:"x",len:"width",dir:"horizontal",rectStart:"x1",rectEnd:"x2",rectOffset:"y2"},y:{pos:"y",len:"height",dir:"vertical",rectStart:"y2",rectEnd:"y1",rectOffset:"x1"}});b.Axis=b.Class.extend({constructor:c,createGridAndLabels:d,projectValue:function(a,b,c){throw new Error("Base axis can't be instantiated!")}}),b.Axis.units=e}(this||global,a),function(a,b){"use strict";function c(a,c,d,e){var f=e.highLow||b.getHighLow(c,e,a.pos);this.bounds=b.getBounds(d[a.rectEnd]-d[a.rectStart],f,e.scaleMinSpace||20,e.onlyInteger),this.range={min:this.bounds.min,max:this.bounds.max},b.AutoScaleAxis["super"].constructor.call(this,a,d,this.bounds.values,e)}function d(a){return this.axisLength*(+b.getMultiValue(a,this.units.pos)-this.bounds.min)/this.bounds.range}a.window,a.document;b.AutoScaleAxis=b.Axis.extend({constructor:c,projectValue:d})}(this||global,a),function(a,b){"use strict";function c(a,c,d,e){var f=e.highLow||b.getHighLow(c,e,a.pos);this.divisor=e.divisor||1,this.ticks=e.ticks||b.times(this.divisor).map(function(a,b){return f.low+(f.high-f.low)/this.divisor*b}.bind(this)),this.ticks.sort(function(a,b){return a-b}),this.range={min:f.low,max:f.high},b.FixedScaleAxis["super"].constructor.call(this,a,d,this.ticks,e),this.stepLength=this.axisLength/this.divisor}function d(a){return this.axisLength*(+b.getMultiValue(a,this.units.pos)-this.range.min)/(this.range.max-this.range.min)}a.window,a.document;b.FixedScaleAxis=b.Axis.extend({constructor:c,projectValue:d})}(this||global,a),function(a,b){"use strict";function c(a,c,d,e){b.StepAxis["super"].constructor.call(this,a,d,e.ticks,e);var f=Math.max(1,e.ticks.length-(e.stretch?1:0));this.stepLength=this.axisLength/f}function d(a,b){return this.stepLength*b}a.window,a.document;b.StepAxis=b.Axis.extend({constructor:c,projectValue:d})}(this||global,a),function(a,b){"use strict";function c(a){var c=b.normalizeData(this.data,a.reverseData,!0);this.svg=b.createSvg(this.container,a.width,a.height,a.classNames.chart);var d,f,g=this.svg.elem("g").addClass(a.classNames.gridGroup),h=this.svg.elem("g"),i=this.svg.elem("g").addClass(a.classNames.labelGroup),j=b.createChartRect(this.svg,a,e.padding);d=void 0===a.axisX.type?new b.StepAxis(b.Axis.units.x,c.normalized.series,j,b.extend({},a.axisX,{ticks:c.normalized.labels,stretch:a.fullWidth})):a.axisX.type.call(b,b.Axis.units.x,c.normalized.series,j,a.axisX),f=void 0===a.axisY.type?new b.AutoScaleAxis(b.Axis.units.y,c.normalized.series,j,b.extend({},a.axisY,{high:b.isNumeric(a.high)?a.high:a.axisY.high,low:b.isNumeric(a.low)?a.low:a.axisY.low})):a.axisY.type.call(b,b.Axis.units.y,c.normalized.series,j,a.axisY),d.createGridAndLabels(g,i,this.supportsForeignObject,a,this.eventEmitter),f.createGridAndLabels(g,i,this.supportsForeignObject,a,this.eventEmitter),a.showGridBackground&&b.createGridBackground(g,j,a.classNames.gridBackground,this.eventEmitter),c.raw.series.forEach(function(e,g){var i=h.elem("g");i.attr({"ct:series-name":e.name,"ct:meta":b.serialize(e.meta)}),i.addClass([a.classNames.series,e.className||a.classNames.series+"-"+b.alphaNumerate(g)].join(" "));var k=[],l=[];c.normalized.series[g].forEach(function(a,h){var i={x:j.x1+d.projectValue(a,h,c.normalized.series[g]),y:j.y1-f.projectValue(a,h,c.normalized.series[g])};k.push(i.x,i.y),l.push({value:a,valueIndex:h,meta:b.getMetaData(e,h)})}.bind(this));var m={lineSmooth:b.getSeriesOption(e,a,"lineSmooth"),showPoint:b.getSeriesOption(e,a,"showPoint"),showLine:b.getSeriesOption(e,a,"showLine"),showArea:b.getSeriesOption(e,a,"showArea"),areaBase:b.getSeriesOption(e,a,"areaBase")},n="function"==typeof m.lineSmooth?m.lineSmooth:m.lineSmooth?b.Interpolation.monotoneCubic():b.Interpolation.none(),o=n(k,l);if(m.showPoint&&o.pathElements.forEach(function(c){var h=i.elem("line",{x1:c.x,y1:c.y,x2:c.x+.01,y2:c.y},a.classNames.point).attr({"ct:value":[c.data.value.x,c.data.value.y].filter(b.isNumeric).join(","),"ct:meta":b.serialize(c.data.meta)});this.eventEmitter.emit("draw",{type:"point",value:c.data.value,index:c.data.valueIndex,meta:c.data.meta,series:e,seriesIndex:g,axisX:d,axisY:f,group:i,element:h,x:c.x,y:c.y})}.bind(this)),m.showLine){var p=i.elem("path",{d:o.stringify()},a.classNames.line,!0);this.eventEmitter.emit("draw",{type:"line",values:c.normalized.series[g],path:o.clone(),chartRect:j,index:g,series:e,seriesIndex:g,seriesMeta:e.meta,axisX:d,axisY:f,group:i,element:p})}if(m.showArea&&f.range){var q=Math.max(Math.min(m.areaBase,f.range.max),f.range.min),r=j.y1-f.projectValue(q);o.splitByCommand("M").filter(function(a){return a.pathElements.length>1}).map(function(a){var b=a.pathElements[0],c=a.pathElements[a.pathElements.length-1];return a.clone(!0).position(0).remove(1).move(b.x,r).line(b.x,b.y).position(a.pathElements.length+1).line(c.x,r)}).forEach(function(b){var h=i.elem("path",{d:b.stringify()},a.classNames.area,!0);this.eventEmitter.emit("draw",{type:"area",values:c.normalized.series[g],path:b.clone(),series:e,seriesIndex:g,axisX:d,axisY:f,chartRect:j,index:g,group:i,element:h})}.bind(this))}}.bind(this)),this.eventEmitter.emit("created",{bounds:f.bounds,chartRect:j,axisX:d,axisY:f,svg:this.svg,options:a})}function d(a,c,d,f){b.Line["super"].constructor.call(this,a,c,e,b.extend({},e,d),f)}var e=(a.window,a.document,{axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:b.noop,type:void 0},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:b.noop,type:void 0,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,showLine:!0,showPoint:!0,showArea:!1,areaBase:0,lineSmooth:!0,showGridBackground:!1,low:void 0,high:void 0,chartPadding:{top:15,right:15,bottom:5,left:10},fullWidth:!1,reverseData:!1,classNames:{chart:"ct-chart-line",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",line:"ct-line",point:"ct-point",area:"ct-area",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}});b.Line=b.Base.extend({constructor:d,createChart:c})}(this||global,a),function(a,b){"use strict";function c(a){var c,d;a.distributeSeries?(c=b.normalizeData(this.data,a.reverseData,a.horizontalBars?"x":"y"),c.normalized.series=c.normalized.series.map(function(a){return[a]})):c=b.normalizeData(this.data,a.reverseData,a.horizontalBars?"x":"y"),this.svg=b.createSvg(this.container,a.width,a.height,a.classNames.chart+(a.horizontalBars?" "+a.classNames.horizontalBars:""));var f=this.svg.elem("g").addClass(a.classNames.gridGroup),g=this.svg.elem("g"),h=this.svg.elem("g").addClass(a.classNames.labelGroup);
9
+ if(a.stackBars&&0!==c.normalized.series.length){var i=b.serialMap(c.normalized.series,function(){return Array.prototype.slice.call(arguments).map(function(a){return a}).reduce(function(a,b){return{x:a.x+(b&&b.x)||0,y:a.y+(b&&b.y)||0}},{x:0,y:0})});d=b.getHighLow([i],a,a.horizontalBars?"x":"y")}else d=b.getHighLow(c.normalized.series,a,a.horizontalBars?"x":"y");d.high=+a.high||(0===a.high?0:d.high),d.low=+a.low||(0===a.low?0:d.low);var j,k,l,m,n,o=b.createChartRect(this.svg,a,e.padding);k=a.distributeSeries&&a.stackBars?c.normalized.labels.slice(0,1):c.normalized.labels,a.horizontalBars?(j=m=void 0===a.axisX.type?new b.AutoScaleAxis(b.Axis.units.x,c.normalized.series,o,b.extend({},a.axisX,{highLow:d,referenceValue:0})):a.axisX.type.call(b,b.Axis.units.x,c.normalized.series,o,b.extend({},a.axisX,{highLow:d,referenceValue:0})),l=n=void 0===a.axisY.type?new b.StepAxis(b.Axis.units.y,c.normalized.series,o,{ticks:k}):a.axisY.type.call(b,b.Axis.units.y,c.normalized.series,o,a.axisY)):(l=m=void 0===a.axisX.type?new b.StepAxis(b.Axis.units.x,c.normalized.series,o,{ticks:k}):a.axisX.type.call(b,b.Axis.units.x,c.normalized.series,o,a.axisX),j=n=void 0===a.axisY.type?new b.AutoScaleAxis(b.Axis.units.y,c.normalized.series,o,b.extend({},a.axisY,{highLow:d,referenceValue:0})):a.axisY.type.call(b,b.Axis.units.y,c.normalized.series,o,b.extend({},a.axisY,{highLow:d,referenceValue:0})));var p=a.horizontalBars?o.x1+j.projectValue(0):o.y1-j.projectValue(0),q=[];l.createGridAndLabels(f,h,this.supportsForeignObject,a,this.eventEmitter),j.createGridAndLabels(f,h,this.supportsForeignObject,a,this.eventEmitter),a.showGridBackground&&b.createGridBackground(f,o,a.classNames.gridBackground,this.eventEmitter),c.raw.series.forEach(function(d,e){var f,h,i=e-(c.raw.series.length-1)/2;f=a.distributeSeries&&!a.stackBars?l.axisLength/c.normalized.series.length/2:a.distributeSeries&&a.stackBars?l.axisLength/2:l.axisLength/c.normalized.series[e].length/2,h=g.elem("g"),h.attr({"ct:series-name":d.name,"ct:meta":b.serialize(d.meta)}),h.addClass([a.classNames.series,d.className||a.classNames.series+"-"+b.alphaNumerate(e)].join(" ")),c.normalized.series[e].forEach(function(g,k){var r,s,t,u;if(u=a.distributeSeries&&!a.stackBars?e:a.distributeSeries&&a.stackBars?0:k,r=a.horizontalBars?{x:o.x1+j.projectValue(g&&g.x?g.x:0,k,c.normalized.series[e]),y:o.y1-l.projectValue(g&&g.y?g.y:0,u,c.normalized.series[e])}:{x:o.x1+l.projectValue(g&&g.x?g.x:0,u,c.normalized.series[e]),y:o.y1-j.projectValue(g&&g.y?g.y:0,k,c.normalized.series[e])},l instanceof b.StepAxis&&(l.options.stretch||(r[l.units.pos]+=f*(a.horizontalBars?-1:1)),r[l.units.pos]+=a.stackBars||a.distributeSeries?0:i*a.seriesBarDistance*(a.horizontalBars?-1:1)),t=q[k]||p,q[k]=t-(p-r[l.counterUnits.pos]),void 0!==g){var v={};v[l.units.pos+"1"]=r[l.units.pos],v[l.units.pos+"2"]=r[l.units.pos],!a.stackBars||"accumulate"!==a.stackMode&&a.stackMode?(v[l.counterUnits.pos+"1"]=p,v[l.counterUnits.pos+"2"]=r[l.counterUnits.pos]):(v[l.counterUnits.pos+"1"]=t,v[l.counterUnits.pos+"2"]=q[k]),v.x1=Math.min(Math.max(v.x1,o.x1),o.x2),v.x2=Math.min(Math.max(v.x2,o.x1),o.x2),v.y1=Math.min(Math.max(v.y1,o.y2),o.y1),v.y2=Math.min(Math.max(v.y2,o.y2),o.y1);var w=b.getMetaData(d,k);s=h.elem("line",v,a.classNames.bar).attr({"ct:value":[g.x,g.y].filter(b.isNumeric).join(","),"ct:meta":b.serialize(w)}),this.eventEmitter.emit("draw",b.extend({type:"bar",value:g,index:k,meta:w,series:d,seriesIndex:e,axisX:m,axisY:n,chartRect:o,group:h,element:s},v))}}.bind(this))}.bind(this)),this.eventEmitter.emit("created",{bounds:j.bounds,chartRect:o,axisX:m,axisY:n,svg:this.svg,options:a})}function d(a,c,d,f){b.Bar["super"].constructor.call(this,a,c,e,b.extend({},e,d),f)}var e=(a.window,a.document,{axisX:{offset:30,position:"end",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:b.noop,scaleMinSpace:30,onlyInteger:!1},axisY:{offset:40,position:"start",labelOffset:{x:0,y:0},showLabel:!0,showGrid:!0,labelInterpolationFnc:b.noop,scaleMinSpace:20,onlyInteger:!1},width:void 0,height:void 0,high:void 0,low:void 0,referenceValue:0,chartPadding:{top:15,right:15,bottom:5,left:10},seriesBarDistance:15,stackBars:!1,stackMode:"accumulate",horizontalBars:!1,distributeSeries:!1,reverseData:!1,showGridBackground:!1,classNames:{chart:"ct-chart-bar",horizontalBars:"ct-horizontal-bars",label:"ct-label",labelGroup:"ct-labels",series:"ct-series",bar:"ct-bar",grid:"ct-grid",gridGroup:"ct-grids",gridBackground:"ct-grid-background",vertical:"ct-vertical",horizontal:"ct-horizontal",start:"ct-start",end:"ct-end"}});b.Bar=b.Base.extend({constructor:d,createChart:c})}(this||global,a),function(a,b){"use strict";function c(a,b,c){var d=b.x>a.x;return d&&"explode"===c||!d&&"implode"===c?"start":d&&"implode"===c||!d&&"explode"===c?"end":"middle"}function d(a){var d,e,g,h,i,j=b.normalizeData(this.data),k=[],l=a.startAngle;this.svg=b.createSvg(this.container,a.width,a.height,a.donut?a.classNames.chartDonut:a.classNames.chartPie),e=b.createChartRect(this.svg,a,f.padding),g=Math.min(e.width()/2,e.height()/2),i=a.total||j.normalized.series.reduce(function(a,b){return a+b},0);var m=b.quantity(a.donutWidth);"%"===m.unit&&(m.value*=g/100),g-=a.donut&&!a.donutSolid?m.value/2:0,h="outside"===a.labelPosition||a.donut&&!a.donutSolid?g:"center"===a.labelPosition?0:a.donutSolid?g-m.value/2:g/2,h+=a.labelOffset;var n={x:e.x1+e.width()/2,y:e.y2+e.height()/2},o=1===j.raw.series.filter(function(a){return a.hasOwnProperty("value")?0!==a.value:0!==a}).length;j.raw.series.forEach(function(a,b){k[b]=this.svg.elem("g",null,null)}.bind(this)),a.showLabel&&(d=this.svg.elem("g",null,null)),j.raw.series.forEach(function(e,f){if(0!==j.normalized.series[f]||!a.ignoreEmptyValues){k[f].attr({"ct:series-name":e.name}),k[f].addClass([a.classNames.series,e.className||a.classNames.series+"-"+b.alphaNumerate(f)].join(" "));var p=i>0?l+j.normalized.series[f]/i*360:0,q=Math.max(0,l-(0===f||o?0:.2));p-q>=359.99&&(p=q+359.99);var r,s,t,u=b.polarToCartesian(n.x,n.y,g,q),v=b.polarToCartesian(n.x,n.y,g,p),w=new b.Svg.Path(!a.donut||a.donutSolid).move(v.x,v.y).arc(g,g,0,p-l>180,0,u.x,u.y);a.donut?a.donutSolid&&(t=g-m.value,r=b.polarToCartesian(n.x,n.y,t,l-(0===f||o?0:.2)),s=b.polarToCartesian(n.x,n.y,t,p),w.line(r.x,r.y),w.arc(t,t,0,p-l>180,1,s.x,s.y)):w.line(n.x,n.y);var x=a.classNames.slicePie;a.donut&&(x=a.classNames.sliceDonut,a.donutSolid&&(x=a.classNames.sliceDonutSolid));var y=k[f].elem("path",{d:w.stringify()},x);if(y.attr({"ct:value":j.normalized.series[f],"ct:meta":b.serialize(e.meta)}),a.donut&&!a.donutSolid&&(y._node.style.strokeWidth=m.value+"px"),this.eventEmitter.emit("draw",{type:"slice",value:j.normalized.series[f],totalDataSum:i,index:f,meta:e.meta,series:e,group:k[f],element:y,path:w.clone(),center:n,radius:g,startAngle:l,endAngle:p}),a.showLabel){var z;z=1===j.raw.series.length?{x:n.x,y:n.y}:b.polarToCartesian(n.x,n.y,h,l+(p-l)/2);var A;A=j.normalized.labels&&!b.isFalseyButZero(j.normalized.labels[f])?j.normalized.labels[f]:j.normalized.series[f];var B=a.labelInterpolationFnc(A,f);if(B||0===B){var C=d.elem("text",{dx:z.x,dy:z.y,"text-anchor":c(n,z,a.labelDirection)},a.classNames.label).text(""+B);this.eventEmitter.emit("draw",{type:"label",index:f,group:d,element:C,text:""+B,x:z.x,y:z.y})}}l=p}}.bind(this)),this.eventEmitter.emit("created",{chartRect:e,svg:this.svg,options:a})}function e(a,c,d,e){b.Pie["super"].constructor.call(this,a,c,f,b.extend({},f,d),e)}var f=(a.window,a.document,{width:void 0,height:void 0,chartPadding:5,classNames:{chartPie:"ct-chart-pie",chartDonut:"ct-chart-donut",series:"ct-series",slicePie:"ct-slice-pie",sliceDonut:"ct-slice-donut",sliceDonutSolid:"ct-slice-donut-solid",label:"ct-label"},startAngle:0,total:void 0,donut:!1,donutSolid:!1,donutWidth:60,showLabel:!0,labelOffset:0,labelPosition:"inside",labelInterpolationFnc:b.noop,labelDirection:"neutral",reverseData:!1,ignoreEmptyValues:!1});b.Pie=b.Base.extend({constructor:e,createChart:d,determineAnchorPosition:c})}(this||global,a),a});
10
  //# sourceMappingURL=chartist.min.js.map
js/chartist.min.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["chartist.js"],"names":["root","factory","define","amd","module","exports","this","Chartist","version","window","document","namespaces","svg","xmlns","xhtml","xlink","ct","noop","n","alphaNumerate","String","fromCharCode","extend","target","i","source","sourceProp","arguments","length","prop","Array","replaceAll","str","subStr","newSubStr","replace","RegExp","ensureUnit","value","unit","quantity","input","match","exec","undefined","querySelector","query","Node","times","apply","sum","previous","current","mapMultiply","factor","num","mapAdd","addend","serialMap","arr","cb","result","Math","max","map","e","forEach","index","args","roundWithPrecision","digits","precision","pow","round","escapingMap","&","<",">","\"","'","serialize","data","JSON","stringify","Object","keys","reduce","key","deserialize","parse","createSvg","container","width","height","className","prototype","slice","call","querySelectorAll","filter","getAttributeNS","removeChild","Svg","attr","addClass","_node","style","appendChild","normalizeData","reverse","multi","labelCount","output","raw","normalized","series","getDataArray","every","labels","push","reverseData","safeHasProperty","object","property","hasOwnProperty","isDataHoleValue","isNaN","recursiveConvert","multiValue","getNumberOrUndefined","y","x","normalizePadding","padding","fallback","top","right","bottom","left","getMetaData","meta","orderOfMagnitude","floor","log","abs","LN10","projectLength","axisLength","bounds","range","getAvailableHeight","options","chartPadding","axisX","offset","getHighLow","dimension","recursiveHighLow","findHigh","highLow","high","findLow","low","toUpperCase","Number","MAX_VALUE","referenceValue","min","isNumeric","isFinite","isFalseyButZero","isMultiValue","getMultiValue","rho","gcd","p","q","f","divisor","x1","x2","getBounds","scaleMinSpace","onlyInteger","safeIncrement","increment","EPSILON","newMin","newMax","optimizationCounter","valueRange","oom","step","ceil","numberOfSteps","scaleUp","smallestFactor","Error","values","polarToCartesian","centerX","centerY","radius","angleInDegrees","angleInRadians","PI","cos","sin","createChartRect","fallbackPadding","hasAxis","axisY","yAxisOffset","xAxisOffset","normalizedPadding","chartRect","y1","y2","position","createGrid","axis","group","classes","eventEmitter","positionalData","units","pos","counterUnits","gridElement","elem","join","emit","type","element","createGridBackground","gridGroup","gridBackground","createLabel","axisOffset","labelOffset","useForeignObject","labelElement","len","content","createElement","setAttribute","innerText","foreignObject","text","getSeriesOption","name","seriesOptions","optionsProvider","responsiveOptions","updateCurrentOptions","mediaEvent","previousOptions","currentOptions","baseOptions","mql","matchMedia","matches","removeMediaQueryListeners","mediaQueryListeners","removeListener","addListener","getCurrentOptions","splitIntoSegments","pathCoordinates","valueData","defaultOptions","increasingX","fillHoles","segments","hole","Interpolation","none","path","Path","currX","currY","currData","move","line","simple","d","prevX","prevY","prevData","curve","cardinal","tension","t","c","paths","segment","z","iLen","monotoneCubic","xs","ys","ms","ds","dys","dxs","postpone","EventEmitter","addEventHandler","event","handler","handlers","removeEventHandler","splice","indexOf","starHandler","listToArray","list","properties","superProtoOverride","superProto","Class","proto","create","cloneDefinitions","constr","instance","fn","constructor","getOwnPropertyNames","propName","defineProperty","getOwnPropertyDescriptor","update","override","initializeTimeoutId","createChart","detach","clearTimeout","removeEventListener","resizeListener","on","off","initialize","addEventListener","bind","plugins","plugin","Base","supportsForeignObject","isSupported","supportsAnimations","__chartist__","setTimeout","attributes","parent","insertFirst","Element","createElementNS","xmlns:ct","firstChild","insertBefore","ns","getAttribute","namespacedAttribute","split","setAttributeNS","parentNode","SVGElement","node","nodeName","selector","foundNode","foundNodes","List","getNode","innerHTML","fnObj","createTextNode","empty","remove","newElement","replaceChild","append","trim","names","concat","self","removeClass","removedClasses","removeAllClasses","getBoundingClientRect","animate","animations","guided","attribute","createAnimate","animationDefinition","timeout","easing","attributeProperties","Easing","begin","dur","calcMode","keySplines","keyTimes","fill","from","attributeName","beginElement","err","to","params","SvgList","nodeList","svgElements","prototypeProperty","feature","implementation","hasFeature","easingCubicBeziers","easeInSine","easeOutSine","easeInOutSine","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInQuint","easeOutQuint","easeInOutQuint","easeInExpo","easeOutExpo","easeInOutExpo","easeInCirc","easeOutCirc","easeInOutCirc","easeInBack","easeOutBack","easeInOutBack","command","pathElements","relative","pathElement","toLowerCase","forEachParam","pathElementIndex","elementDescriptions","paramName","paramIndex","SvgPath","close","count","arc","rx","ry","xAr","lAf","sf","chunks","pop","elements","chunk","shift","description","spliceArgs","accuracyMultiplier","accuracy","scale","translate","transform","transformFnc","transformed","clone","splitByCommand","joinedPath","j","m","l","a","Axis","ticks","axisUnits","rectEnd","rectStart","gridOffset","rectOffset","createGridAndLabels","labelGroup","chartOptions","axisOptions","projectedValues","projectValue","labelValues","labelInterpolationFnc","projectedValue","labelLength","showGrid","classNames","grid","dir","showLabel","label","AutoScaleAxis","axisUnit","FixedScaleAxis","sort","b","stepLength","StepAxis","calc","stretch","chart","seriesGroup","fullWidth","showGridBackground","seriesIndex","seriesElement","ct:series-name","ct:meta","pathData","valueIndex","lineSmooth","showPoint","showLine","showArea","areaBase","smoothing","point","ct:value","seriesMeta","areaBaseProjected","pathSegment","solidPathSegments","firstElement","lastElement","areaPath","area","Line","vertical","horizontal","start","end","distributeSeries","horizontalBars","stackBars","serialSums","prev","curr","valueAxis","labelAxisTicks","labelAxis","zeroPoint","stackedBarValues","periodHalfLength","biPol","projected","bar","previousStack","labelAxisValueIndex","seriesBarDistance","positions","stackMode","metaData","Bar","determineAnchorPosition","center","direction","toTheRight","labelsGroup","labelRadius","totalDataSum","seriesGroups","startAngle","donut","chartDonut","chartPie","total","previousValue","currentValue","donutWidth","donutSolid","labelPosition","hasSingleValInSeries","val","ignoreEmptyValues","endAngle","overlappigStartAngle","innerStart","innerEnd","donutSolidRadius","pathClassName","slicePie","sliceDonut","sliceDonutSolid","strokeWidth","rawValue","interpolatedValue","dx","dy","text-anchor","labelDirection","Pie"],"mappings":";;;;;;;CAAC,SAAUA,EAAMC,GACO,kBAAXC,SAAyBA,OAAOC,IAEzCD,OAAO,cAAgB,WACrB,MAAQF,GAAe,SAAIC,MAEF,gBAAXG,SAAuBA,OAAOC,QAI9CD,OAAOC,QAAUJ,IAEjBD,EAAe,SAAIC,KAErBK,KAAM,WAaR,GAAIC,IACFC,QAAS,SAy2IX,OAt2IC,UAAUC,EAAQC,EAAUH,GAC3B,YAQAA,GAASI,YACPC,IAAK,6BACLC,MAAO,gCACPC,MAAO,+BACPC,MAAO,+BACPC,GAAI,6CAUNT,EAASU,KAAO,SAAUC,GACxB,MAAOA,IAUTX,EAASY,cAAgB,SAAUD,GAEjC,MAAOE,QAAOC,aAAa,GAAKH,EAAI,KAWtCX,EAASe,OAAS,SAAUC,GAC1B,GAAIC,GAAGC,EAAQC,CAGf,KAFAH,EAASA,MAEJC,EAAI,EAAGA,EAAIG,UAAUC,OAAQJ,IAAK,CACrCC,EAASE,UAAUH,EACnB,KAAK,GAAIK,KAAQJ,GACfC,EAAaD,EAAOI,GACM,gBAAfH,IAA0C,OAAfA,GAAyBA,YAAsBI,OAGnFP,EAAOM,GAAQH,EAFfH,EAAOM,GAAQtB,EAASe,OAAOC,EAAOM,GAAOH,GAOnD,MAAOH,IAYThB,EAASwB,WAAa,SAASC,EAAKC,EAAQC,GAC1C,MAAOF,GAAIG,QAAQ,GAAIC,QAAOH,E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UH,GAEbA","file":"chartist.min.js","sourcesContent":["(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module unless amdModuleId is set\n define('Chartist', [], function () {\n return (root['Chartist'] = factory());\n });\n } else if (typeof module === 'object' && module.exports) {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory();\n } else {\n root['Chartist'] = factory();\n }\n}(this, function () {\n\n/* Chartist.js 0.11.0\n * Copyright © 2017 Gion Kunz\n * Free to use under either the WTFPL license or the MIT license.\n * https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-WTFPL\n * https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-MIT\n */\n/**\n * The core module of Chartist that is mainly providing static functions and higher level functions for chart modules.\n *\n * @module Chartist.Core\n */\nvar Chartist = {\n version: '0.11.0'\n};\n\n(function (window, document, Chartist) {\n 'use strict';\n\n /**\n * This object contains all namespaces used within Chartist.\n *\n * @memberof Chartist.Core\n * @type {{svg: string, xmlns: string, xhtml: string, xlink: string, ct: string}}\n */\n Chartist.namespaces = {\n svg: 'http://www.w3.org/2000/svg',\n xmlns: 'http://www.w3.org/2000/xmlns/',\n xhtml: 'http://www.w3.org/1999/xhtml',\n xlink: 'http://www.w3.org/1999/xlink',\n ct: 'http://gionkunz.github.com/chartist-js/ct'\n };\n\n /**\n * Helps to simplify functional style code\n *\n * @memberof Chartist.Core\n * @param {*} n This exact value will be returned by the noop function\n * @return {*} The same value that was provided to the n parameter\n */\n Chartist.noop = function (n) {\n return n;\n };\n\n /**\n * Generates a-z from a number 0 to 26\n *\n * @memberof Chartist.Core\n * @param {Number} n A number from 0 to 26 that will result in a letter a-z\n * @return {String} A character from a-z based on the input number n\n */\n Chartist.alphaNumerate = function (n) {\n // Limit to a-z\n return String.fromCharCode(97 + n % 26);\n };\n\n /**\n * Simple recursive object extend\n *\n * @memberof Chartist.Core\n * @param {Object} target Target object where the source will be merged into\n * @param {Object...} sources This object (objects) will be merged into target and then target is returned\n * @return {Object} An object that has the same reference as target but is extended and merged with the properties of source\n */\n Chartist.extend = function (target) {\n var i, source, sourceProp;\n target = target || {};\n\n for (i = 1; i < arguments.length; i++) {\n source = arguments[i];\n for (var prop in source) {\n sourceProp = source[prop];\n if (typeof sourceProp === 'object' && sourceProp !== null && !(sourceProp instanceof Array)) {\n target[prop] = Chartist.extend(target[prop], sourceProp);\n } else {\n target[prop] = sourceProp;\n }\n }\n }\n\n return target;\n };\n\n /**\n * Replaces all occurrences of subStr in str with newSubStr and returns a new string.\n *\n * @memberof Chartist.Core\n * @param {String} str\n * @param {String} subStr\n * @param {String} newSubStr\n * @return {String}\n */\n Chartist.replaceAll = function(str, subStr, newSubStr) {\n return str.replace(new RegExp(subStr, 'g'), newSubStr);\n };\n\n /**\n * Converts a number to a string with a unit. If a string is passed then this will be returned unmodified.\n *\n * @memberof Chartist.Core\n * @param {Number} value\n * @param {String} unit\n * @return {String} Returns the passed number value with unit.\n */\n Chartist.ensureUnit = function(value, unit) {\n if(typeof value === 'number') {\n value = value + unit;\n }\n\n return value;\n };\n\n /**\n * Converts a number or string to a quantity object.\n *\n * @memberof Chartist.Core\n * @param {String|Number} input\n * @return {Object} Returns an object containing the value as number and the unit as string.\n */\n Chartist.quantity = function(input) {\n if (typeof input === 'string') {\n var match = (/^(\\d+)\\s*(.*)$/g).exec(input);\n return {\n value : +match[1],\n unit: match[2] || undefined\n };\n }\n return { value: input };\n };\n\n /**\n * This is a wrapper around document.querySelector that will return the query if it's already of type Node\n *\n * @memberof Chartist.Core\n * @param {String|Node} query The query to use for selecting a Node or a DOM node that will be returned directly\n * @return {Node}\n */\n Chartist.querySelector = function(query) {\n return query instanceof Node ? query : document.querySelector(query);\n };\n\n /**\n * Functional style helper to produce array with given length initialized with undefined values\n *\n * @memberof Chartist.Core\n * @param length\n * @return {Array}\n */\n Chartist.times = function(length) {\n return Array.apply(null, new Array(length));\n };\n\n /**\n * Sum helper to be used in reduce functions\n *\n * @memberof Chartist.Core\n * @param previous\n * @param current\n * @return {*}\n */\n Chartist.sum = function(previous, current) {\n return previous + (current ? current : 0);\n };\n\n /**\n * Multiply helper to be used in `Array.map` for multiplying each value of an array with a factor.\n *\n * @memberof Chartist.Core\n * @param {Number} factor\n * @returns {Function} Function that can be used in `Array.map` to multiply each value in an array\n */\n Chartist.mapMultiply = function(factor) {\n return function(num) {\n return num * factor;\n };\n };\n\n /**\n * Add helper to be used in `Array.map` for adding a addend to each value of an array.\n *\n * @memberof Chartist.Core\n * @param {Number} addend\n * @returns {Function} Function that can be used in `Array.map` to add a addend to each value in an array\n */\n Chartist.mapAdd = function(addend) {\n return function(num) {\n return num + addend;\n };\n };\n\n /**\n * Map for multi dimensional arrays where their nested arrays will be mapped in serial. The output array will have the length of the largest nested array. The callback function is called with variable arguments where each argument is the nested array value (or undefined if there are no more values).\n *\n * @memberof Chartist.Core\n * @param arr\n * @param cb\n * @return {Array}\n */\n Chartist.serialMap = function(arr, cb) {\n var result = [],\n length = Math.max.apply(null, arr.map(function(e) {\n return e.length;\n }));\n\n Chartist.times(length).forEach(function(e, index) {\n var args = arr.map(function(e) {\n return e[index];\n });\n\n result[index] = cb.apply(null, args);\n });\n\n return result;\n };\n\n /**\n * This helper function can be used to round values with certain precision level after decimal. This is used to prevent rounding errors near float point precision limit.\n *\n * @memberof Chartist.Core\n * @param {Number} value The value that should be rounded with precision\n * @param {Number} [digits] The number of digits after decimal used to do the rounding\n * @returns {number} Rounded value\n */\n Chartist.roundWithPrecision = function(value, digits) {\n var precision = Math.pow(10, digits || Chartist.precision);\n return Math.round(value * precision) / precision;\n };\n\n /**\n * Precision level used internally in Chartist for rounding. If you require more decimal places you can increase this number.\n *\n * @memberof Chartist.Core\n * @type {number}\n */\n Chartist.precision = 8;\n\n /**\n * A map with characters to escape for strings to be safely used as attribute values.\n *\n * @memberof Chartist.Core\n * @type {Object}\n */\n Chartist.escapingMap = {\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n '\\'': '&#039;'\n };\n\n /**\n * This function serializes arbitrary data to a string. In case of data that can't be easily converted to a string, this function will create a wrapper object and serialize the data using JSON.stringify. The outcoming string will always be escaped using Chartist.escapingMap.\n * If called with null or undefined the function will return immediately with null or undefined.\n *\n * @memberof Chartist.Core\n * @param {Number|String|Object} data\n * @return {String}\n */\n Chartist.serialize = function(data) {\n if(data === null || data === undefined) {\n return data;\n } else if(typeof data === 'number') {\n data = ''+data;\n } else if(typeof data === 'object') {\n data = JSON.stringify({data: data});\n }\n\n return Object.keys(Chartist.escapingMap).reduce(function(result, key) {\n return Chartist.replaceAll(result, key, Chartist.escapingMap[key]);\n }, data);\n };\n\n /**\n * This function de-serializes a string previously serialized with Chartist.serialize. The string will always be unescaped using Chartist.escapingMap before it's returned. Based on the input value the return type can be Number, String or Object. JSON.parse is used with try / catch to see if the unescaped string can be parsed into an Object and this Object will be returned on success.\n *\n * @memberof Chartist.Core\n * @param {String} data\n * @return {String|Number|Object}\n */\n Chartist.deserialize = function(data) {\n if(typeof data !== 'string') {\n return data;\n }\n\n data = Object.keys(Chartist.escapingMap).reduce(function(result, key) {\n return Chartist.replaceAll(result, Chartist.escapingMap[key], key);\n }, data);\n\n try {\n data = JSON.parse(data);\n data = data.data !== undefined ? data.data : data;\n } catch(e) {}\n\n return data;\n };\n\n /**\n * Create or reinitialize the SVG element for the chart\n *\n * @memberof Chartist.Core\n * @param {Node} container The containing DOM Node object that will be used to plant the SVG element\n * @param {String} width Set the width of the SVG element. Default is 100%\n * @param {String} height Set the height of the SVG element. Default is 100%\n * @param {String} className Specify a class to be added to the SVG element\n * @return {Object} The created/reinitialized SVG element\n */\n Chartist.createSvg = function (container, width, height, className) {\n var svg;\n\n width = width || '100%';\n height = height || '100%';\n\n // Check if there is a previous SVG element in the container that contains the Chartist XML namespace and remove it\n // Since the DOM API does not support namespaces we need to manually search the returned list http://www.w3.org/TR/selectors-api/\n Array.prototype.slice.call(container.querySelectorAll('svg')).filter(function filterChartistSvgObjects(svg) {\n return svg.getAttributeNS(Chartist.namespaces.xmlns, 'ct');\n }).forEach(function removePreviousElement(svg) {\n container.removeChild(svg);\n });\n\n // Create svg object with width and height or use 100% as default\n svg = new Chartist.Svg('svg').attr({\n width: width,\n height: height\n }).addClass(className);\n\n svg._node.style.width = width;\n svg._node.style.height = height;\n\n // Add the DOM node to our container\n container.appendChild(svg._node);\n\n return svg;\n };\n\n /**\n * Ensures that the data object passed as second argument to the charts is present and correctly initialized.\n *\n * @param {Object} data The data object that is passed as second argument to the charts\n * @return {Object} The normalized data object\n */\n Chartist.normalizeData = function(data, reverse, multi) {\n var labelCount;\n var output = {\n raw: data,\n normalized: {}\n };\n\n // Check if we should generate some labels based on existing series data\n output.normalized.series = Chartist.getDataArray({\n series: data.series || []\n }, reverse, multi);\n\n // If all elements of the normalized data array are arrays we're dealing with\n // multi series data and we need to find the largest series if they are un-even\n if (output.normalized.series.every(function(value) {\n return value instanceof Array;\n })) {\n // Getting the series with the the most elements\n labelCount = Math.max.apply(null, output.normalized.series.map(function(series) {\n return series.length;\n }));\n } else {\n // We're dealing with Pie data so we just take the normalized array length\n labelCount = output.normalized.series.length;\n }\n\n output.normalized.labels = (data.labels || []).slice();\n // Padding the labels to labelCount with empty strings\n Array.prototype.push.apply(\n output.normalized.labels,\n Chartist.times(Math.max(0, labelCount - output.normalized.labels.length)).map(function() {\n return '';\n })\n );\n\n if(reverse) {\n Chartist.reverseData(output.normalized);\n }\n\n return output;\n };\n\n /**\n * This function safely checks if an objects has an owned property.\n *\n * @param {Object} object The object where to check for a property\n * @param {string} property The property name\n * @returns {boolean} Returns true if the object owns the specified property\n */\n Chartist.safeHasProperty = function(object, property) {\n return object !== null &&\n typeof object === 'object' &&\n object.hasOwnProperty(property);\n };\n\n /**\n * Checks if a value is considered a hole in the data series.\n *\n * @param {*} value\n * @returns {boolean} True if the value is considered a data hole\n */\n Chartist.isDataHoleValue = function(value) {\n return value === null ||\n value === undefined ||\n (typeof value === 'number' && isNaN(value));\n };\n\n /**\n * Reverses the series, labels and series data arrays.\n *\n * @memberof Chartist.Core\n * @param data\n */\n Chartist.reverseData = function(data) {\n data.labels.reverse();\n data.series.reverse();\n for (var i = 0; i < data.series.length; i++) {\n if(typeof(data.series[i]) === 'object' && data.series[i].data !== undefined) {\n data.series[i].data.reverse();\n } else if(data.series[i] instanceof Array) {\n data.series[i].reverse();\n }\n }\n };\n\n /**\n * Convert data series into plain array\n *\n * @memberof Chartist.Core\n * @param {Object} data The series object that contains the data to be visualized in the chart\n * @param {Boolean} [reverse] If true the whole data is reversed by the getDataArray call. This will modify the data object passed as first parameter. The labels as well as the series order is reversed. The whole series data arrays are reversed too.\n * @param {Boolean} [multi] Create a multi dimensional array from a series data array where a value object with `x` and `y` values will be created.\n * @return {Array} A plain array that contains the data to be visualized in the chart\n */\n Chartist.getDataArray = function(data, reverse, multi) {\n // Recursively walks through nested arrays and convert string values to numbers and objects with value properties\n // to values. Check the tests in data core -> data normalization for a detailed specification of expected values\n function recursiveConvert(value) {\n if(Chartist.safeHasProperty(value, 'value')) {\n // We are dealing with value object notation so we need to recurse on value property\n return recursiveConvert(value.value);\n } else if(Chartist.safeHasProperty(value, 'data')) {\n // We are dealing with series object notation so we need to recurse on data property\n return recursiveConvert(value.data);\n } else if(value instanceof Array) {\n // Data is of type array so we need to recurse on the series\n return value.map(recursiveConvert);\n } else if(Chartist.isDataHoleValue(value)) {\n // We're dealing with a hole in the data and therefore need to return undefined\n // We're also returning undefined for multi value output\n return undefined;\n } else {\n // We need to prepare multi value output (x and y data)\n if(multi) {\n var multiValue = {};\n\n // Single series value arrays are assumed to specify the Y-Axis value\n // For example: [1, 2] => [{x: undefined, y: 1}, {x: undefined, y: 2}]\n // If multi is a string then it's assumed that it specified which dimension should be filled as default\n if(typeof multi === 'string') {\n multiValue[multi] = Chartist.getNumberOrUndefined(value);\n } else {\n multiValue.y = Chartist.getNumberOrUndefined(value);\n }\n\n multiValue.x = value.hasOwnProperty('x') ? Chartist.getNumberOrUndefined(value.x) : multiValue.x;\n multiValue.y = value.hasOwnProperty('y') ? Chartist.getNumberOrUndefined(value.y) : multiValue.y;\n\n return multiValue;\n\n } else {\n // We can return simple data\n return Chartist.getNumberOrUndefined(value);\n }\n }\n }\n\n return data.series.map(recursiveConvert);\n };\n\n /**\n * Converts a number into a padding object.\n *\n * @memberof Chartist.Core\n * @param {Object|Number} padding\n * @param {Number} [fallback] This value is used to fill missing values if a incomplete padding object was passed\n * @returns {Object} Returns a padding object containing top, right, bottom, left properties filled with the padding number passed in as argument. If the argument is something else than a number (presumably already a correct padding object) then this argument is directly returned.\n */\n Chartist.normalizePadding = function(padding, fallback) {\n fallback = fallback || 0;\n\n return typeof padding === 'number' ? {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding\n } : {\n top: typeof padding.top === 'number' ? padding.top : fallback,\n right: typeof padding.right === 'number' ? padding.right : fallback,\n bottom: typeof padding.bottom === 'number' ? padding.bottom : fallback,\n left: typeof padding.left === 'number' ? padding.left : fallback\n };\n };\n\n Chartist.getMetaData = function(series, index) {\n var value = series.data ? series.data[index] : series[index];\n return value ? value.meta : undefined;\n };\n\n /**\n * Calculate the order of magnitude for the chart scale\n *\n * @memberof Chartist.Core\n * @param {Number} value The value Range of the chart\n * @return {Number} The order of magnitude\n */\n Chartist.orderOfMagnitude = function (value) {\n return Math.floor(Math.log(Math.abs(value)) / Math.LN10);\n };\n\n /**\n * Project a data length into screen coordinates (pixels)\n *\n * @memberof Chartist.Core\n * @param {Object} axisLength The svg element for the chart\n * @param {Number} length Single data value from a series array\n * @param {Object} bounds All the values to set the bounds of the chart\n * @return {Number} The projected data length in pixels\n */\n Chartist.projectLength = function (axisLength, length, bounds) {\n return length / bounds.range * axisLength;\n };\n\n /**\n * Get the height of the area in the chart for the data series\n *\n * @memberof Chartist.Core\n * @param {Object} svg The svg element for the chart\n * @param {Object} options The Object that contains all the optional values for the chart\n * @return {Number} The height of the area in the chart for the data series\n */\n Chartist.getAvailableHeight = function (svg, options) {\n return Math.max((Chartist.quantity(options.height).value || svg.height()) - (options.chartPadding.top + options.chartPadding.bottom) - options.axisX.offset, 0);\n };\n\n /**\n * Get highest and lowest value of data array. This Array contains the data that will be visualized in the chart.\n *\n * @memberof Chartist.Core\n * @param {Array} data The array that contains the data to be visualized in the chart\n * @param {Object} options The Object that contains the chart options\n * @param {String} dimension Axis dimension 'x' or 'y' used to access the correct value and high / low configuration\n * @return {Object} An object that contains the highest and lowest value that will be visualized on the chart.\n */\n Chartist.getHighLow = function (data, options, dimension) {\n // TODO: Remove workaround for deprecated global high / low config. Axis high / low configuration is preferred\n options = Chartist.extend({}, options, dimension ? options['axis' + dimension.toUpperCase()] : {});\n\n var highLow = {\n high: options.high === undefined ? -Number.MAX_VALUE : +options.high,\n low: options.low === undefined ? Number.MAX_VALUE : +options.low\n };\n var findHigh = options.high === undefined;\n var findLow = options.low === undefined;\n\n // Function to recursively walk through arrays and find highest and lowest number\n function recursiveHighLow(data) {\n if(data === undefined) {\n return undefined;\n } else if(data instanceof Array) {\n for (var i = 0; i < data.length; i++) {\n recursiveHighLow(data[i]);\n }\n } else {\n var value = dimension ? +data[dimension] : +data;\n\n if (findHigh && value > highLow.high) {\n highLow.high = value;\n }\n\n if (findLow && value < highLow.low) {\n highLow.low = value;\n }\n }\n }\n\n // Start to find highest and lowest number recursively\n if(findHigh || findLow) {\n recursiveHighLow(data);\n }\n\n // Overrides of high / low based on reference value, it will make sure that the invisible reference value is\n // used to generate the chart. This is useful when the chart always needs to contain the position of the\n // invisible reference value in the view i.e. for bipolar scales.\n if (options.referenceValue || options.referenceValue === 0) {\n highLow.high = Math.max(options.referenceValue, highLow.high);\n highLow.low = Math.min(options.referenceValue, highLow.low);\n }\n\n // If high and low are the same because of misconfiguration or flat data (only the same value) we need\n // to set the high or low to 0 depending on the polarity\n if (highLow.high <= highLow.low) {\n // If both values are 0 we set high to 1\n if (highLow.low === 0) {\n highLow.high = 1;\n } else if (highLow.low < 0) {\n // If we have the same negative value for the bounds we set bounds.high to 0\n highLow.high = 0;\n } else if (highLow.high > 0) {\n // If we have the same positive value for the bounds we set bounds.low to 0\n highLow.low = 0;\n } else {\n // If data array was empty, values are Number.MAX_VALUE and -Number.MAX_VALUE. Set bounds to prevent errors\n highLow.high = 1;\n highLow.low = 0;\n }\n }\n\n return highLow;\n };\n\n /**\n * Checks if a value can be safely coerced to a number. This includes all values except null which result in finite numbers when coerced. This excludes NaN, since it's not finite.\n *\n * @memberof Chartist.Core\n * @param value\n * @returns {Boolean}\n */\n Chartist.isNumeric = function(value) {\n return value === null ? false : isFinite(value);\n };\n\n /**\n * Returns true on all falsey values except the numeric value 0.\n *\n * @memberof Chartist.Core\n * @param value\n * @returns {boolean}\n */\n Chartist.isFalseyButZero = function(value) {\n return !value && value !== 0;\n };\n\n /**\n * Returns a number if the passed parameter is a valid number or the function will return undefined. On all other values than a valid number, this function will return undefined.\n *\n * @memberof Chartist.Core\n * @param value\n * @returns {*}\n */\n Chartist.getNumberOrUndefined = function(value) {\n return Chartist.isNumeric(value) ? +value : undefined;\n };\n\n /**\n * Checks if provided value object is multi value (contains x or y properties)\n *\n * @memberof Chartist.Core\n * @param value\n */\n Chartist.isMultiValue = function(value) {\n return typeof value === 'object' && ('x' in value || 'y' in value);\n };\n\n /**\n * Gets a value from a dimension `value.x` or `value.y` while returning value directly if it's a valid numeric value. If the value is not numeric and it's falsey this function will return `defaultValue`.\n *\n * @memberof Chartist.Core\n * @param value\n * @param dimension\n * @param defaultValue\n * @returns {*}\n */\n Chartist.getMultiValue = function(value, dimension) {\n if(Chartist.isMultiValue(value)) {\n return Chartist.getNumberOrUndefined(value[dimension || 'y']);\n } else {\n return Chartist.getNumberOrUndefined(value);\n }\n };\n\n /**\n * Pollard Rho Algorithm to find smallest factor of an integer value. There are more efficient algorithms for factorization, but this one is quite efficient and not so complex.\n *\n * @memberof Chartist.Core\n * @param {Number} num An integer number where the smallest factor should be searched for\n * @returns {Number} The smallest integer factor of the parameter num.\n */\n Chartist.rho = function(num) {\n if(num === 1) {\n return num;\n }\n\n function gcd(p, q) {\n if (p % q === 0) {\n return q;\n } else {\n return gcd(q, p % q);\n }\n }\n\n function f(x) {\n return x * x + 1;\n }\n\n var x1 = 2, x2 = 2, divisor;\n if (num % 2 === 0) {\n return 2;\n }\n\n do {\n x1 = f(x1) % num;\n x2 = f(f(x2)) % num;\n divisor = gcd(Math.abs(x1 - x2), num);\n } while (divisor === 1);\n\n return divisor;\n };\n\n /**\n * Calculate and retrieve all the bounds for the chart and return them in one array\n *\n * @memberof Chartist.Core\n * @param {Number} axisLength The length of the Axis used for\n * @param {Object} highLow An object containing a high and low property indicating the value range of the chart.\n * @param {Number} scaleMinSpace The minimum projected length a step should result in\n * @param {Boolean} onlyInteger\n * @return {Object} All the values to set the bounds of the chart\n */\n Chartist.getBounds = function (axisLength, highLow, scaleMinSpace, onlyInteger) {\n var i,\n optimizationCounter = 0,\n newMin,\n newMax,\n bounds = {\n high: highLow.high,\n low: highLow.low\n };\n\n bounds.valueRange = bounds.high - bounds.low;\n bounds.oom = Chartist.orderOfMagnitude(bounds.valueRange);\n bounds.step = Math.pow(10, bounds.oom);\n bounds.min = Math.floor(bounds.low / bounds.step) * bounds.step;\n bounds.max = Math.ceil(bounds.high / bounds.step) * bounds.step;\n bounds.range = bounds.max - bounds.min;\n bounds.numberOfSteps = Math.round(bounds.range / bounds.step);\n\n // Optimize scale step by checking if subdivision is possible based on horizontalGridMinSpace\n // If we are already below the scaleMinSpace value we will scale up\n var length = Chartist.projectLength(axisLength, bounds.step, bounds);\n var scaleUp = length < scaleMinSpace;\n var smallestFactor = onlyInteger ? Chartist.rho(bounds.range) : 0;\n\n // First check if we should only use integer steps and if step 1 is still larger than scaleMinSpace so we can use 1\n if(onlyInteger && Chartist.projectLength(axisLength, 1, bounds) >= scaleMinSpace) {\n bounds.step = 1;\n } else if(onlyInteger && smallestFactor < bounds.step && Chartist.projectLength(axisLength, smallestFactor, bounds) >= scaleMinSpace) {\n // If step 1 was too small, we can try the smallest factor of range\n // If the smallest factor is smaller than the current bounds.step and the projected length of smallest factor\n // is larger than the scaleMinSpace we should go for it.\n bounds.step = smallestFactor;\n } else {\n // Trying to divide or multiply by 2 and find the best step value\n while (true) {\n if (scaleUp && Chartist.projectLength(axisLength, bounds.step, bounds) <= scaleMinSpace) {\n bounds.step *= 2;\n } else if (!scaleUp && Chartist.projectLength(axisLength, bounds.step / 2, bounds) >= scaleMinSpace) {\n bounds.step /= 2;\n if(onlyInteger && bounds.step % 1 !== 0) {\n bounds.step *= 2;\n break;\n }\n } else {\n break;\n }\n\n if(optimizationCounter++ > 1000) {\n throw new Error('Exceeded maximum number of iterations while optimizing scale step!');\n }\n }\n }\n\n var EPSILON = 2.221E-16;\n bounds.step = Math.max(bounds.step, EPSILON);\n function safeIncrement(value, increment) {\n // If increment is too small use *= (1+EPSILON) as a simple nextafter\n if (value === (value += increment)) {\n \tvalue *= (1 + (increment > 0 ? EPSILON : -EPSILON));\n }\n return value;\n }\n\n // Narrow min and max based on new step\n newMin = bounds.min;\n newMax = bounds.max;\n while (newMin + bounds.step <= bounds.low) {\n \tnewMin = safeIncrement(newMin, bounds.step);\n }\n while (newMax - bounds.step >= bounds.high) {\n \tnewMax = safeIncrement(newMax, -bounds.step);\n }\n bounds.min = newMin;\n bounds.max = newMax;\n bounds.range = bounds.max - bounds.min;\n\n var values = [];\n for (i = bounds.min; i <= bounds.max; i = safeIncrement(i, bounds.step)) {\n var value = Chartist.roundWithPrecision(i);\n if (value !== values[values.length - 1]) {\n values.push(value);\n }\n }\n bounds.values = values;\n return bounds;\n };\n\n /**\n * Calculate cartesian coordinates of polar coordinates\n *\n * @memberof Chartist.Core\n * @param {Number} centerX X-axis coordinates of center point of circle segment\n * @param {Number} centerY X-axis coordinates of center point of circle segment\n * @param {Number} radius Radius of circle segment\n * @param {Number} angleInDegrees Angle of circle segment in degrees\n * @return {{x:Number, y:Number}} Coordinates of point on circumference\n */\n Chartist.polarToCartesian = function (centerX, centerY, radius, angleInDegrees) {\n var angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0;\n\n return {\n x: centerX + (radius * Math.cos(angleInRadians)),\n y: centerY + (radius * Math.sin(angleInRadians))\n };\n };\n\n /**\n * Initialize chart drawing rectangle (area where chart is drawn) x1,y1 = bottom left / x2,y2 = top right\n *\n * @memberof Chartist.Core\n * @param {Object} svg The svg element for the chart\n * @param {Object} options The Object that contains all the optional values for the chart\n * @param {Number} [fallbackPadding] The fallback padding if partial padding objects are used\n * @return {Object} The chart rectangles coordinates inside the svg element plus the rectangles measurements\n */\n Chartist.createChartRect = function (svg, options, fallbackPadding) {\n var hasAxis = !!(options.axisX || options.axisY);\n var yAxisOffset = hasAxis ? options.axisY.offset : 0;\n var xAxisOffset = hasAxis ? options.axisX.offset : 0;\n // If width or height results in invalid value (including 0) we fallback to the unitless settings or even 0\n var width = svg.width() || Chartist.quantity(options.width).value || 0;\n var height = svg.height() || Chartist.quantity(options.height).value || 0;\n var normalizedPadding = Chartist.normalizePadding(options.chartPadding, fallbackPadding);\n\n // If settings were to small to cope with offset (legacy) and padding, we'll adjust\n width = Math.max(width, yAxisOffset + normalizedPadding.left + normalizedPadding.right);\n height = Math.max(height, xAxisOffset + normalizedPadding.top + normalizedPadding.bottom);\n\n var chartRect = {\n padding: normalizedPadding,\n width: function () {\n return this.x2 - this.x1;\n },\n height: function () {\n return this.y1 - this.y2;\n }\n };\n\n if(hasAxis) {\n if (options.axisX.position === 'start') {\n chartRect.y2 = normalizedPadding.top + xAxisOffset;\n chartRect.y1 = Math.max(height - normalizedPadding.bottom, chartRect.y2 + 1);\n } else {\n chartRect.y2 = normalizedPadding.top;\n chartRect.y1 = Math.max(height - normalizedPadding.bottom - xAxisOffset, chartRect.y2 + 1);\n }\n\n if (options.axisY.position === 'start') {\n chartRect.x1 = normalizedPadding.left + yAxisOffset;\n chartRect.x2 = Math.max(width - normalizedPadding.right, chartRect.x1 + 1);\n } else {\n chartRect.x1 = normalizedPadding.left;\n chartRect.x2 = Math.max(width - normalizedPadding.right - yAxisOffset, chartRect.x1 + 1);\n }\n } else {\n chartRect.x1 = normalizedPadding.left;\n chartRect.x2 = Math.max(width - normalizedPadding.right, chartRect.x1 + 1);\n chartRect.y2 = normalizedPadding.top;\n chartRect.y1 = Math.max(height - normalizedPadding.bottom, chartRect.y2 + 1);\n }\n\n return chartRect;\n };\n\n /**\n * Creates a grid line based on a projected value.\n *\n * @memberof Chartist.Core\n * @param position\n * @param index\n * @param axis\n * @param offset\n * @param length\n * @param group\n * @param classes\n * @param eventEmitter\n */\n Chartist.createGrid = function(position, index, axis, offset, length, group, classes, eventEmitter) {\n var positionalData = {};\n positionalData[axis.units.pos + '1'] = position;\n positionalData[axis.units.pos + '2'] = position;\n positionalData[axis.counterUnits.pos + '1'] = offset;\n positionalData[axis.counterUnits.pos + '2'] = offset + length;\n\n var gridElement = group.elem('line', positionalData, classes.join(' '));\n\n // Event for grid draw\n eventEmitter.emit('draw',\n Chartist.extend({\n type: 'grid',\n axis: axis,\n index: index,\n group: group,\n element: gridElement\n }, positionalData)\n );\n };\n\n /**\n * Creates a grid background rect and emits the draw event.\n *\n * @memberof Chartist.Core\n * @param gridGroup\n * @param chartRect\n * @param className\n * @param eventEmitter\n */\n Chartist.createGridBackground = function (gridGroup, chartRect, className, eventEmitter) {\n var gridBackground = gridGroup.elem('rect', {\n x: chartRect.x1,\n y: chartRect.y2,\n width: chartRect.width(),\n height: chartRect.height(),\n }, className, true);\n\n // Event for grid background draw\n eventEmitter.emit('draw', {\n type: 'gridBackground',\n group: gridGroup,\n element: gridBackground\n });\n };\n\n /**\n * Creates a label based on a projected value and an axis.\n *\n * @memberof Chartist.Core\n * @param position\n * @param length\n * @param index\n * @param labels\n * @param axis\n * @param axisOffset\n * @param labelOffset\n * @param group\n * @param classes\n * @param useForeignObject\n * @param eventEmitter\n */\n Chartist.createLabel = function(position, length, index, labels, axis, axisOffset, labelOffset, group, classes, useForeignObject, eventEmitter) {\n var labelElement;\n var positionalData = {};\n\n positionalData[axis.units.pos] = position + labelOffset[axis.units.pos];\n positionalData[axis.counterUnits.pos] = labelOffset[axis.counterUnits.pos];\n positionalData[axis.units.len] = length;\n positionalData[axis.counterUnits.len] = Math.max(0, axisOffset - 10);\n\n if(useForeignObject) {\n // We need to set width and height explicitly to px as span will not expand with width and height being\n // 100% in all browsers\n var content = document.createElement('span');\n content.className = classes.join(' ');\n content.setAttribute('xmlns', Chartist.namespaces.xhtml);\n content.innerText = labels[index];\n content.style[axis.units.len] = Math.round(positionalData[axis.units.len]) + 'px';\n content.style[axis.counterUnits.len] = Math.round(positionalData[axis.counterUnits.len]) + 'px';\n\n labelElement = group.foreignObject(content, Chartist.extend({\n style: 'overflow: visible;'\n }, positionalData));\n } else {\n labelElement = group.elem('text', positionalData, classes.join(' ')).text(labels[index]);\n }\n\n eventEmitter.emit('draw', Chartist.extend({\n type: 'label',\n axis: axis,\n index: index,\n group: group,\n element: labelElement,\n text: labels[index]\n }, positionalData));\n };\n\n /**\n * Helper to read series specific options from options object. It automatically falls back to the global option if\n * there is no option in the series options.\n *\n * @param {Object} series Series object\n * @param {Object} options Chartist options object\n * @param {string} key The options key that should be used to obtain the options\n * @returns {*}\n */\n Chartist.getSeriesOption = function(series, options, key) {\n if(series.name && options.series && options.series[series.name]) {\n var seriesOptions = options.series[series.name];\n return seriesOptions.hasOwnProperty(key) ? seriesOptions[key] : options[key];\n } else {\n return options[key];\n }\n };\n\n /**\n * Provides options handling functionality with callback for options changes triggered by responsive options and media query matches\n *\n * @memberof Chartist.Core\n * @param {Object} options Options set by user\n * @param {Array} responsiveOptions Optional functions to add responsive behavior to chart\n * @param {Object} eventEmitter The event emitter that will be used to emit the options changed events\n * @return {Object} The consolidated options object from the defaults, base and matching responsive options\n */\n Chartist.optionsProvider = function (options, responsiveOptions, eventEmitter) {\n var baseOptions = Chartist.extend({}, options),\n currentOptions,\n mediaQueryListeners = [],\n i;\n\n function updateCurrentOptions(mediaEvent) {\n var previousOptions = currentOptions;\n currentOptions = Chartist.extend({}, baseOptions);\n\n if (responsiveOptions) {\n for (i = 0; i < responsiveOptions.length; i++) {\n var mql = window.matchMedia(responsiveOptions[i][0]);\n if (mql.matches) {\n currentOptions = Chartist.extend(currentOptions, responsiveOptions[i][1]);\n }\n }\n }\n\n if(eventEmitter && mediaEvent) {\n eventEmitter.emit('optionsChanged', {\n previousOptions: previousOptions,\n currentOptions: currentOptions\n });\n }\n }\n\n function removeMediaQueryListeners() {\n mediaQueryListeners.forEach(function(mql) {\n mql.removeListener(updateCurrentOptions);\n });\n }\n\n if (!window.matchMedia) {\n throw 'window.matchMedia not found! Make sure you\\'re using a polyfill.';\n } else if (responsiveOptions) {\n\n for (i = 0; i < responsiveOptions.length; i++) {\n var mql = window.matchMedia(responsiveOptions[i][0]);\n mql.addListener(updateCurrentOptions);\n mediaQueryListeners.push(mql);\n }\n }\n // Execute initially without an event argument so we get the correct options\n updateCurrentOptions();\n\n return {\n removeMediaQueryListeners: removeMediaQueryListeners,\n getCurrentOptions: function getCurrentOptions() {\n return Chartist.extend({}, currentOptions);\n }\n };\n };\n\n\n /**\n * Splits a list of coordinates and associated values into segments. Each returned segment contains a pathCoordinates\n * valueData property describing the segment.\n *\n * With the default options, segments consist of contiguous sets of points that do not have an undefined value. Any\n * points with undefined values are discarded.\n *\n * **Options**\n * The following options are used to determine how segments are formed\n * ```javascript\n * var options = {\n * // If fillHoles is true, undefined values are simply discarded without creating a new segment. Assuming other options are default, this returns single segment.\n * fillHoles: false,\n * // If increasingX is true, the coordinates in all segments have strictly increasing x-values.\n * increasingX: false\n * };\n * ```\n *\n * @memberof Chartist.Core\n * @param {Array} pathCoordinates List of point coordinates to be split in the form [x1, y1, x2, y2 ... xn, yn]\n * @param {Array} values List of associated point values in the form [v1, v2 .. vn]\n * @param {Object} options Options set by user\n * @return {Array} List of segments, each containing a pathCoordinates and valueData property.\n */\n Chartist.splitIntoSegments = function(pathCoordinates, valueData, options) {\n var defaultOptions = {\n increasingX: false,\n fillHoles: false\n };\n\n options = Chartist.extend({}, defaultOptions, options);\n\n var segments = [];\n var hole = true;\n\n for(var i = 0; i < pathCoordinates.length; i += 2) {\n // If this value is a \"hole\" we set the hole flag\n if(Chartist.getMultiValue(valueData[i / 2].value) === undefined) {\n // if(valueData[i / 2].value === undefined) {\n if(!options.fillHoles) {\n hole = true;\n }\n } else {\n if(options.increasingX && i >= 2 && pathCoordinates[i] <= pathCoordinates[i-2]) {\n // X is not increasing, so we need to make sure we start a new segment\n hole = true;\n }\n\n\n // If it's a valid value we need to check if we're coming out of a hole and create a new empty segment\n if(hole) {\n segments.push({\n pathCoordinates: [],\n valueData: []\n });\n // As we have a valid value now, we are not in a \"hole\" anymore\n hole = false;\n }\n\n // Add to the segment pathCoordinates and valueData\n segments[segments.length - 1].pathCoordinates.push(pathCoordinates[i], pathCoordinates[i + 1]);\n segments[segments.length - 1].valueData.push(valueData[i / 2]);\n }\n }\n\n return segments;\n };\n}(window, document, Chartist));\n;/**\n * Chartist path interpolation functions.\n *\n * @module Chartist.Interpolation\n */\n/* global Chartist */\n(function(window, document, Chartist) {\n 'use strict';\n\n Chartist.Interpolation = {};\n\n /**\n * This interpolation function does not smooth the path and the result is only containing lines and no curves.\n *\n * @example\n * var chart = new Chartist.Line('.ct-chart', {\n * labels: [1, 2, 3, 4, 5],\n * series: [[1, 2, 8, 1, 7]]\n * }, {\n * lineSmooth: Chartist.Interpolation.none({\n * fillHoles: false\n * })\n * });\n *\n *\n * @memberof Chartist.Interpolation\n * @return {Function}\n */\n Chartist.Interpolation.none = function(options) {\n var defaultOptions = {\n fillHoles: false\n };\n options = Chartist.extend({}, defaultOptions, options);\n return function none(pathCoordinates, valueData) {\n var path = new Chartist.Svg.Path();\n var hole = true;\n\n for(var i = 0; i < pathCoordinates.length; i += 2) {\n var currX = pathCoordinates[i];\n var currY = pathCoordinates[i + 1];\n var currData = valueData[i / 2];\n\n if(Chartist.getMultiValue(currData.value) !== undefined) {\n\n if(hole) {\n path.move(currX, currY, false, currData);\n } else {\n path.line(currX, currY, false, currData);\n }\n\n hole = false;\n } else if(!options.fillHoles) {\n hole = true;\n }\n }\n\n return path;\n };\n };\n\n /**\n * Simple smoothing creates horizontal handles that are positioned with a fraction of the length between two data points. You can use the divisor option to specify the amount of smoothing.\n *\n * Simple smoothing can be used instead of `Chartist.Smoothing.cardinal` if you'd like to get rid of the artifacts it produces sometimes. Simple smoothing produces less flowing lines but is accurate by hitting the points and it also doesn't swing below or above the given data point.\n *\n * All smoothing functions within Chartist are factory functions that accept an options parameter. The simple interpolation function accepts one configuration parameter `divisor`, between 1 and ∞, which controls the smoothing characteristics.\n *\n * @example\n * var chart = new Chartist.Line('.ct-chart', {\n * labels: [1, 2, 3, 4, 5],\n * series: [[1, 2, 8, 1, 7]]\n * }, {\n * lineSmooth: Chartist.Interpolation.simple({\n * divisor: 2,\n * fillHoles: false\n * })\n * });\n *\n *\n * @memberof Chartist.Interpolation\n * @param {Object} options The options of the simple interpolation factory function.\n * @return {Function}\n */\n Chartist.Interpolation.simple = function(options) {\n var defaultOptions = {\n divisor: 2,\n fillHoles: false\n };\n options = Chartist.extend({}, defaultOptions, options);\n\n var d = 1 / Math.max(1, options.divisor);\n\n return function simple(pathCoordinates, valueData) {\n var path = new Chartist.Svg.Path();\n var prevX, prevY, prevData;\n\n for(var i = 0; i < pathCoordinates.length; i += 2) {\n var currX = pathCoordinates[i];\n var currY = pathCoordinates[i + 1];\n var length = (currX - prevX) * d;\n var currData = valueData[i / 2];\n\n if(currData.value !== undefined) {\n\n if(prevData === undefined) {\n path.move(currX, currY, false, currData);\n } else {\n path.curve(\n prevX + length,\n prevY,\n currX - length,\n currY,\n currX,\n currY,\n false,\n currData\n );\n }\n\n prevX = currX;\n prevY = currY;\n prevData = currData;\n } else if(!options.fillHoles) {\n prevX = currX = prevData = undefined;\n }\n }\n\n return path;\n };\n };\n\n /**\n * Cardinal / Catmull-Rome spline interpolation is the default smoothing function in Chartist. It produces nice results where the splines will always meet the points. It produces some artifacts though when data values are increased or decreased rapidly. The line may not follow a very accurate path and if the line should be accurate this smoothing function does not produce the best results.\n *\n * Cardinal splines can only be created if there are more than two data points. If this is not the case this smoothing will fallback to `Chartist.Smoothing.none`.\n *\n * All smoothing functions within Chartist are factory functions that accept an options parameter. The cardinal interpolation function accepts one configuration parameter `tension`, between 0 and 1, which controls the smoothing intensity.\n *\n * @example\n * var chart = new Chartist.Line('.ct-chart', {\n * labels: [1, 2, 3, 4, 5],\n * series: [[1, 2, 8, 1, 7]]\n * }, {\n * lineSmooth: Chartist.Interpolation.cardinal({\n * tension: 1,\n * fillHoles: false\n * })\n * });\n *\n * @memberof Chartist.Interpolation\n * @param {Object} options The options of the cardinal factory function.\n * @return {Function}\n */\n Chartist.Interpolation.cardinal = function(options) {\n var defaultOptions = {\n tension: 1,\n fillHoles: false\n };\n\n options = Chartist.extend({}, defaultOptions, options);\n\n var t = Math.min(1, Math.max(0, options.tension)),\n c = 1 - t;\n\n return function cardinal(pathCoordinates, valueData) {\n // First we try to split the coordinates into segments\n // This is necessary to treat \"holes\" in line charts\n var segments = Chartist.splitIntoSegments(pathCoordinates, valueData, {\n fillHoles: options.fillHoles\n });\n\n if(!segments.length) {\n // If there were no segments return 'Chartist.Interpolation.none'\n return Chartist.Interpolation.none()([]);\n } else if(segments.length > 1) {\n // If the split resulted in more that one segment we need to interpolate each segment individually and join them\n // afterwards together into a single path.\n var paths = [];\n // For each segment we will recurse the cardinal function\n segments.forEach(function(segment) {\n paths.push(cardinal(segment.pathCoordinates, segment.valueData));\n });\n // Join the segment path data into a single path and return\n return Chartist.Svg.Path.join(paths);\n } else {\n // If there was only one segment we can proceed regularly by using pathCoordinates and valueData from the first\n // segment\n pathCoordinates = segments[0].pathCoordinates;\n valueData = segments[0].valueData;\n\n // If less than two points we need to fallback to no smoothing\n if(pathCoordinates.length <= 4) {\n return Chartist.Interpolation.none()(pathCoordinates, valueData);\n }\n\n var path = new Chartist.Svg.Path().move(pathCoordinates[0], pathCoordinates[1], false, valueData[0]),\n z;\n\n for (var i = 0, iLen = pathCoordinates.length; iLen - 2 * !z > i; i += 2) {\n var p = [\n {x: +pathCoordinates[i - 2], y: +pathCoordinates[i - 1]},\n {x: +pathCoordinates[i], y: +pathCoordinates[i + 1]},\n {x: +pathCoordinates[i + 2], y: +pathCoordinates[i + 3]},\n {x: +pathCoordinates[i + 4], y: +pathCoordinates[i + 5]}\n ];\n if (z) {\n if (!i) {\n p[0] = {x: +pathCoordinates[iLen - 2], y: +pathCoordinates[iLen - 1]};\n } else if (iLen - 4 === i) {\n p[3] = {x: +pathCoordinates[0], y: +pathCoordinates[1]};\n } else if (iLen - 2 === i) {\n p[2] = {x: +pathCoordinates[0], y: +pathCoordinates[1]};\n p[3] = {x: +pathCoordinates[2], y: +pathCoordinates[3]};\n }\n } else {\n if (iLen - 4 === i) {\n p[3] = p[2];\n } else if (!i) {\n p[0] = {x: +pathCoordinates[i], y: +pathCoordinates[i + 1]};\n }\n }\n\n path.curve(\n (t * (-p[0].x + 6 * p[1].x + p[2].x) / 6) + (c * p[2].x),\n (t * (-p[0].y + 6 * p[1].y + p[2].y) / 6) + (c * p[2].y),\n (t * (p[1].x + 6 * p[2].x - p[3].x) / 6) + (c * p[2].x),\n (t * (p[1].y + 6 * p[2].y - p[3].y) / 6) + (c * p[2].y),\n p[2].x,\n p[2].y,\n false,\n valueData[(i + 2) / 2]\n );\n }\n\n return path;\n }\n };\n };\n\n /**\n * Monotone Cubic spline interpolation produces a smooth curve which preserves monotonicity. Unlike cardinal splines, the curve will not extend beyond the range of y-values of the original data points.\n *\n * Monotone Cubic splines can only be created if there are more than two data points. If this is not the case this smoothing will fallback to `Chartist.Smoothing.none`.\n *\n * The x-values of subsequent points must be increasing to fit a Monotone Cubic spline. If this condition is not met for a pair of adjacent points, then there will be a break in the curve between those data points.\n *\n * All smoothing functions within Chartist are factory functions that accept an options parameter.\n *\n * @example\n * var chart = new Chartist.Line('.ct-chart', {\n * labels: [1, 2, 3, 4, 5],\n * series: [[1, 2, 8, 1, 7]]\n * }, {\n * lineSmooth: Chartist.Interpolation.monotoneCubic({\n * fillHoles: false\n * })\n * });\n *\n * @memberof Chartist.Interpolation\n * @param {Object} options The options of the monotoneCubic factory function.\n * @return {Function}\n */\n Chartist.Interpolation.monotoneCubic = function(options) {\n var defaultOptions = {\n fillHoles: false\n };\n\n options = Chartist.extend({}, defaultOptions, options);\n\n return function monotoneCubic(pathCoordinates, valueData) {\n // First we try to split the coordinates into segments\n // This is necessary to treat \"holes\" in line charts\n var segments = Chartist.splitIntoSegments(pathCoordinates, valueData, {\n fillHoles: options.fillHoles,\n increasingX: true\n });\n\n if(!segments.length) {\n // If there were no segments return 'Chartist.Interpolation.none'\n return Chartist.Interpolation.none()([]);\n } else if(segments.length > 1) {\n // If the split resulted in more that one segment we need to interpolate each segment individually and join them\n // afterwards together into a single path.\n var paths = [];\n // For each segment we will recurse the monotoneCubic fn function\n segments.forEach(function(segment) {\n paths.push(monotoneCubic(segment.pathCoordinates, segment.valueData));\n });\n // Join the segment path data into a single path and return\n return Chartist.Svg.Path.join(paths);\n } else {\n // If there was only one segment we can proceed regularly by using pathCoordinates and valueData from the first\n // segment\n pathCoordinates = segments[0].pathCoordinates;\n valueData = segments[0].valueData;\n\n // If less than three points we need to fallback to no smoothing\n if(pathCoordinates.length <= 4) {\n return Chartist.Interpolation.none()(pathCoordinates, valueData);\n }\n\n var xs = [],\n ys = [],\n i,\n n = pathCoordinates.length / 2,\n ms = [],\n ds = [], dys = [], dxs = [],\n path;\n\n // Populate x and y coordinates into separate arrays, for readability\n\n for(i = 0; i < n; i++) {\n xs[i] = pathCoordinates[i * 2];\n ys[i] = pathCoordinates[i * 2 + 1];\n }\n\n // Calculate deltas and derivative\n\n for(i = 0; i < n - 1; i++) {\n dys[i] = ys[i + 1] - ys[i];\n dxs[i] = xs[i + 1] - xs[i];\n ds[i] = dys[i] / dxs[i];\n }\n\n // Determine desired slope (m) at each point using Fritsch-Carlson method\n // See: http://math.stackexchange.com/questions/45218/implementation-of-monotone-cubic-interpolation\n\n ms[0] = ds[0];\n ms[n - 1] = ds[n - 2];\n\n for(i = 1; i < n - 1; i++) {\n if(ds[i] === 0 || ds[i - 1] === 0 || (ds[i - 1] > 0) !== (ds[i] > 0)) {\n ms[i] = 0;\n } else {\n ms[i] = 3 * (dxs[i - 1] + dxs[i]) / (\n (2 * dxs[i] + dxs[i - 1]) / ds[i - 1] +\n (dxs[i] + 2 * dxs[i - 1]) / ds[i]);\n\n if(!isFinite(ms[i])) {\n ms[i] = 0;\n }\n }\n }\n\n // Now build a path from the slopes\n\n path = new Chartist.Svg.Path().move(xs[0], ys[0], false, valueData[0]);\n\n for(i = 0; i < n - 1; i++) {\n path.curve(\n // First control point\n xs[i] + dxs[i] / 3,\n ys[i] + ms[i] * dxs[i] / 3,\n // Second control point\n xs[i + 1] - dxs[i] / 3,\n ys[i + 1] - ms[i + 1] * dxs[i] / 3,\n // End point\n xs[i + 1],\n ys[i + 1],\n\n false,\n valueData[i + 1]\n );\n }\n\n return path;\n }\n };\n };\n\n /**\n * Step interpolation will cause the line chart to move in steps rather than diagonal or smoothed lines. This interpolation will create additional points that will also be drawn when the `showPoint` option is enabled.\n *\n * All smoothing functions within Chartist are factory functions that accept an options parameter. The step interpolation function accepts one configuration parameter `postpone`, that can be `true` or `false`. The default value is `true` and will cause the step to occur where the value actually changes. If a different behaviour is needed where the step is shifted to the left and happens before the actual value, this option can be set to `false`.\n *\n * @example\n * var chart = new Chartist.Line('.ct-chart', {\n * labels: [1, 2, 3, 4, 5],\n * series: [[1, 2, 8, 1, 7]]\n * }, {\n * lineSmooth: Chartist.Interpolation.step({\n * postpone: true,\n * fillHoles: false\n * })\n * });\n *\n * @memberof Chartist.Interpolation\n * @param options\n * @returns {Function}\n */\n Chartist.Interpolation.step = function(options) {\n var defaultOptions = {\n postpone: true,\n fillHoles: false\n };\n\n options = Chartist.extend({}, defaultOptions, options);\n\n return function step(pathCoordinates, valueData) {\n var path = new Chartist.Svg.Path();\n\n var prevX, prevY, prevData;\n\n for (var i = 0; i < pathCoordinates.length; i += 2) {\n var currX = pathCoordinates[i];\n var currY = pathCoordinates[i + 1];\n var currData = valueData[i / 2];\n\n // If the current point is also not a hole we can draw the step lines\n if(currData.value !== undefined) {\n if(prevData === undefined) {\n path.move(currX, currY, false, currData);\n } else {\n if(options.postpone) {\n // If postponed we should draw the step line with the value of the previous value\n path.line(currX, prevY, false, prevData);\n } else {\n // If not postponed we should draw the step line with the value of the current value\n path.line(prevX, currY, false, currData);\n }\n // Line to the actual point (this should only be a Y-Axis movement\n path.line(currX, currY, false, currData);\n }\n\n prevX = currX;\n prevY = currY;\n prevData = currData;\n } else if(!options.fillHoles) {\n prevX = prevY = prevData = undefined;\n }\n }\n\n return path;\n };\n };\n\n}(window, document, Chartist));\n;/**\n * A very basic event module that helps to generate and catch events.\n *\n * @module Chartist.Event\n */\n/* global Chartist */\n(function (window, document, Chartist) {\n 'use strict';\n\n Chartist.EventEmitter = function () {\n var handlers = [];\n\n /**\n * Add an event handler for a specific event\n *\n * @memberof Chartist.Event\n * @param {String} event The event name\n * @param {Function} handler A event handler function\n */\n function addEventHandler(event, handler) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n }\n\n /**\n * Remove an event handler of a specific event name or remove all event handlers for a specific event.\n *\n * @memberof Chartist.Event\n * @param {String} event The event name where a specific or all handlers should be removed\n * @param {Function} [handler] An optional event handler function. If specified only this specific handler will be removed and otherwise all handlers are removed.\n */\n function removeEventHandler(event, handler) {\n // Only do something if there are event handlers with this name existing\n if(handlers[event]) {\n // If handler is set we will look for a specific handler and only remove this\n if(handler) {\n handlers[event].splice(handlers[event].indexOf(handler), 1);\n if(handlers[event].length === 0) {\n delete handlers[event];\n }\n } else {\n // If no handler is specified we remove all handlers for this event\n delete handlers[event];\n }\n }\n }\n\n /**\n * Use this function to emit an event. All handlers that are listening for this event will be triggered with the data parameter.\n *\n * @memberof Chartist.Event\n * @param {String} event The event name that should be triggered\n * @param {*} data Arbitrary data that will be passed to the event handler callback functions\n */\n function emit(event, data) {\n // Only do something if there are event handlers with this name existing\n if(handlers[event]) {\n handlers[event].forEach(function(handler) {\n handler(data);\n });\n }\n\n // Emit event to star event handlers\n if(handlers['*']) {\n handlers['*'].forEach(function(starHandler) {\n starHandler(event, data);\n });\n }\n }\n\n return {\n addEventHandler: addEventHandler,\n removeEventHandler: removeEventHandler,\n emit: emit\n };\n };\n\n}(window, document, Chartist));\n;/**\n * This module provides some basic prototype inheritance utilities.\n *\n * @module Chartist.Class\n */\n/* global Chartist */\n(function(window, document, Chartist) {\n 'use strict';\n\n function listToArray(list) {\n var arr = [];\n if (list.length) {\n for (var i = 0; i < list.length; i++) {\n arr.push(list[i]);\n }\n }\n return arr;\n }\n\n /**\n * Method to extend from current prototype.\n *\n * @memberof Chartist.Class\n * @param {Object} properties The object that serves as definition for the prototype that gets created for the new class. This object should always contain a constructor property that is the desired constructor for the newly created class.\n * @param {Object} [superProtoOverride] By default extens will use the current class prototype or Chartist.class. With this parameter you can specify any super prototype that will be used.\n * @return {Function} Constructor function of the new class\n *\n * @example\n * var Fruit = Class.extend({\n * color: undefined,\n * sugar: undefined,\n *\n * constructor: function(color, sugar) {\n * this.color = color;\n * this.sugar = sugar;\n * },\n *\n * eat: function() {\n * this.sugar = 0;\n * return this;\n * }\n * });\n *\n * var Banana = Fruit.extend({\n * length: undefined,\n *\n * constructor: function(length, sugar) {\n * Banana.super.constructor.call(this, 'Yellow', sugar);\n * this.length = length;\n * }\n * });\n *\n * var banana = new Banana(20, 40);\n * console.log('banana instanceof Fruit', banana instanceof Fruit);\n * console.log('Fruit is prototype of banana', Fruit.prototype.isPrototypeOf(banana));\n * console.log('bananas prototype is Fruit', Object.getPrototypeOf(banana) === Fruit.prototype);\n * console.log(banana.sugar);\n * console.log(banana.eat().sugar);\n * console.log(banana.color);\n */\n function extend(properties, superProtoOverride) {\n var superProto = superProtoOverride || this.prototype || Chartist.Class;\n var proto = Object.create(superProto);\n\n Chartist.Class.cloneDefinitions(proto, properties);\n\n var constr = function() {\n var fn = proto.constructor || function () {},\n instance;\n\n // If this is linked to the Chartist namespace the constructor was not called with new\n // To provide a fallback we will instantiate here and return the instance\n instance = this === Chartist ? Object.create(proto) : this;\n fn.apply(instance, Array.prototype.slice.call(arguments, 0));\n\n // If this constructor was not called with new we need to return the instance\n // This will not harm when the constructor has been called with new as the returned value is ignored\n return instance;\n };\n\n constr.prototype = proto;\n constr.super = superProto;\n constr.extend = this.extend;\n\n return constr;\n }\n\n // Variable argument list clones args > 0 into args[0] and retruns modified args[0]\n function cloneDefinitions() {\n var args = listToArray(arguments);\n var target = args[0];\n\n args.splice(1, args.length - 1).forEach(function (source) {\n Object.getOwnPropertyNames(source).forEach(function (propName) {\n // If this property already exist in target we delete it first\n delete target[propName];\n // Define the property with the descriptor from source\n Object.defineProperty(target, propName,\n Object.getOwnPropertyDescriptor(source, propName));\n });\n });\n\n return target;\n }\n\n Chartist.Class = {\n extend: extend,\n cloneDefinitions: cloneDefinitions\n };\n\n}(window, document, Chartist));\n;/**\n * Base for all chart types. The methods in Chartist.Base are inherited to all chart types.\n *\n * @module Chartist.Base\n */\n/* global Chartist */\n(function(window, document, Chartist) {\n 'use strict';\n\n // TODO: Currently we need to re-draw the chart on window resize. This is usually very bad and will affect performance.\n // This is done because we can't work with relative coordinates when drawing the chart because SVG Path does not\n // work with relative positions yet. We need to check if we can do a viewBox hack to switch to percentage.\n // See http://mozilla.6506.n7.nabble.com/Specyfing-paths-with-percentages-unit-td247474.html\n // Update: can be done using the above method tested here: http://codepen.io/gionkunz/pen/KDvLj\n // The problem is with the label offsets that can't be converted into percentage and affecting the chart container\n /**\n * Updates the chart which currently does a full reconstruction of the SVG DOM\n *\n * @param {Object} [data] Optional data you'd like to set for the chart before it will update. If not specified the update method will use the data that is already configured with the chart.\n * @param {Object} [options] Optional options you'd like to add to the previous options for the chart before it will update. If not specified the update method will use the options that have been already configured with the chart.\n * @param {Boolean} [override] If set to true, the passed options will be used to extend the options that have been configured already. Otherwise the chart default options will be used as the base\n * @memberof Chartist.Base\n */\n function update(data, options, override) {\n if(data) {\n this.data = data || {};\n this.data.labels = this.data.labels || [];\n this.data.series = this.data.series || [];\n // Event for data transformation that allows to manipulate the data before it gets rendered in the charts\n this.eventEmitter.emit('data', {\n type: 'update',\n data: this.data\n });\n }\n\n if(options) {\n this.options = Chartist.extend({}, override ? this.options : this.defaultOptions, options);\n\n // If chartist was not initialized yet, we just set the options and leave the rest to the initialization\n // Otherwise we re-create the optionsProvider at this point\n if(!this.initializeTimeoutId) {\n this.optionsProvider.removeMediaQueryListeners();\n this.optionsProvider = Chartist.optionsProvider(this.options, this.responsiveOptions, this.eventEmitter);\n }\n }\n\n // Only re-created the chart if it has been initialized yet\n if(!this.initializeTimeoutId) {\n this.createChart(this.optionsProvider.getCurrentOptions());\n }\n\n // Return a reference to the chart object to chain up calls\n return this;\n }\n\n /**\n * This method can be called on the API object of each chart and will un-register all event listeners that were added to other components. This currently includes a window.resize listener as well as media query listeners if any responsive options have been provided. Use this function if you need to destroy and recreate Chartist charts dynamically.\n *\n * @memberof Chartist.Base\n */\n function detach() {\n // Only detach if initialization already occurred on this chart. If this chart still hasn't initialized (therefore\n // the initializationTimeoutId is still a valid timeout reference, we will clear the timeout\n if(!this.initializeTimeoutId) {\n window.removeEventListener('resize', this.resizeListener);\n this.optionsProvider.removeMediaQueryListeners();\n } else {\n window.clearTimeout(this.initializeTimeoutId);\n }\n\n return this;\n }\n\n /**\n * Use this function to register event handlers. The handler callbacks are synchronous and will run in the main thread rather than the event loop.\n *\n * @memberof Chartist.Base\n * @param {String} event Name of the event. Check the examples for supported events.\n * @param {Function} handler The handler function that will be called when an event with the given name was emitted. This function will receive a data argument which contains event data. See the example for more details.\n */\n function on(event, handler) {\n this.eventEmitter.addEventHandler(event, handler);\n return this;\n }\n\n /**\n * Use this function to un-register event handlers. If the handler function parameter is omitted all handlers for the given event will be un-registered.\n *\n * @memberof Chartist.Base\n * @param {String} event Name of the event for which a handler should be removed\n * @param {Function} [handler] The handler function that that was previously used to register a new event handler. This handler will be removed from the event handler list. If this parameter is omitted then all event handlers for the given event are removed from the list.\n */\n function off(event, handler) {\n this.eventEmitter.removeEventHandler(event, handler);\n return this;\n }\n\n function initialize() {\n // Add window resize listener that re-creates the chart\n window.addEventListener('resize', this.resizeListener);\n\n // Obtain current options based on matching media queries (if responsive options are given)\n // This will also register a listener that is re-creating the chart based on media changes\n this.optionsProvider = Chartist.optionsProvider(this.options, this.responsiveOptions, this.eventEmitter);\n // Register options change listener that will trigger a chart update\n this.eventEmitter.addEventHandler('optionsChanged', function() {\n this.update();\n }.bind(this));\n\n // Before the first chart creation we need to register us with all plugins that are configured\n // Initialize all relevant plugins with our chart object and the plugin options specified in the config\n if(this.options.plugins) {\n this.options.plugins.forEach(function(plugin) {\n if(plugin instanceof Array) {\n plugin[0](this, plugin[1]);\n } else {\n plugin(this);\n }\n }.bind(this));\n }\n\n // Event for data transformation that allows to manipulate the data before it gets rendered in the charts\n this.eventEmitter.emit('data', {\n type: 'initial',\n data: this.data\n });\n\n // Create the first chart\n this.createChart(this.optionsProvider.getCurrentOptions());\n\n // As chart is initialized from the event loop now we can reset our timeout reference\n // This is important if the chart gets initialized on the same element twice\n this.initializeTimeoutId = undefined;\n }\n\n /**\n * Constructor of chart base class.\n *\n * @param query\n * @param data\n * @param defaultOptions\n * @param options\n * @param responsiveOptions\n * @constructor\n */\n function Base(query, data, defaultOptions, options, responsiveOptions) {\n this.container = Chartist.querySelector(query);\n this.data = data || {};\n this.data.labels = this.data.labels || [];\n this.data.series = this.data.series || [];\n this.defaultOptions = defaultOptions;\n this.options = options;\n this.responsiveOptions = responsiveOptions;\n this.eventEmitter = Chartist.EventEmitter();\n this.supportsForeignObject = Chartist.Svg.isSupported('Extensibility');\n this.supportsAnimations = Chartist.Svg.isSupported('AnimationEventsAttribute');\n this.resizeListener = function resizeListener(){\n this.update();\n }.bind(this);\n\n if(this.container) {\n // If chartist was already initialized in this container we are detaching all event listeners first\n if(this.container.__chartist__) {\n this.container.__chartist__.detach();\n }\n\n this.container.__chartist__ = this;\n }\n\n // Using event loop for first draw to make it possible to register event listeners in the same call stack where\n // the chart was created.\n this.initializeTimeoutId = setTimeout(initialize.bind(this), 0);\n }\n\n // Creating the chart base class\n Chartist.Base = Chartist.Class.extend({\n constructor: Base,\n optionsProvider: undefined,\n container: undefined,\n svg: undefined,\n eventEmitter: undefined,\n createChart: function() {\n throw new Error('Base chart type can\\'t be instantiated!');\n },\n update: update,\n detach: detach,\n on: on,\n off: off,\n version: Chartist.version,\n supportsForeignObject: false\n });\n\n}(window, document, Chartist));\n;/**\n * Chartist SVG module for simple SVG DOM abstraction\n *\n * @module Chartist.Svg\n */\n/* global Chartist */\n(function(window, document, Chartist) {\n 'use strict';\n\n /**\n * Chartist.Svg creates a new SVG object wrapper with a starting element. You can use the wrapper to fluently create sub-elements and modify them.\n *\n * @memberof Chartist.Svg\n * @constructor\n * @param {String|Element} name The name of the SVG element to create or an SVG dom element which should be wrapped into Chartist.Svg\n * @param {Object} attributes An object with properties that will be added as attributes to the SVG element that is created. Attributes with undefined values will not be added.\n * @param {String} className This class or class list will be added to the SVG element\n * @param {Object} parent The parent SVG wrapper object where this newly created wrapper and it's element will be attached to as child\n * @param {Boolean} insertFirst If this param is set to true in conjunction with a parent element the newly created element will be added as first child element in the parent element\n */\n function Svg(name, attributes, className, parent, insertFirst) {\n // If Svg is getting called with an SVG element we just return the wrapper\n if(name instanceof Element) {\n this._node = name;\n } else {\n this._node = document.createElementNS(Chartist.namespaces.svg, name);\n\n // If this is an SVG element created then custom namespace\n if(name === 'svg') {\n this.attr({\n 'xmlns:ct': Chartist.namespaces.ct\n });\n }\n }\n\n if(attributes) {\n this.attr(attributes);\n }\n\n if(className) {\n this.addClass(className);\n }\n\n if(parent) {\n if (insertFirst && parent._node.firstChild) {\n parent._node.insertBefore(this._node, parent._node.firstChild);\n } else {\n parent._node.appendChild(this._node);\n }\n }\n }\n\n /**\n * Set attributes on the current SVG element of the wrapper you're currently working on.\n *\n * @memberof Chartist.Svg\n * @param {Object|String} attributes An object with properties that will be added as attributes to the SVG element that is created. Attributes with undefined values will not be added. If this parameter is a String then the function is used as a getter and will return the attribute value.\n * @param {String} [ns] If specified, the attribute will be obtained using getAttributeNs. In order to write namepsaced attributes you can use the namespace:attribute notation within the attributes object.\n * @return {Object|String} The current wrapper object will be returned so it can be used for chaining or the attribute value if used as getter function.\n */\n function attr(attributes, ns) {\n if(typeof attributes === 'string') {\n if(ns) {\n return this._node.getAttributeNS(ns, attributes);\n } else {\n return this._node.getAttribute(attributes);\n }\n }\n\n Object.keys(attributes).forEach(function(key) {\n // If the attribute value is undefined we can skip this one\n if(attributes[key] === undefined) {\n return;\n }\n\n if (key.indexOf(':') !== -1) {\n var namespacedAttribute = key.split(':');\n this._node.setAttributeNS(Chartist.namespaces[namespacedAttribute[0]], key, attributes[key]);\n } else {\n this._node.setAttribute(key, attributes[key]);\n }\n }.bind(this));\n\n return this;\n }\n\n /**\n * Create a new SVG element whose wrapper object will be selected for further operations. This way you can also create nested groups easily.\n *\n * @memberof Chartist.Svg\n * @param {String} name The name of the SVG element that should be created as child element of the currently selected element wrapper\n * @param {Object} [attributes] An object with properties that will be added as attributes to the SVG element that is created. Attributes with undefined values will not be added.\n * @param {String} [className] This class or class list will be added to the SVG element\n * @param {Boolean} [insertFirst] If this param is set to true in conjunction with a parent element the newly created element will be added as first child element in the parent element\n * @return {Chartist.Svg} Returns a Chartist.Svg wrapper object that can be used to modify the containing SVG data\n */\n function elem(name, attributes, className, insertFirst) {\n return new Chartist.Svg(name, attributes, className, this, insertFirst);\n }\n\n /**\n * Returns the parent Chartist.SVG wrapper object\n *\n * @memberof Chartist.Svg\n * @return {Chartist.Svg} Returns a Chartist.Svg wrapper around the parent node of the current node. If the parent node is not existing or it's not an SVG node then this function will return null.\n */\n function parent() {\n return this._node.parentNode instanceof SVGElement ? new Chartist.Svg(this._node.parentNode) : null;\n }\n\n /**\n * This method returns a Chartist.Svg wrapper around the root SVG element of the current tree.\n *\n * @memberof Chartist.Svg\n * @return {Chartist.Svg} The root SVG element wrapped in a Chartist.Svg element\n */\n function root() {\n var node = this._node;\n while(node.nodeName !== 'svg') {\n node = node.parentNode;\n }\n return new Chartist.Svg(node);\n }\n\n /**\n * Find the first child SVG element of the current element that matches a CSS selector. The returned object is a Chartist.Svg wrapper.\n *\n * @memberof Chartist.Svg\n * @param {String} selector A CSS selector that is used to query for child SVG elements\n * @return {Chartist.Svg} The SVG wrapper for the element found or null if no element was found\n */\n function querySelector(selector) {\n var foundNode = this._node.querySelector(selector);\n return foundNode ? new Chartist.Svg(foundNode) : null;\n }\n\n /**\n * Find the all child SVG elements of the current element that match a CSS selector. The returned object is a Chartist.Svg.List wrapper.\n *\n * @memberof Chartist.Svg\n * @param {String} selector A CSS selector that is used to query for child SVG elements\n * @return {Chartist.Svg.List} The SVG wrapper list for the element found or null if no element was found\n */\n function querySelectorAll(selector) {\n var foundNodes = this._node.querySelectorAll(selector);\n return foundNodes.length ? new Chartist.Svg.List(foundNodes) : null;\n }\n\n /**\n * Returns the underlying SVG node for the current element.\n *\n * @memberof Chartist.Svg\n * @returns {Node}\n */\n function getNode() {\n return this._node;\n }\n\n /**\n * This method creates a foreignObject (see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/foreignObject) that allows to embed HTML content into a SVG graphic. With the help of foreignObjects you can enable the usage of regular HTML elements inside of SVG where they are subject for SVG positioning and transformation but the Browser will use the HTML rendering capabilities for the containing DOM.\n *\n * @memberof Chartist.Svg\n * @param {Node|String} content The DOM Node, or HTML string that will be converted to a DOM Node, that is then placed into and wrapped by the foreignObject\n * @param {String} [attributes] An object with properties that will be added as attributes to the foreignObject element that is created. Attributes with undefined values will not be added.\n * @param {String} [className] This class or class list will be added to the SVG element\n * @param {Boolean} [insertFirst] Specifies if the foreignObject should be inserted as first child\n * @return {Chartist.Svg} New wrapper object that wraps the foreignObject element\n */\n function foreignObject(content, attributes, className, insertFirst) {\n // If content is string then we convert it to DOM\n // TODO: Handle case where content is not a string nor a DOM Node\n if(typeof content === 'string') {\n var container = document.createElement('div');\n container.innerHTML = content;\n content = container.firstChild;\n }\n\n // Adding namespace to content element\n content.setAttribute('xmlns', Chartist.namespaces.xmlns);\n\n // Creating the foreignObject without required extension attribute (as described here\n // http://www.w3.org/TR/SVG/extend.html#ForeignObjectElement)\n var fnObj = this.elem('foreignObject', attributes, className, insertFirst);\n\n // Add content to foreignObjectElement\n fnObj._node.appendChild(content);\n\n return fnObj;\n }\n\n /**\n * This method adds a new text element to the current Chartist.Svg wrapper.\n *\n * @memberof Chartist.Svg\n * @param {String} t The text that should be added to the text element that is created\n * @return {Chartist.Svg} The same wrapper object that was used to add the newly created element\n */\n function text(t) {\n this._node.appendChild(document.createTextNode(t));\n return this;\n }\n\n /**\n * This method will clear all child nodes of the current wrapper object.\n *\n * @memberof Chartist.Svg\n * @return {Chartist.Svg} The same wrapper object that got emptied\n */\n function empty() {\n while (this._node.firstChild) {\n this._node.removeChild(this._node.firstChild);\n }\n\n return this;\n }\n\n /**\n * This method will cause the current wrapper to remove itself from its parent wrapper. Use this method if you'd like to get rid of an element in a given DOM structure.\n *\n * @memberof Chartist.Svg\n * @return {Chartist.Svg} The parent wrapper object of the element that got removed\n */\n function remove() {\n this._node.parentNode.removeChild(this._node);\n return this.parent();\n }\n\n /**\n * This method will replace the element with a new element that can be created outside of the current DOM.\n *\n * @memberof Chartist.Svg\n * @param {Chartist.Svg} newElement The new Chartist.Svg object that will be used to replace the current wrapper object\n * @return {Chartist.Svg} The wrapper of the new element\n */\n function replace(newElement) {\n this._node.parentNode.replaceChild(newElement._node, this._node);\n return newElement;\n }\n\n /**\n * This method will append an element to the current element as a child.\n *\n * @memberof Chartist.Svg\n * @param {Chartist.Svg} element The Chartist.Svg element that should be added as a child\n * @param {Boolean} [insertFirst] Specifies if the element should be inserted as first child\n * @return {Chartist.Svg} The wrapper of the appended object\n */\n function append(element, insertFirst) {\n if(insertFirst && this._node.firstChild) {\n this._node.insertBefore(element._node, this._node.firstChild);\n } else {\n this._node.appendChild(element._node);\n }\n\n return this;\n }\n\n /**\n * Returns an array of class names that are attached to the current wrapper element. This method can not be chained further.\n *\n * @memberof Chartist.Svg\n * @return {Array} A list of classes or an empty array if there are no classes on the current element\n */\n function classes() {\n return this._node.getAttribute('class') ? this._node.getAttribute('class').trim().split(/\\s+/) : [];\n }\n\n /**\n * Adds one or a space separated list of classes to the current element and ensures the classes are only existing once.\n *\n * @memberof Chartist.Svg\n * @param {String} names A white space separated list of class names\n * @return {Chartist.Svg} The wrapper of the current element\n */\n function addClass(names) {\n this._node.setAttribute('class',\n this.classes(this._node)\n .concat(names.trim().split(/\\s+/))\n .filter(function(elem, pos, self) {\n return self.indexOf(elem) === pos;\n }).join(' ')\n );\n\n return this;\n }\n\n /**\n * Removes one or a space separated list of classes from the current element.\n *\n * @memberof Chartist.Svg\n * @param {String} names A white space separated list of class names\n * @return {Chartist.Svg} The wrapper of the current element\n */\n function removeClass(names) {\n var removedClasses = names.trim().split(/\\s+/);\n\n this._node.setAttribute('class', this.classes(this._node).filter(function(name) {\n return removedClasses.indexOf(name) === -1;\n }).join(' '));\n\n return this;\n }\n\n /**\n * Removes all classes from the current element.\n *\n * @memberof Chartist.Svg\n * @return {Chartist.Svg} The wrapper of the current element\n */\n function removeAllClasses() {\n this._node.setAttribute('class', '');\n\n return this;\n }\n\n /**\n * Get element height using `getBoundingClientRect`\n *\n * @memberof Chartist.Svg\n * @return {Number} The elements height in pixels\n */\n function height() {\n return this._node.getBoundingClientRect().height;\n }\n\n /**\n * Get element width using `getBoundingClientRect`\n *\n * @memberof Chartist.Core\n * @return {Number} The elements width in pixels\n */\n function width() {\n return this._node.getBoundingClientRect().width;\n }\n\n /**\n * The animate function lets you animate the current element with SMIL animations. You can add animations for multiple attributes at the same time by using an animation definition object. This object should contain SMIL animation attributes. Please refer to http://www.w3.org/TR/SVG/animate.html for a detailed specification about the available animation attributes. Additionally an easing property can be passed in the animation definition object. This can be a string with a name of an easing function in `Chartist.Svg.Easing` or an array with four numbers specifying a cubic Bézier curve.\n * **An animations object could look like this:**\n * ```javascript\n * element.animate({\n * opacity: {\n * dur: 1000,\n * from: 0,\n * to: 1\n * },\n * x1: {\n * dur: '1000ms',\n * from: 100,\n * to: 200,\n * easing: 'easeOutQuart'\n * },\n * y1: {\n * dur: '2s',\n * from: 0,\n * to: 100\n * }\n * });\n * ```\n * **Automatic unit conversion**\n * For the `dur` and the `begin` animate attribute you can also omit a unit by passing a number. The number will automatically be converted to milli seconds.\n * **Guided mode**\n * The default behavior of SMIL animations with offset using the `begin` attribute is that the attribute will keep it's original value until the animation starts. Mostly this behavior is not desired as you'd like to have your element attributes already initialized with the animation `from` value even before the animation starts. Also if you don't specify `fill=\"freeze\"` on an animate element or if you delete the animation after it's done (which is done in guided mode) the attribute will switch back to the initial value. This behavior is also not desired when performing simple one-time animations. For one-time animations you'd want to trigger animations immediately instead of relative to the document begin time. That's why in guided mode Chartist.Svg will also use the `begin` property to schedule a timeout and manually start the animation after the timeout. If you're using multiple SMIL definition objects for an attribute (in an array), guided mode will be disabled for this attribute, even if you explicitly enabled it.\n * If guided mode is enabled the following behavior is added:\n * - Before the animation starts (even when delayed with `begin`) the animated attribute will be set already to the `from` value of the animation\n * - `begin` is explicitly set to `indefinite` so it can be started manually without relying on document begin time (creation)\n * - The animate element will be forced to use `fill=\"freeze\"`\n * - The animation will be triggered with `beginElement()` in a timeout where `begin` of the definition object is interpreted in milli seconds. If no `begin` was specified the timeout is triggered immediately.\n * - After the animation the element attribute value will be set to the `to` value of the animation\n * - The animate element is deleted from the DOM\n *\n * @memberof Chartist.Svg\n * @param {Object} animations An animations object where the property keys are the attributes you'd like to animate. The properties should be objects again that contain the SMIL animation attributes (usually begin, dur, from, and to). The property begin and dur is auto converted (see Automatic unit conversion). You can also schedule multiple animations for the same attribute by passing an Array of SMIL definition objects. Attributes that contain an array of SMIL definition objects will not be executed in guided mode.\n * @param {Boolean} guided Specify if guided mode should be activated for this animation (see Guided mode). If not otherwise specified, guided mode will be activated.\n * @param {Object} eventEmitter If specified, this event emitter will be notified when an animation starts or ends.\n * @return {Chartist.Svg} The current element where the animation was added\n */\n function animate(animations, guided, eventEmitter) {\n if(guided === undefined) {\n guided = true;\n }\n\n Object.keys(animations).forEach(function createAnimateForAttributes(attribute) {\n\n function createAnimate(animationDefinition, guided) {\n var attributeProperties = {},\n animate,\n timeout,\n easing;\n\n // Check if an easing is specified in the definition object and delete it from the object as it will not\n // be part of the animate element attributes.\n if(animationDefinition.easing) {\n // If already an easing Bézier curve array we take it or we lookup a easing array in the Easing object\n easing = animationDefinition.easing instanceof Array ?\n animationDefinition.easing :\n Chartist.Svg.Easing[animationDefinition.easing];\n delete animationDefinition.easing;\n }\n\n // If numeric dur or begin was provided we assume milli seconds\n animationDefinition.begin = Chartist.ensureUnit(animationDefinition.begin, 'ms');\n animationDefinition.dur = Chartist.ensureUnit(animationDefinition.dur, 'ms');\n\n if(easing) {\n animationDefinition.calcMode = 'spline';\n animationDefinition.keySplines = easing.join(' ');\n animationDefinition.keyTimes = '0;1';\n }\n\n // Adding \"fill: freeze\" if we are in guided mode and set initial attribute values\n if(guided) {\n animationDefinition.fill = 'freeze';\n // Animated property on our element should already be set to the animation from value in guided mode\n attributeProperties[attribute] = animationDefinition.from;\n this.attr(attributeProperties);\n\n // In guided mode we also set begin to indefinite so we can trigger the start manually and put the begin\n // which needs to be in ms aside\n timeout = Chartist.quantity(animationDefinition.begin || 0).value;\n animationDefinition.begin = 'indefinite';\n }\n\n animate = this.elem('animate', Chartist.extend({\n attributeName: attribute\n }, animationDefinition));\n\n if(guided) {\n // If guided we take the value that was put aside in timeout and trigger the animation manually with a timeout\n setTimeout(function() {\n // If beginElement fails we set the animated attribute to the end position and remove the animate element\n // This happens if the SMIL ElementTimeControl interface is not supported or any other problems occured in\n // the browser. (Currently FF 34 does not support animate elements in foreignObjects)\n try {\n animate._node.beginElement();\n } catch(err) {\n // Set animated attribute to current animated value\n attributeProperties[attribute] = animationDefinition.to;\n this.attr(attributeProperties);\n // Remove the animate element as it's no longer required\n animate.remove();\n }\n }.bind(this), timeout);\n }\n\n if(eventEmitter) {\n animate._node.addEventListener('beginEvent', function handleBeginEvent() {\n eventEmitter.emit('animationBegin', {\n element: this,\n animate: animate._node,\n params: animationDefinition\n });\n }.bind(this));\n }\n\n animate._node.addEventListener('endEvent', function handleEndEvent() {\n if(eventEmitter) {\n eventEmitter.emit('animationEnd', {\n element: this,\n animate: animate._node,\n params: animationDefinition\n });\n }\n\n if(guided) {\n // Set animated attribute to current animated value\n attributeProperties[attribute] = animationDefinition.to;\n this.attr(attributeProperties);\n // Remove the animate element as it's no longer required\n animate.remove();\n }\n }.bind(this));\n }\n\n // If current attribute is an array of definition objects we create an animate for each and disable guided mode\n if(animations[attribute] instanceof Array) {\n animations[attribute].forEach(function(animationDefinition) {\n createAnimate.bind(this)(animationDefinition, false);\n }.bind(this));\n } else {\n createAnimate.bind(this)(animations[attribute], guided);\n }\n\n }.bind(this));\n\n return this;\n }\n\n Chartist.Svg = Chartist.Class.extend({\n constructor: Svg,\n attr: attr,\n elem: elem,\n parent: parent,\n root: root,\n querySelector: querySelector,\n querySelectorAll: querySelectorAll,\n getNode: getNode,\n foreignObject: foreignObject,\n text: text,\n empty: empty,\n remove: remove,\n replace: replace,\n append: append,\n classes: classes,\n addClass: addClass,\n removeClass: removeClass,\n removeAllClasses: removeAllClasses,\n height: height,\n width: width,\n animate: animate\n });\n\n /**\n * This method checks for support of a given SVG feature like Extensibility, SVG-animation or the like. Check http://www.w3.org/TR/SVG11/feature for a detailed list.\n *\n * @memberof Chartist.Svg\n * @param {String} feature The SVG 1.1 feature that should be checked for support.\n * @return {Boolean} True of false if the feature is supported or not\n */\n Chartist.Svg.isSupported = function(feature) {\n return document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#' + feature, '1.1');\n };\n\n /**\n * This Object contains some standard easing cubic bezier curves. Then can be used with their name in the `Chartist.Svg.animate`. You can also extend the list and use your own name in the `animate` function. Click the show code button to see the available bezier functions.\n *\n * @memberof Chartist.Svg\n */\n var easingCubicBeziers = {\n easeInSine: [0.47, 0, 0.745, 0.715],\n easeOutSine: [0.39, 0.575, 0.565, 1],\n easeInOutSine: [0.445, 0.05, 0.55, 0.95],\n easeInQuad: [0.55, 0.085, 0.68, 0.53],\n easeOutQuad: [0.25, 0.46, 0.45, 0.94],\n easeInOutQuad: [0.455, 0.03, 0.515, 0.955],\n easeInCubic: [0.55, 0.055, 0.675, 0.19],\n easeOutCubic: [0.215, 0.61, 0.355, 1],\n easeInOutCubic: [0.645, 0.045, 0.355, 1],\n easeInQuart: [0.895, 0.03, 0.685, 0.22],\n easeOutQuart: [0.165, 0.84, 0.44, 1],\n easeInOutQuart: [0.77, 0, 0.175, 1],\n easeInQuint: [0.755, 0.05, 0.855, 0.06],\n easeOutQuint: [0.23, 1, 0.32, 1],\n easeInOutQuint: [0.86, 0, 0.07, 1],\n easeInExpo: [0.95, 0.05, 0.795, 0.035],\n easeOutExpo: [0.19, 1, 0.22, 1],\n easeInOutExpo: [1, 0, 0, 1],\n easeInCirc: [0.6, 0.04, 0.98, 0.335],\n easeOutCirc: [0.075, 0.82, 0.165, 1],\n easeInOutCirc: [0.785, 0.135, 0.15, 0.86],\n easeInBack: [0.6, -0.28, 0.735, 0.045],\n easeOutBack: [0.175, 0.885, 0.32, 1.275],\n easeInOutBack: [0.68, -0.55, 0.265, 1.55]\n };\n\n Chartist.Svg.Easing = easingCubicBeziers;\n\n /**\n * This helper class is to wrap multiple `Chartist.Svg` elements into a list where you can call the `Chartist.Svg` functions on all elements in the list with one call. This is helpful when you'd like to perform calls with `Chartist.Svg` on multiple elements.\n * An instance of this class is also returned by `Chartist.Svg.querySelectorAll`.\n *\n * @memberof Chartist.Svg\n * @param {Array<Node>|NodeList} nodeList An Array of SVG DOM nodes or a SVG DOM NodeList (as returned by document.querySelectorAll)\n * @constructor\n */\n function SvgList(nodeList) {\n var list = this;\n\n this.svgElements = [];\n for(var i = 0; i < nodeList.length; i++) {\n this.svgElements.push(new Chartist.Svg(nodeList[i]));\n }\n\n // Add delegation methods for Chartist.Svg\n Object.keys(Chartist.Svg.prototype).filter(function(prototypeProperty) {\n return ['constructor',\n 'parent',\n 'querySelector',\n 'querySelectorAll',\n 'replace',\n 'append',\n 'classes',\n 'height',\n 'width'].indexOf(prototypeProperty) === -1;\n }).forEach(function(prototypeProperty) {\n list[prototypeProperty] = function() {\n var args = Array.prototype.slice.call(arguments, 0);\n list.svgElements.forEach(function(element) {\n Chartist.Svg.prototype[prototypeProperty].apply(element, args);\n });\n return list;\n };\n });\n }\n\n Chartist.Svg.List = Chartist.Class.extend({\n constructor: SvgList\n });\n}(window, document, Chartist));\n;/**\n * Chartist SVG path module for SVG path description creation and modification.\n *\n * @module Chartist.Svg.Path\n */\n/* global Chartist */\n(function(window, document, Chartist) {\n 'use strict';\n\n /**\n * Contains the descriptors of supported element types in a SVG path. Currently only move, line and curve are supported.\n *\n * @memberof Chartist.Svg.Path\n * @type {Object}\n */\n var elementDescriptions = {\n m: ['x', 'y'],\n l: ['x', 'y'],\n c: ['x1', 'y1', 'x2', 'y2', 'x', 'y'],\n a: ['rx', 'ry', 'xAr', 'lAf', 'sf', 'x', 'y']\n };\n\n /**\n * Default options for newly created SVG path objects.\n *\n * @memberof Chartist.Svg.Path\n * @type {Object}\n */\n var defaultOptions = {\n // The accuracy in digit count after the decimal point. This will be used to round numbers in the SVG path. If this option is set to false then no rounding will be performed.\n accuracy: 3\n };\n\n function element(command, params, pathElements, pos, relative, data) {\n var pathElement = Chartist.extend({\n command: relative ? command.toLowerCase() : command.toUpperCase()\n }, params, data ? { data: data } : {} );\n\n pathElements.splice(pos, 0, pathElement);\n }\n\n function forEachParam(pathElements, cb) {\n pathElements.forEach(function(pathElement, pathElementIndex) {\n elementDescriptions[pathElement.command.toLowerCase()].forEach(function(paramName, paramIndex) {\n cb(pathElement, paramName, pathElementIndex, paramIndex, pathElements);\n });\n });\n }\n\n /**\n * Used to construct a new path object.\n *\n * @memberof Chartist.Svg.Path\n * @param {Boolean} close If set to true then this path will be closed when stringified (with a Z at the end)\n * @param {Object} options Options object that overrides the default objects. See default options for more details.\n * @constructor\n */\n function SvgPath(close, options) {\n this.pathElements = [];\n this.pos = 0;\n this.close = close;\n this.options = Chartist.extend({}, defaultOptions, options);\n }\n\n /**\n * Gets or sets the current position (cursor) inside of the path. You can move around the cursor freely but limited to 0 or the count of existing elements. All modifications with element functions will insert new elements at the position of this cursor.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} [pos] If a number is passed then the cursor is set to this position in the path element array.\n * @return {Chartist.Svg.Path|Number} If the position parameter was passed then the return value will be the path object for easy call chaining. If no position parameter was passed then the current position is returned.\n */\n function position(pos) {\n if(pos !== undefined) {\n this.pos = Math.max(0, Math.min(this.pathElements.length, pos));\n return this;\n } else {\n return this.pos;\n }\n }\n\n /**\n * Removes elements from the path starting at the current position.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} count Number of path elements that should be removed from the current position.\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function remove(count) {\n this.pathElements.splice(this.pos, count);\n return this;\n }\n\n /**\n * Use this function to add a new move SVG path element.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} x The x coordinate for the move element.\n * @param {Number} y The y coordinate for the move element.\n * @param {Boolean} [relative] If set to true the move element will be created with relative coordinates (lowercase letter)\n * @param {*} [data] Any data that should be stored with the element object that will be accessible in pathElement\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function move(x, y, relative, data) {\n element('M', {\n x: +x,\n y: +y\n }, this.pathElements, this.pos++, relative, data);\n return this;\n }\n\n /**\n * Use this function to add a new line SVG path element.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} x The x coordinate for the line element.\n * @param {Number} y The y coordinate for the line element.\n * @param {Boolean} [relative] If set to true the line element will be created with relative coordinates (lowercase letter)\n * @param {*} [data] Any data that should be stored with the element object that will be accessible in pathElement\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function line(x, y, relative, data) {\n element('L', {\n x: +x,\n y: +y\n }, this.pathElements, this.pos++, relative, data);\n return this;\n }\n\n /**\n * Use this function to add a new curve SVG path element.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} x1 The x coordinate for the first control point of the bezier curve.\n * @param {Number} y1 The y coordinate for the first control point of the bezier curve.\n * @param {Number} x2 The x coordinate for the second control point of the bezier curve.\n * @param {Number} y2 The y coordinate for the second control point of the bezier curve.\n * @param {Number} x The x coordinate for the target point of the curve element.\n * @param {Number} y The y coordinate for the target point of the curve element.\n * @param {Boolean} [relative] If set to true the curve element will be created with relative coordinates (lowercase letter)\n * @param {*} [data] Any data that should be stored with the element object that will be accessible in pathElement\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function curve(x1, y1, x2, y2, x, y, relative, data) {\n element('C', {\n x1: +x1,\n y1: +y1,\n x2: +x2,\n y2: +y2,\n x: +x,\n y: +y\n }, this.pathElements, this.pos++, relative, data);\n return this;\n }\n\n /**\n * Use this function to add a new non-bezier curve SVG path element.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} rx The radius to be used for the x-axis of the arc.\n * @param {Number} ry The radius to be used for the y-axis of the arc.\n * @param {Number} xAr Defines the orientation of the arc\n * @param {Number} lAf Large arc flag\n * @param {Number} sf Sweep flag\n * @param {Number} x The x coordinate for the target point of the curve element.\n * @param {Number} y The y coordinate for the target point of the curve element.\n * @param {Boolean} [relative] If set to true the curve element will be created with relative coordinates (lowercase letter)\n * @param {*} [data] Any data that should be stored with the element object that will be accessible in pathElement\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function arc(rx, ry, xAr, lAf, sf, x, y, relative, data) {\n element('A', {\n rx: +rx,\n ry: +ry,\n xAr: +xAr,\n lAf: +lAf,\n sf: +sf,\n x: +x,\n y: +y\n }, this.pathElements, this.pos++, relative, data);\n return this;\n }\n\n /**\n * Parses an SVG path seen in the d attribute of path elements, and inserts the parsed elements into the existing path object at the current cursor position. Any closing path indicators (Z at the end of the path) will be ignored by the parser as this is provided by the close option in the options of the path object.\n *\n * @memberof Chartist.Svg.Path\n * @param {String} path Any SVG path that contains move (m), line (l) or curve (c) components.\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function parse(path) {\n // Parsing the SVG path string into an array of arrays [['M', '10', '10'], ['L', '100', '100']]\n var chunks = path.replace(/([A-Za-z])([0-9])/g, '$1 $2')\n .replace(/([0-9])([A-Za-z])/g, '$1 $2')\n .split(/[\\s,]+/)\n .reduce(function(result, element) {\n if(element.match(/[A-Za-z]/)) {\n result.push([]);\n }\n\n result[result.length - 1].push(element);\n return result;\n }, []);\n\n // If this is a closed path we remove the Z at the end because this is determined by the close option\n if(chunks[chunks.length - 1][0].toUpperCase() === 'Z') {\n chunks.pop();\n }\n\n // Using svgPathElementDescriptions to map raw path arrays into objects that contain the command and the parameters\n // For example {command: 'M', x: '10', y: '10'}\n var elements = chunks.map(function(chunk) {\n var command = chunk.shift(),\n description = elementDescriptions[command.toLowerCase()];\n\n return Chartist.extend({\n command: command\n }, description.reduce(function(result, paramName, index) {\n result[paramName] = +chunk[index];\n return result;\n }, {}));\n });\n\n // Preparing a splice call with the elements array as var arg params and insert the parsed elements at the current position\n var spliceArgs = [this.pos, 0];\n Array.prototype.push.apply(spliceArgs, elements);\n Array.prototype.splice.apply(this.pathElements, spliceArgs);\n // Increase the internal position by the element count\n this.pos += elements.length;\n\n return this;\n }\n\n /**\n * This function renders to current SVG path object into a final SVG string that can be used in the d attribute of SVG path elements. It uses the accuracy option to round big decimals. If the close parameter was set in the constructor of this path object then a path closing Z will be appended to the output string.\n *\n * @memberof Chartist.Svg.Path\n * @return {String}\n */\n function stringify() {\n var accuracyMultiplier = Math.pow(10, this.options.accuracy);\n\n return this.pathElements.reduce(function(path, pathElement) {\n var params = elementDescriptions[pathElement.command.toLowerCase()].map(function(paramName) {\n return this.options.accuracy ?\n (Math.round(pathElement[paramName] * accuracyMultiplier) / accuracyMultiplier) :\n pathElement[paramName];\n }.bind(this));\n\n return path + pathElement.command + params.join(',');\n }.bind(this), '') + (this.close ? 'Z' : '');\n }\n\n /**\n * Scales all elements in the current SVG path object. There is an individual parameter for each coordinate. Scaling will also be done for control points of curves, affecting the given coordinate.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} x The number which will be used to scale the x, x1 and x2 of all path elements.\n * @param {Number} y The number which will be used to scale the y, y1 and y2 of all path elements.\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function scale(x, y) {\n forEachParam(this.pathElements, function(pathElement, paramName) {\n pathElement[paramName] *= paramName[0] === 'x' ? x : y;\n });\n return this;\n }\n\n /**\n * Translates all elements in the current SVG path object. The translation is relative and there is an individual parameter for each coordinate. Translation will also be done for control points of curves, affecting the given coordinate.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} x The number which will be used to translate the x, x1 and x2 of all path elements.\n * @param {Number} y The number which will be used to translate the y, y1 and y2 of all path elements.\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function translate(x, y) {\n forEachParam(this.pathElements, function(pathElement, paramName) {\n pathElement[paramName] += paramName[0] === 'x' ? x : y;\n });\n return this;\n }\n\n /**\n * This function will run over all existing path elements and then loop over their attributes. The callback function will be called for every path element attribute that exists in the current path.\n * The method signature of the callback function looks like this:\n * ```javascript\n * function(pathElement, paramName, pathElementIndex, paramIndex, pathElements)\n * ```\n * If something else than undefined is returned by the callback function, this value will be used to replace the old value. This allows you to build custom transformations of path objects that can't be achieved using the basic transformation functions scale and translate.\n *\n * @memberof Chartist.Svg.Path\n * @param {Function} transformFnc The callback function for the transformation. Check the signature in the function description.\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function transform(transformFnc) {\n forEachParam(this.pathElements, function(pathElement, paramName, pathElementIndex, paramIndex, pathElements) {\n var transformed = transformFnc(pathElement, paramName, pathElementIndex, paramIndex, pathElements);\n if(transformed || transformed === 0) {\n pathElement[paramName] = transformed;\n }\n });\n return this;\n }\n\n /**\n * This function clones a whole path object with all its properties. This is a deep clone and path element objects will also be cloned.\n *\n * @memberof Chartist.Svg.Path\n * @param {Boolean} [close] Optional option to set the new cloned path to closed. If not specified or false, the original path close option will be used.\n * @return {Chartist.Svg.Path}\n */\n function clone(close) {\n var c = new Chartist.Svg.Path(close || this.close);\n c.pos = this.pos;\n c.pathElements = this.pathElements.slice().map(function cloneElements(pathElement) {\n return Chartist.extend({}, pathElement);\n });\n c.options = Chartist.extend({}, this.options);\n return c;\n }\n\n /**\n * Split a Svg.Path object by a specific command in the path chain. The path chain will be split and an array of newly created paths objects will be returned. This is useful if you'd like to split an SVG path by it's move commands, for example, in order to isolate chunks of drawings.\n *\n * @memberof Chartist.Svg.Path\n * @param {String} command The command you'd like to use to split the path\n * @return {Array<Chartist.Svg.Path>}\n */\n function splitByCommand(command) {\n var split = [\n new Chartist.Svg.Path()\n ];\n\n this.pathElements.forEach(function(pathElement) {\n if(pathElement.command === command.toUpperCase() && split[split.length - 1].pathElements.length !== 0) {\n split.push(new Chartist.Svg.Path());\n }\n\n split[split.length - 1].pathElements.push(pathElement);\n });\n\n return split;\n }\n\n /**\n * This static function on `Chartist.Svg.Path` is joining multiple paths together into one paths.\n *\n * @memberof Chartist.Svg.Path\n * @param {Array<Chartist.Svg.Path>} paths A list of paths to be joined together. The order is important.\n * @param {boolean} close If the newly created path should be a closed path\n * @param {Object} options Path options for the newly created path.\n * @return {Chartist.Svg.Path}\n */\n\n function join(paths, close, options) {\n var joinedPath = new Chartist.Svg.Path(close, options);\n for(var i = 0; i < paths.length; i++) {\n var path = paths[i];\n for(var j = 0; j < path.pathElements.length; j++) {\n joinedPath.pathElements.push(path.pathElements[j]);\n }\n }\n return joinedPath;\n }\n\n Chartist.Svg.Path = Chartist.Class.extend({\n constructor: SvgPath,\n position: position,\n remove: remove,\n move: move,\n line: line,\n curve: curve,\n arc: arc,\n scale: scale,\n translate: translate,\n transform: transform,\n parse: parse,\n stringify: stringify,\n clone: clone,\n splitByCommand: splitByCommand\n });\n\n Chartist.Svg.Path.elementDescriptions = elementDescriptions;\n Chartist.Svg.Path.join = join;\n}(window, document, Chartist));\n;/* global Chartist */\n(function (window, document, Chartist) {\n 'use strict';\n\n var axisUnits = {\n x: {\n pos: 'x',\n len: 'width',\n dir: 'horizontal',\n rectStart: 'x1',\n rectEnd: 'x2',\n rectOffset: 'y2'\n },\n y: {\n pos: 'y',\n len: 'height',\n dir: 'vertical',\n rectStart: 'y2',\n rectEnd: 'y1',\n rectOffset: 'x1'\n }\n };\n\n function Axis(units, chartRect, ticks, options) {\n this.units = units;\n this.counterUnits = units === axisUnits.x ? axisUnits.y : axisUnits.x;\n this.chartRect = chartRect;\n this.axisLength = chartRect[units.rectEnd] - chartRect[units.rectStart];\n this.gridOffset = chartRect[units.rectOffset];\n this.ticks = ticks;\n this.options = options;\n }\n\n function createGridAndLabels(gridGroup, labelGroup, useForeignObject, chartOptions, eventEmitter) {\n var axisOptions = chartOptions['axis' + this.units.pos.toUpperCase()];\n var projectedValues = this.ticks.map(this.projectValue.bind(this));\n var labelValues = this.ticks.map(axisOptions.labelInterpolationFnc);\n\n projectedValues.forEach(function(projectedValue, index) {\n var labelOffset = {\n x: 0,\n y: 0\n };\n\n // TODO: Find better solution for solving this problem\n // Calculate how much space we have available for the label\n var labelLength;\n if(projectedValues[index + 1]) {\n // If we still have one label ahead, we can calculate the distance to the next tick / label\n labelLength = projectedValues[index + 1] - projectedValue;\n } else {\n // If we don't have a label ahead and we have only two labels in total, we just take the remaining distance to\n // on the whole axis length. We limit that to a minimum of 30 pixel, so that labels close to the border will\n // still be visible inside of the chart padding.\n labelLength = Math.max(this.axisLength - projectedValue, 30);\n }\n\n // Skip grid lines and labels where interpolated label values are falsey (execpt for 0)\n if(Chartist.isFalseyButZero(labelValues[index]) && labelValues[index] !== '') {\n return;\n }\n\n // Transform to global coordinates using the chartRect\n // We also need to set the label offset for the createLabel function\n if(this.units.pos === 'x') {\n projectedValue = this.chartRect.x1 + projectedValue;\n labelOffset.x = chartOptions.axisX.labelOffset.x;\n\n // If the labels should be positioned in start position (top side for vertical axis) we need to set a\n // different offset as for positioned with end (bottom)\n if(chartOptions.axisX.position === 'start') {\n labelOffset.y = this.chartRect.padding.top + chartOptions.axisX.labelOffset.y + (useForeignObject ? 5 : 20);\n } else {\n labelOffset.y = this.chartRect.y1 + chartOptions.axisX.labelOffset.y + (useForeignObject ? 5 : 20);\n }\n } else {\n projectedValue = this.chartRect.y1 - projectedValue;\n labelOffset.y = chartOptions.axisY.labelOffset.y - (useForeignObject ? labelLength : 0);\n\n // If the labels should be positioned in start position (left side for horizontal axis) we need to set a\n // different offset as for positioned with end (right side)\n if(chartOptions.axisY.position === 'start') {\n labelOffset.x = useForeignObject ? this.chartRect.padding.left + chartOptions.axisY.labelOffset.x : this.chartRect.x1 - 10;\n } else {\n labelOffset.x = this.chartRect.x2 + chartOptions.axisY.labelOffset.x + 10;\n }\n }\n\n if(axisOptions.showGrid) {\n Chartist.createGrid(projectedValue, index, this, this.gridOffset, this.chartRect[this.counterUnits.len](), gridGroup, [\n chartOptions.classNames.grid,\n chartOptions.classNames[this.units.dir]\n ], eventEmitter);\n }\n\n if(axisOptions.showLabel) {\n Chartist.createLabel(projectedValue, labelLength, index, labelValues, this, axisOptions.offset, labelOffset, labelGroup, [\n chartOptions.classNames.label,\n chartOptions.classNames[this.units.dir],\n (axisOptions.position === 'start' ? chartOptions.classNames[axisOptions.position] : chartOptions.classNames['end'])\n ], useForeignObject, eventEmitter);\n }\n }.bind(this));\n }\n\n Chartist.Axis = Chartist.Class.extend({\n constructor: Axis,\n createGridAndLabels: createGridAndLabels,\n projectValue: function(value, index, data) {\n throw new Error('Base axis can\\'t be instantiated!');\n }\n });\n\n Chartist.Axis.units = axisUnits;\n\n}(window, document, Chartist));\n;/**\n * The auto scale axis uses standard linear scale projection of values along an axis. It uses order of magnitude to find a scale automatically and evaluates the available space in order to find the perfect amount of ticks for your chart.\n * **Options**\n * The following options are used by this axis in addition to the default axis options outlined in the axis configuration of the chart default settings.\n * ```javascript\n * var options = {\n * // If high is specified then the axis will display values explicitly up to this value and the computed maximum from the data is ignored\n * high: 100,\n * // If low is specified then the axis will display values explicitly down to this value and the computed minimum from the data is ignored\n * low: 0,\n * // This option will be used when finding the right scale division settings. The amount of ticks on the scale will be determined so that as many ticks as possible will be displayed, while not violating this minimum required space (in pixel).\n * scaleMinSpace: 20,\n * // Can be set to true or false. If set to true, the scale will be generated with whole numbers only.\n * onlyInteger: true,\n * // The reference value can be used to make sure that this value will always be on the chart. This is especially useful on bipolar charts where the bipolar center always needs to be part of the chart.\n * referenceValue: 5\n * };\n * ```\n *\n * @module Chartist.AutoScaleAxis\n */\n/* global Chartist */\n(function (window, document, Chartist) {\n 'use strict';\n\n function AutoScaleAxis(axisUnit, data, chartRect, options) {\n // Usually we calculate highLow based on the data but this can be overriden by a highLow object in the options\n var highLow = options.highLow || Chartist.getHighLow(data, options, axisUnit.pos);\n this.bounds = Chartist.getBounds(chartRect[axisUnit.rectEnd] - chartRect[axisUnit.rectStart], highLow, options.scaleMinSpace || 20, options.onlyInteger);\n this.range = {\n min: this.bounds.min,\n max: this.bounds.max\n };\n\n Chartist.AutoScaleAxis.super.constructor.call(this,\n axisUnit,\n chartRect,\n this.bounds.values,\n options);\n }\n\n function projectValue(value) {\n return this.axisLength * (+Chartist.getMultiValue(value, this.units.pos) - this.bounds.min) / this.bounds.range;\n }\n\n Chartist.AutoScaleAxis = Chartist.Axis.extend({\n constructor: AutoScaleAxis,\n projectValue: projectValue\n });\n\n}(window, document, Chartist));\n;/**\n * The fixed scale axis uses standard linear projection of values along an axis. It makes use of a divisor option to divide the range provided from the minimum and maximum value or the options high and low that will override the computed minimum and maximum.\n * **Options**\n * The following options are used by this axis in addition to the default axis options outlined in the axis configuration of the chart default settings.\n * ```javascript\n * var options = {\n * // If high is specified then the axis will display values explicitly up to this value and the computed maximum from the data is ignored\n * high: 100,\n * // If low is specified then the axis will display values explicitly down to this value and the computed minimum from the data is ignored\n * low: 0,\n * // If specified then the value range determined from minimum to maximum (or low and high) will be divided by this number and ticks will be generated at those division points. The default divisor is 1.\n * divisor: 4,\n * // If ticks is explicitly set, then the axis will not compute the ticks with the divisor, but directly use the data in ticks to determine at what points on the axis a tick need to be generated.\n * ticks: [1, 10, 20, 30]\n * };\n * ```\n *\n * @module Chartist.FixedScaleAxis\n */\n/* global Chartist */\n(function (window, document, Chartist) {\n 'use strict';\n\n function FixedScaleAxis(axisUnit, data, chartRect, options) {\n var highLow = options.highLow || Chartist.getHighLow(data, options, axisUnit.pos);\n this.divisor = options.divisor || 1;\n this.ticks = options.ticks || Chartist.times(this.divisor).map(function(value, index) {\n return highLow.low + (highLow.high - highLow.low) / this.divisor * index;\n }.bind(this));\n this.ticks.sort(function(a, b) {\n return a - b;\n });\n this.range = {\n min: highLow.low,\n max: highLow.high\n };\n\n Chartist.FixedScaleAxis.super.constructor.call(this,\n axisUnit,\n chartRect,\n this.ticks,\n options);\n\n this.stepLength = this.axisLength / this.divisor;\n }\n\n function projectValue(value) {\n return this.axisLength * (+Chartist.getMultiValue(value, this.units.pos) - this.range.min) / (this.range.max - this.range.min);\n }\n\n Chartist.FixedScaleAxis = Chartist.Axis.extend({\n constructor: FixedScaleAxis,\n projectValue: projectValue\n });\n\n}(window, document, Chartist));\n;/**\n * The step axis for step based charts like bar chart or step based line charts. It uses a fixed amount of ticks that will be equally distributed across the whole axis length. The projection is done using the index of the data value rather than the value itself and therefore it's only useful for distribution purpose.\n * **Options**\n * The following options are used by this axis in addition to the default axis options outlined in the axis configuration of the chart default settings.\n * ```javascript\n * var options = {\n * // Ticks to be used to distribute across the axis length. As this axis type relies on the index of the value rather than the value, arbitrary data that can be converted to a string can be used as ticks.\n * ticks: ['One', 'Two', 'Three'],\n * // If set to true the full width will be used to distribute the values where the last value will be at the maximum of the axis length. If false the spaces between the ticks will be evenly distributed instead.\n * stretch: true\n * };\n * ```\n *\n * @module Chartist.StepAxis\n */\n/* global Chartist */\n(function (window, document, Chartist) {\n 'use strict';\n\n function StepAxis(axisUnit, data, chartRect, options) {\n Chartist.StepAxis.super.constructor.call(this,\n axisUnit,\n chartRect,\n options.ticks,\n options);\n\n var calc = Math.max(1, options.ticks.length - (options.stretch ? 1 : 0));\n this.stepLength = this.axisLength / calc;\n }\n\n function projectValue(value, index) {\n return this.stepLength * index;\n }\n\n Chartist.StepAxis = Chartist.Axis.extend({\n constructor: StepAxis,\n projectValue: projectValue\n });\n\n}(window, document, Chartist));\n;/**\n * The Chartist line chart can be used to draw Line or Scatter charts. If used in the browser you can access the global `Chartist` namespace where you find the `Line` function as a main entry point.\n *\n * For examples on how to use the line chart please check the examples of the `Chartist.Line` method.\n *\n * @module Chartist.Line\n */\n/* global Chartist */\n(function(window, document, Chartist){\n 'use strict';\n\n /**\n * Default options in line charts. Expand the code view to see a detailed list of options with comments.\n *\n * @memberof Chartist.Line\n */\n var defaultOptions = {\n // Options for X-Axis\n axisX: {\n // The offset of the labels to the chart area\n offset: 30,\n // Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis.\n position: 'end',\n // Allows you to correct label positioning on this axis by positive or negative x and y offset.\n labelOffset: {\n x: 0,\n y: 0\n },\n // If labels should be shown or not\n showLabel: true,\n // If the axis grid should be drawn or not\n showGrid: true,\n // Interpolation function that allows you to intercept the value from the axis label\n labelInterpolationFnc: Chartist.noop,\n // Set the axis type to be used to project values on this axis. If not defined, Chartist.StepAxis will be used for the X-Axis, where the ticks option will be set to the labels in the data and the stretch option will be set to the global fullWidth option. This type can be changed to any axis constructor available (e.g. Chartist.FixedScaleAxis), where all axis options should be present here.\n type: undefined\n },\n // Options for Y-Axis\n axisY: {\n // The offset of the labels to the chart area\n offset: 40,\n // Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis.\n position: 'start',\n // Allows you to correct label positioning on this axis by positive or negative x and y offset.\n labelOffset: {\n x: 0,\n y: 0\n },\n // If labels should be shown or not\n showLabel: true,\n // If the axis grid should be drawn or not\n showGrid: true,\n // Interpolation function that allows you to intercept the value from the axis label\n labelInterpolationFnc: Chartist.noop,\n // Set the axis type to be used to project values on this axis. If not defined, Chartist.AutoScaleAxis will be used for the Y-Axis, where the high and low options will be set to the global high and low options. This type can be changed to any axis constructor available (e.g. Chartist.FixedScaleAxis), where all axis options should be present here.\n type: undefined,\n // This value specifies the minimum height in pixel of the scale steps\n scaleMinSpace: 20,\n // Use only integer values (whole numbers) for the scale steps\n onlyInteger: false\n },\n // Specify a fixed width for the chart as a string (i.e. '100px' or '50%')\n width: undefined,\n // Specify a fixed height for the chart as a string (i.e. '100px' or '50%')\n height: undefined,\n // If the line should be drawn or not\n showLine: true,\n // If dots should be drawn or not\n showPoint: true,\n // If the line chart should draw an area\n showArea: false,\n // The base for the area chart that will be used to close the area shape (is normally 0)\n areaBase: 0,\n // Specify if the lines should be smoothed. This value can be true or false where true will result in smoothing using the default smoothing interpolation function Chartist.Interpolation.cardinal and false results in Chartist.Interpolation.none. You can also choose other smoothing / interpolation functions available in the Chartist.Interpolation module, or write your own interpolation function. Check the examples for a brief description.\n lineSmooth: true,\n // If the line chart should add a background fill to the .ct-grids group.\n showGridBackground: false,\n // Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value\n low: undefined,\n // Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value\n high: undefined,\n // Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5}\n chartPadding: {\n top: 15,\n right: 15,\n bottom: 5,\n left: 10\n },\n // When set to true, the last grid line on the x-axis is not drawn and the chart elements will expand to the full available width of the chart. For the last label to be drawn correctly you might need to add chart padding or offset the last label with a draw event handler.\n fullWidth: false,\n // If true the whole data is reversed including labels, the series order as well as the whole series data arrays.\n reverseData: false,\n // Override the class names that get used to generate the SVG structure of the chart\n classNames: {\n chart: 'ct-chart-line',\n label: 'ct-label',\n labelGroup: 'ct-labels',\n series: 'ct-series',\n line: 'ct-line',\n point: 'ct-point',\n area: 'ct-area',\n grid: 'ct-grid',\n gridGroup: 'ct-grids',\n gridBackground: 'ct-grid-background',\n vertical: 'ct-vertical',\n horizontal: 'ct-horizontal',\n start: 'ct-start',\n end: 'ct-end'\n }\n };\n\n /**\n * Creates a new chart\n *\n */\n function createChart(options) {\n var data = Chartist.normalizeData(this.data, options.reverseData, true);\n\n // Create new svg object\n this.svg = Chartist.createSvg(this.container, options.width, options.height, options.classNames.chart);\n // Create groups for labels, grid and series\n var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n var seriesGroup = this.svg.elem('g');\n var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\n var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n var axisX, axisY;\n\n if(options.axisX.type === undefined) {\n axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n ticks: data.normalized.labels,\n stretch: options.fullWidth\n }));\n } else {\n axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, options.axisX);\n }\n\n if(options.axisY.type === undefined) {\n axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n high: Chartist.isNumeric(options.high) ? options.high : options.axisY.high,\n low: Chartist.isNumeric(options.low) ? options.low : options.axisY.low\n }));\n } else {\n axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, options.axisY);\n }\n\n axisX.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n axisY.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\n if (options.showGridBackground) {\n Chartist.createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);\n }\n\n // Draw the series\n data.raw.series.forEach(function(series, seriesIndex) {\n var seriesElement = seriesGroup.elem('g');\n\n // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n seriesElement.attr({\n 'ct:series-name': series.name,\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // Use series class from series data or if not set generate one\n seriesElement.addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))\n ].join(' '));\n\n var pathCoordinates = [],\n pathData = [];\n\n data.normalized.series[seriesIndex].forEach(function(value, valueIndex) {\n var p = {\n x: chartRect.x1 + axisX.projectValue(value, valueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - axisY.projectValue(value, valueIndex, data.normalized.series[seriesIndex])\n };\n pathCoordinates.push(p.x, p.y);\n pathData.push({\n value: value,\n valueIndex: valueIndex,\n meta: Chartist.getMetaData(series, valueIndex)\n });\n }.bind(this));\n\n var seriesOptions = {\n lineSmooth: Chartist.getSeriesOption(series, options, 'lineSmooth'),\n showPoint: Chartist.getSeriesOption(series, options, 'showPoint'),\n showLine: Chartist.getSeriesOption(series, options, 'showLine'),\n showArea: Chartist.getSeriesOption(series, options, 'showArea'),\n areaBase: Chartist.getSeriesOption(series, options, 'areaBase')\n };\n\n var smoothing = typeof seriesOptions.lineSmooth === 'function' ?\n seriesOptions.lineSmooth : (seriesOptions.lineSmooth ? Chartist.Interpolation.monotoneCubic() : Chartist.Interpolation.none());\n // Interpolating path where pathData will be used to annotate each path element so we can trace back the original\n // index, value and meta data\n var path = smoothing(pathCoordinates, pathData);\n\n // If we should show points we need to create them now to avoid secondary loop\n // Points are drawn from the pathElements returned by the interpolation function\n // Small offset for Firefox to render squares correctly\n if (seriesOptions.showPoint) {\n\n path.pathElements.forEach(function(pathElement) {\n var point = seriesElement.elem('line', {\n x1: pathElement.x,\n y1: pathElement.y,\n x2: pathElement.x + 0.01,\n y2: pathElement.y\n }, options.classNames.point).attr({\n 'ct:value': [pathElement.data.value.x, pathElement.data.value.y].filter(Chartist.isNumeric).join(','),\n 'ct:meta': Chartist.serialize(pathElement.data.meta)\n });\n\n this.eventEmitter.emit('draw', {\n type: 'point',\n value: pathElement.data.value,\n index: pathElement.data.valueIndex,\n meta: pathElement.data.meta,\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n group: seriesElement,\n element: point,\n x: pathElement.x,\n y: pathElement.y\n });\n }.bind(this));\n }\n\n if(seriesOptions.showLine) {\n var line = seriesElement.elem('path', {\n d: path.stringify()\n }, options.classNames.line, true);\n\n this.eventEmitter.emit('draw', {\n type: 'line',\n values: data.normalized.series[seriesIndex],\n path: path.clone(),\n chartRect: chartRect,\n index: seriesIndex,\n series: series,\n seriesIndex: seriesIndex,\n seriesMeta: series.meta,\n axisX: axisX,\n axisY: axisY,\n group: seriesElement,\n element: line\n });\n }\n\n // Area currently only works with axes that support a range!\n if(seriesOptions.showArea && axisY.range) {\n // If areaBase is outside the chart area (< min or > max) we need to set it respectively so that\n // the area is not drawn outside the chart area.\n var areaBase = Math.max(Math.min(seriesOptions.areaBase, axisY.range.max), axisY.range.min);\n\n // We project the areaBase value into screen coordinates\n var areaBaseProjected = chartRect.y1 - axisY.projectValue(areaBase);\n\n // In order to form the area we'll first split the path by move commands so we can chunk it up into segments\n path.splitByCommand('M').filter(function onlySolidSegments(pathSegment) {\n // We filter only \"solid\" segments that contain more than one point. Otherwise there's no need for an area\n return pathSegment.pathElements.length > 1;\n }).map(function convertToArea(solidPathSegments) {\n // Receiving the filtered solid path segments we can now convert those segments into fill areas\n var firstElement = solidPathSegments.pathElements[0];\n var lastElement = solidPathSegments.pathElements[solidPathSegments.pathElements.length - 1];\n\n // Cloning the solid path segment with closing option and removing the first move command from the clone\n // We then insert a new move that should start at the area base and draw a straight line up or down\n // at the end of the path we add an additional straight line to the projected area base value\n // As the closing option is set our path will be automatically closed\n return solidPathSegments.clone(true)\n .position(0)\n .remove(1)\n .move(firstElement.x, areaBaseProjected)\n .line(firstElement.x, firstElement.y)\n .position(solidPathSegments.pathElements.length + 1)\n .line(lastElement.x, areaBaseProjected);\n\n }).forEach(function createArea(areaPath) {\n // For each of our newly created area paths, we'll now create path elements by stringifying our path objects\n // and adding the created DOM elements to the correct series group\n var area = seriesElement.elem('path', {\n d: areaPath.stringify()\n }, options.classNames.area, true);\n\n // Emit an event for each area that was drawn\n this.eventEmitter.emit('draw', {\n type: 'area',\n values: data.normalized.series[seriesIndex],\n path: areaPath.clone(),\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n chartRect: chartRect,\n index: seriesIndex,\n group: seriesElement,\n element: area\n });\n }.bind(this));\n }\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n bounds: axisY.bounds,\n chartRect: chartRect,\n axisX: axisX,\n axisY: axisY,\n svg: this.svg,\n options: options\n });\n }\n\n /**\n * This method creates a new line chart.\n *\n * @memberof Chartist.Line\n * @param {String|Node} query A selector query string or directly a DOM element\n * @param {Object} data The data object that needs to consist of a labels and a series array\n * @param {Object} [options] The options object with options that override the default options. Check the examples for a detailed list.\n * @param {Array} [responsiveOptions] Specify an array of responsive option arrays which are a media query and options object pair => [[mediaQueryString, optionsObject],[more...]]\n * @return {Object} An object which exposes the API for the created chart\n *\n * @example\n * // Create a simple line chart\n * var data = {\n * // A labels array that can contain any sort of values\n * labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],\n * // Our series array that contains series objects or in this case series data arrays\n * series: [\n * [5, 2, 4, 2, 0]\n * ]\n * };\n *\n * // As options we currently only set a static size of 300x200 px\n * var options = {\n * width: '300px',\n * height: '200px'\n * };\n *\n * // In the global name space Chartist we call the Line function to initialize a line chart. As a first parameter we pass in a selector where we would like to get our chart created. Second parameter is the actual data object and as a third parameter we pass in our options\n * new Chartist.Line('.ct-chart', data, options);\n *\n * @example\n * // Use specific interpolation function with configuration from the Chartist.Interpolation module\n *\n * var chart = new Chartist.Line('.ct-chart', {\n * labels: [1, 2, 3, 4, 5],\n * series: [\n * [1, 1, 8, 1, 7]\n * ]\n * }, {\n * lineSmooth: Chartist.Interpolation.cardinal({\n * tension: 0.2\n * })\n * });\n *\n * @example\n * // Create a line chart with responsive options\n *\n * var data = {\n * // A labels array that can contain any sort of values\n * labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],\n * // Our series array that contains series objects or in this case series data arrays\n * series: [\n * [5, 2, 4, 2, 0]\n * ]\n * };\n *\n * // In addition to the regular options we specify responsive option overrides that will override the default configutation based on the matching media queries.\n * var responsiveOptions = [\n * ['screen and (min-width: 641px) and (max-width: 1024px)', {\n * showPoint: false,\n * axisX: {\n * labelInterpolationFnc: function(value) {\n * // Will return Mon, Tue, Wed etc. on medium screens\n * return value.slice(0, 3);\n * }\n * }\n * }],\n * ['screen and (max-width: 640px)', {\n * showLine: false,\n * axisX: {\n * labelInterpolationFnc: function(value) {\n * // Will return M, T, W etc. on small screens\n * return value[0];\n * }\n * }\n * }]\n * ];\n *\n * new Chartist.Line('.ct-chart', data, null, responsiveOptions);\n *\n */\n function Line(query, data, options, responsiveOptions) {\n Chartist.Line.super.constructor.call(this,\n query,\n data,\n defaultOptions,\n Chartist.extend({}, defaultOptions, options),\n responsiveOptions);\n }\n\n // Creating line chart type in Chartist namespace\n Chartist.Line = Chartist.Base.extend({\n constructor: Line,\n createChart: createChart\n });\n\n}(window, document, Chartist));\n;/**\n * The bar chart module of Chartist that can be used to draw unipolar or bipolar bar and grouped bar charts.\n *\n * @module Chartist.Bar\n */\n/* global Chartist */\n(function(window, document, Chartist){\n 'use strict';\n\n /**\n * Default options in bar charts. Expand the code view to see a detailed list of options with comments.\n *\n * @memberof Chartist.Bar\n */\n var defaultOptions = {\n // Options for X-Axis\n axisX: {\n // The offset of the chart drawing area to the border of the container\n offset: 30,\n // Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis.\n position: 'end',\n // Allows you to correct label positioning on this axis by positive or negative x and y offset.\n labelOffset: {\n x: 0,\n y: 0\n },\n // If labels should be shown or not\n showLabel: true,\n // If the axis grid should be drawn or not\n showGrid: true,\n // Interpolation function that allows you to intercept the value from the axis label\n labelInterpolationFnc: Chartist.noop,\n // This value specifies the minimum width in pixel of the scale steps\n scaleMinSpace: 30,\n // Use only integer values (whole numbers) for the scale steps\n onlyInteger: false\n },\n // Options for Y-Axis\n axisY: {\n // The offset of the chart drawing area to the border of the container\n offset: 40,\n // Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis.\n position: 'start',\n // Allows you to correct label positioning on this axis by positive or negative x and y offset.\n labelOffset: {\n x: 0,\n y: 0\n },\n // If labels should be shown or not\n showLabel: true,\n // If the axis grid should be drawn or not\n showGrid: true,\n // Interpolation function that allows you to intercept the value from the axis label\n labelInterpolationFnc: Chartist.noop,\n // This value specifies the minimum height in pixel of the scale steps\n scaleMinSpace: 20,\n // Use only integer values (whole numbers) for the scale steps\n onlyInteger: false\n },\n // Specify a fixed width for the chart as a string (i.e. '100px' or '50%')\n width: undefined,\n // Specify a fixed height for the chart as a string (i.e. '100px' or '50%')\n height: undefined,\n // Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value\n high: undefined,\n // Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value\n low: undefined,\n // Unless low/high are explicitly set, bar chart will be centered at zero by default. Set referenceValue to null to auto scale.\n referenceValue: 0,\n // Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5}\n chartPadding: {\n top: 15,\n right: 15,\n bottom: 5,\n left: 10\n },\n // Specify the distance in pixel of bars in a group\n seriesBarDistance: 15,\n // If set to true this property will cause the series bars to be stacked. Check the `stackMode` option for further stacking options.\n stackBars: false,\n // If set to 'overlap' this property will force the stacked bars to draw from the zero line.\n // If set to 'accumulate' this property will form a total for each series point. This will also influence the y-axis and the overall bounds of the chart. In stacked mode the seriesBarDistance property will have no effect.\n stackMode: 'accumulate',\n // Inverts the axes of the bar chart in order to draw a horizontal bar chart. Be aware that you also need to invert your axis settings as the Y Axis will now display the labels and the X Axis the values.\n horizontalBars: false,\n // If set to true then each bar will represent a series and the data array is expected to be a one dimensional array of data values rather than a series array of series. This is useful if the bar chart should represent a profile rather than some data over time.\n distributeSeries: false,\n // If true the whole data is reversed including labels, the series order as well as the whole series data arrays.\n reverseData: false,\n // If the bar chart should add a background fill to the .ct-grids group.\n showGridBackground: false,\n // Override the class names that get used to generate the SVG structure of the chart\n classNames: {\n chart: 'ct-chart-bar',\n horizontalBars: 'ct-horizontal-bars',\n label: 'ct-label',\n labelGroup: 'ct-labels',\n series: 'ct-series',\n bar: 'ct-bar',\n grid: 'ct-grid',\n gridGroup: 'ct-grids',\n gridBackground: 'ct-grid-background',\n vertical: 'ct-vertical',\n horizontal: 'ct-horizontal',\n start: 'ct-start',\n end: 'ct-end'\n }\n };\n\n /**\n * Creates a new chart\n *\n */\n function createChart(options) {\n var data;\n var highLow;\n\n if(options.distributeSeries) {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n data.normalized.series = data.normalized.series.map(function(value) {\n return [value];\n });\n } else {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n }\n\n // Create new svg element\n this.svg = Chartist.createSvg(\n this.container,\n options.width,\n options.height,\n options.classNames.chart + (options.horizontalBars ? ' ' + options.classNames.horizontalBars : '')\n );\n\n // Drawing groups in correct order\n var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n var seriesGroup = this.svg.elem('g');\n var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\n if(options.stackBars && data.normalized.series.length !== 0) {\n\n // If stacked bars we need to calculate the high low from stacked values from each series\n var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {\n return Array.prototype.slice.call(arguments).map(function(value) {\n return value;\n }).reduce(function(prev, curr) {\n return {\n x: prev.x + (curr && curr.x) || 0,\n y: prev.y + (curr && curr.y) || 0\n };\n }, {x: 0, y: 0});\n });\n\n highLow = Chartist.getHighLow([serialSums], options, options.horizontalBars ? 'x' : 'y');\n\n } else {\n\n highLow = Chartist.getHighLow(data.normalized.series, options, options.horizontalBars ? 'x' : 'y');\n }\n\n // Overrides of high / low from settings\n highLow.high = +options.high || (options.high === 0 ? 0 : highLow.high);\n highLow.low = +options.low || (options.low === 0 ? 0 : highLow.low);\n\n var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n\n var valueAxis,\n labelAxisTicks,\n labelAxis,\n axisX,\n axisY;\n\n // We need to set step count based on some options combinations\n if(options.distributeSeries && options.stackBars) {\n // If distributed series are enabled and bars need to be stacked, we'll only have one bar and therefore should\n // use only the first label for the step axis\n labelAxisTicks = data.normalized.labels.slice(0, 1);\n } else {\n // If distributed series are enabled but stacked bars aren't, we should use the series labels\n // If we are drawing a regular bar chart with two dimensional series data, we just use the labels array\n // as the bars are normalized\n labelAxisTicks = data.normalized.labels;\n }\n\n // Set labelAxis and valueAxis based on the horizontalBars setting. This setting will flip the axes if necessary.\n if(options.horizontalBars) {\n if(options.axisX.type === undefined) {\n valueAxis = axisX = new Chartist.AutoScaleAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n\n if(options.axisY.type === undefined) {\n labelAxis = axisY = new Chartist.StepAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, options.axisY);\n }\n } else {\n if(options.axisX.type === undefined) {\n labelAxis = axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, options.axisX);\n }\n\n if(options.axisY.type === undefined) {\n valueAxis = axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n }\n\n // Projected 0 point\n var zeroPoint = options.horizontalBars ? (chartRect.x1 + valueAxis.projectValue(0)) : (chartRect.y1 - valueAxis.projectValue(0));\n // Used to track the screen coordinates of stacked bars\n var stackedBarValues = [];\n\n labelAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n valueAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\n if (options.showGridBackground) {\n Chartist.createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);\n }\n\n // Draw the series\n data.raw.series.forEach(function(series, seriesIndex) {\n // Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\n var biPol = seriesIndex - (data.raw.series.length - 1) / 2;\n // Half of the period width between vertical grid lines used to position bars\n var periodHalfLength;\n // Current series SVG element\n var seriesElement;\n\n // We need to set periodHalfLength based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we need to use the length of the normaizedData array\n // which is the series count and divide by 2\n periodHalfLength = labelAxis.axisLength / data.normalized.series.length / 2;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled we'll only get one bar so we should just divide the axis\n // length by 2\n periodHalfLength = labelAxis.axisLength / 2;\n } else {\n // On regular bar charts we should just use the series length\n periodHalfLength = labelAxis.axisLength / data.normalized.series[seriesIndex].length / 2;\n }\n\n // Adding the series group to the series element\n seriesElement = seriesGroup.elem('g');\n\n // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n seriesElement.attr({\n 'ct:series-name': series.name,\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // Use series class from series data or if not set generate one\n seriesElement.addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))\n ].join(' '));\n\n data.normalized.series[seriesIndex].forEach(function(value, valueIndex) {\n var projected,\n bar,\n previousStack,\n labelAxisValueIndex;\n\n // We need to set labelAxisValueIndex based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we can use the seriesIndex for later projection\n // on the step axis for label positioning\n labelAxisValueIndex = seriesIndex;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled, we will only get one bar and therefore always use\n // 0 for projection on the label step axis\n labelAxisValueIndex = 0;\n } else {\n // On regular bar charts we just use the value index to project on the label step axis\n labelAxisValueIndex = valueIndex;\n }\n\n // We need to transform coordinates differently based on the chart layout\n if(options.horizontalBars) {\n projected = {\n x: chartRect.x1 + valueAxis.projectValue(value && value.x ? value.x : 0, valueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - labelAxis.projectValue(value && value.y ? value.y : 0, labelAxisValueIndex, data.normalized.series[seriesIndex])\n };\n } else {\n projected = {\n x: chartRect.x1 + labelAxis.projectValue(value && value.x ? value.x : 0, labelAxisValueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - valueAxis.projectValue(value && value.y ? value.y : 0, valueIndex, data.normalized.series[seriesIndex])\n }\n }\n\n // If the label axis is a step based axis we will offset the bar into the middle of between two steps using\n // the periodHalfLength value. Also we do arrange the different series so that they align up to each other using\n // the seriesBarDistance. If we don't have a step axis, the bar positions can be chosen freely so we should not\n // add any automated positioning.\n if(labelAxis instanceof Chartist.StepAxis) {\n // Offset to center bar between grid lines, but only if the step axis is not stretched\n if(!labelAxis.options.stretch) {\n projected[labelAxis.units.pos] += periodHalfLength * (options.horizontalBars ? -1 : 1);\n }\n // Using bi-polar offset for multiple series if no stacked bars or series distribution is used\n projected[labelAxis.units.pos] += (options.stackBars || options.distributeSeries) ? 0 : biPol * options.seriesBarDistance * (options.horizontalBars ? -1 : 1);\n }\n\n // Enter value in stacked bar values used to remember previous screen value for stacking up bars\n previousStack = stackedBarValues[valueIndex] || zeroPoint;\n stackedBarValues[valueIndex] = previousStack - (zeroPoint - projected[labelAxis.counterUnits.pos]);\n\n // Skip if value is undefined\n if(value === undefined) {\n return;\n }\n\n var positions = {};\n positions[labelAxis.units.pos + '1'] = projected[labelAxis.units.pos];\n positions[labelAxis.units.pos + '2'] = projected[labelAxis.units.pos];\n\n if(options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode)) {\n // Stack mode: accumulate (default)\n // If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line\n // We want backwards compatibility, so the expected fallback without the 'stackMode' option\n // to be the original behaviour (accumulate)\n positions[labelAxis.counterUnits.pos + '1'] = previousStack;\n positions[labelAxis.counterUnits.pos + '2'] = stackedBarValues[valueIndex];\n } else {\n // Draw from the zero line normally\n // This is also the same code for Stack mode: overlap\n positions[labelAxis.counterUnits.pos + '1'] = zeroPoint;\n positions[labelAxis.counterUnits.pos + '2'] = projected[labelAxis.counterUnits.pos];\n }\n\n // Limit x and y so that they are within the chart rect\n positions.x1 = Math.min(Math.max(positions.x1, chartRect.x1), chartRect.x2);\n positions.x2 = Math.min(Math.max(positions.x2, chartRect.x1), chartRect.x2);\n positions.y1 = Math.min(Math.max(positions.y1, chartRect.y2), chartRect.y1);\n positions.y2 = Math.min(Math.max(positions.y2, chartRect.y2), chartRect.y1);\n\n var metaData = Chartist.getMetaData(series, valueIndex);\n\n // Create bar element\n bar = seriesElement.elem('line', positions, options.classNames.bar).attr({\n 'ct:value': [value.x, value.y].filter(Chartist.isNumeric).join(','),\n 'ct:meta': Chartist.serialize(metaData)\n });\n\n this.eventEmitter.emit('draw', Chartist.extend({\n type: 'bar',\n value: value,\n index: valueIndex,\n meta: metaData,\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n chartRect: chartRect,\n group: seriesElement,\n element: bar\n }, positions));\n }.bind(this));\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n bounds: valueAxis.bounds,\n chartRect: chartRect,\n axisX: axisX,\n axisY: axisY,\n svg: this.svg,\n options: options\n });\n }\n\n /**\n * This method creates a new bar chart and returns API object that you can use for later changes.\n *\n * @memberof Chartist.Bar\n * @param {String|Node} query A selector query string or directly a DOM element\n * @param {Object} data The data object that needs to consist of a labels and a series array\n * @param {Object} [options] The options object with options that override the default options. Check the examples for a detailed list.\n * @param {Array} [responsiveOptions] Specify an array of responsive option arrays which are a media query and options object pair => [[mediaQueryString, optionsObject],[more...]]\n * @return {Object} An object which exposes the API for the created chart\n *\n * @example\n * // Create a simple bar chart\n * var data = {\n * labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],\n * series: [\n * [5, 2, 4, 2, 0]\n * ]\n * };\n *\n * // In the global name space Chartist we call the Bar function to initialize a bar chart. As a first parameter we pass in a selector where we would like to get our chart created and as a second parameter we pass our data object.\n * new Chartist.Bar('.ct-chart', data);\n *\n * @example\n * // This example creates a bipolar grouped bar chart where the boundaries are limitted to -10 and 10\n * new Chartist.Bar('.ct-chart', {\n * labels: [1, 2, 3, 4, 5, 6, 7],\n * series: [\n * [1, 3, 2, -5, -3, 1, -6],\n * [-5, -2, -4, -1, 2, -3, 1]\n * ]\n * }, {\n * seriesBarDistance: 12,\n * low: -10,\n * high: 10\n * });\n *\n */\n function Bar(query, data, options, responsiveOptions) {\n Chartist.Bar.super.constructor.call(this,\n query,\n data,\n defaultOptions,\n Chartist.extend({}, defaultOptions, options),\n responsiveOptions);\n }\n\n // Creating bar chart type in Chartist namespace\n Chartist.Bar = Chartist.Base.extend({\n constructor: Bar,\n createChart: createChart\n });\n\n}(window, document, Chartist));\n;/**\n * The pie chart module of Chartist that can be used to draw pie, donut or gauge charts\n *\n * @module Chartist.Pie\n */\n/* global Chartist */\n(function(window, document, Chartist) {\n 'use strict';\n\n /**\n * Default options in line charts. Expand the code view to see a detailed list of options with comments.\n *\n * @memberof Chartist.Pie\n */\n var defaultOptions = {\n // Specify a fixed width for the chart as a string (i.e. '100px' or '50%')\n width: undefined,\n // Specify a fixed height for the chart as a string (i.e. '100px' or '50%')\n height: undefined,\n // Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5}\n chartPadding: 5,\n // Override the class names that are used to generate the SVG structure of the chart\n classNames: {\n chartPie: 'ct-chart-pie',\n chartDonut: 'ct-chart-donut',\n series: 'ct-series',\n slicePie: 'ct-slice-pie',\n sliceDonut: 'ct-slice-donut',\n sliceDonutSolid: 'ct-slice-donut-solid',\n label: 'ct-label'\n },\n // The start angle of the pie chart in degrees where 0 points north. A higher value offsets the start angle clockwise.\n startAngle: 0,\n // An optional total you can specify. By specifying a total value, the sum of the values in the series must be this total in order to draw a full pie. You can use this parameter to draw only parts of a pie or gauge charts.\n total: undefined,\n // If specified the donut CSS classes will be used and strokes will be drawn instead of pie slices.\n donut: false,\n // If specified the donut segments will be drawn as shapes instead of strokes.\n donutSolid: false,\n // Specify the donut stroke width, currently done in javascript for convenience. May move to CSS styles in the future.\n // This option can be set as number or string to specify a relative width (i.e. 100 or '30%').\n donutWidth: 60,\n // If a label should be shown or not\n showLabel: true,\n // Label position offset from the standard position which is half distance of the radius. This value can be either positive or negative. Positive values will position the label away from the center.\n labelOffset: 0,\n // This option can be set to 'inside', 'outside' or 'center'. Positioned with 'inside' the labels will be placed on half the distance of the radius to the border of the Pie by respecting the 'labelOffset'. The 'outside' option will place the labels at the border of the pie and 'center' will place the labels in the absolute center point of the chart. The 'center' option only makes sense in conjunction with the 'labelOffset' option.\n labelPosition: 'inside',\n // An interpolation function for the label value\n labelInterpolationFnc: Chartist.noop,\n // Label direction can be 'neutral', 'explode' or 'implode'. The labels anchor will be positioned based on those settings as well as the fact if the labels are on the right or left side of the center of the chart. Usually explode is useful when labels are positioned far away from the center.\n labelDirection: 'neutral',\n // If true the whole data is reversed including labels, the series order as well as the whole series data arrays.\n reverseData: false,\n // If true empty values will be ignored to avoid drawing unncessary slices and labels\n ignoreEmptyValues: false\n };\n\n /**\n * Determines SVG anchor position based on direction and center parameter\n *\n * @param center\n * @param label\n * @param direction\n * @return {string}\n */\n function determineAnchorPosition(center, label, direction) {\n var toTheRight = label.x > center.x;\n\n if(toTheRight && direction === 'explode' ||\n !toTheRight && direction === 'implode') {\n return 'start';\n } else if(toTheRight && direction === 'implode' ||\n !toTheRight && direction === 'explode') {\n return 'end';\n } else {\n return 'middle';\n }\n }\n\n /**\n * Creates the pie chart\n *\n * @param options\n */\n function createChart(options) {\n var data = Chartist.normalizeData(this.data);\n var seriesGroups = [],\n labelsGroup,\n chartRect,\n radius,\n labelRadius,\n totalDataSum,\n startAngle = options.startAngle;\n\n // Create SVG.js draw\n this.svg = Chartist.createSvg(this.container, options.width, options.height,options.donut ? options.classNames.chartDonut : options.classNames.chartPie);\n // Calculate charting rect\n chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n // Get biggest circle radius possible within chartRect\n radius = Math.min(chartRect.width() / 2, chartRect.height() / 2);\n // Calculate total of all series to get reference value or use total reference from optional options\n totalDataSum = options.total || data.normalized.series.reduce(function(previousValue, currentValue) {\n return previousValue + currentValue;\n }, 0);\n\n var donutWidth = Chartist.quantity(options.donutWidth);\n if (donutWidth.unit === '%') {\n donutWidth.value *= radius / 100;\n }\n\n // If this is a donut chart we need to adjust our radius to enable strokes to be drawn inside\n // Unfortunately this is not possible with the current SVG Spec\n // See this proposal for more details: http://lists.w3.org/Archives/Public/www-svg/2003Oct/0000.html\n radius -= options.donut && !options.donutSolid ? donutWidth.value / 2 : 0;\n\n // If labelPosition is set to `outside` or a donut chart is drawn then the label position is at the radius,\n // if regular pie chart it's half of the radius\n if(options.labelPosition === 'outside' || options.donut && !options.donutSolid) {\n labelRadius = radius;\n } else if(options.labelPosition === 'center') {\n // If labelPosition is center we start with 0 and will later wait for the labelOffset\n labelRadius = 0;\n } else if(options.donutSolid) {\n labelRadius = radius - donutWidth.value / 2;\n } else {\n // Default option is 'inside' where we use half the radius so the label will be placed in the center of the pie\n // slice\n labelRadius = radius / 2;\n }\n // Add the offset to the labelRadius where a negative offset means closed to the center of the chart\n labelRadius += options.labelOffset;\n\n // Calculate end angle based on total sum and current data value and offset with padding\n var center = {\n x: chartRect.x1 + chartRect.width() / 2,\n y: chartRect.y2 + chartRect.height() / 2\n };\n\n // Check if there is only one non-zero value in the series array.\n var hasSingleValInSeries = data.raw.series.filter(function(val) {\n return val.hasOwnProperty('value') ? val.value !== 0 : val !== 0;\n }).length === 1;\n\n // Creating the series groups\n data.raw.series.forEach(function(series, index) {\n seriesGroups[index] = this.svg.elem('g', null, null);\n }.bind(this));\n //if we need to show labels we create the label group now\n if(options.showLabel) {\n labelsGroup = this.svg.elem('g', null, null);\n }\n\n // Draw the series\n // initialize series groups\n data.raw.series.forEach(function(series, index) {\n // If current value is zero and we are ignoring empty values then skip to next value\n if (data.normalized.series[index] === 0 && options.ignoreEmptyValues) return;\n\n // If the series is an object and contains a name or meta data we add a custom attribute\n seriesGroups[index].attr({\n 'ct:series-name': series.name\n });\n\n // Use series class from series data or if not set generate one\n seriesGroups[index].addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(index))\n ].join(' '));\n\n // If the whole dataset is 0 endAngle should be zero. Can't divide by 0.\n var endAngle = (totalDataSum > 0 ? startAngle + data.normalized.series[index] / totalDataSum * 360 : 0);\n\n // Use slight offset so there are no transparent hairline issues\n var overlappigStartAngle = Math.max(0, startAngle - (index === 0 || hasSingleValInSeries ? 0 : 0.2));\n\n // If we need to draw the arc for all 360 degrees we need to add a hack where we close the circle\n // with Z and use 359.99 degrees\n if(endAngle - overlappigStartAngle >= 359.99) {\n endAngle = overlappigStartAngle + 359.99;\n }\n\n var start = Chartist.polarToCartesian(center.x, center.y, radius, overlappigStartAngle),\n end = Chartist.polarToCartesian(center.x, center.y, radius, endAngle);\n\n var innerStart,\n innerEnd,\n donutSolidRadius;\n\n // Create a new path element for the pie chart. If this isn't a donut chart we should close the path for a correct stroke\n var path = new Chartist.Svg.Path(!options.donut || options.donutSolid)\n .move(end.x, end.y)\n .arc(radius, radius, 0, endAngle - startAngle > 180, 0, start.x, start.y);\n\n // If regular pie chart (no donut) we add a line to the center of the circle for completing the pie\n if(!options.donut) {\n path.line(center.x, center.y);\n } else if (options.donutSolid) {\n donutSolidRadius = radius - donutWidth.value;\n innerStart = Chartist.polarToCartesian(center.x, center.y, donutSolidRadius, startAngle - (index === 0 || hasSingleValInSeries ? 0 : 0.2));\n innerEnd = Chartist.polarToCartesian(center.x, center.y, donutSolidRadius, endAngle);\n path.line(innerStart.x, innerStart.y);\n path.arc(donutSolidRadius, donutSolidRadius, 0, endAngle - startAngle > 180, 1, innerEnd.x, innerEnd.y);\n }\n\n // Create the SVG path\n // If this is a donut chart we add the donut class, otherwise just a regular slice\n var pathClassName = options.classNames.slicePie;\n if (options.donut) {\n pathClassName = options.classNames.sliceDonut;\n if (options.donutSolid) {\n pathClassName = options.classNames.sliceDonutSolid;\n }\n }\n var pathElement = seriesGroups[index].elem('path', {\n d: path.stringify()\n }, pathClassName);\n\n // Adding the pie series value to the path\n pathElement.attr({\n 'ct:value': data.normalized.series[index],\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // If this is a donut, we add the stroke-width as style attribute\n if(options.donut && !options.donutSolid) {\n pathElement._node.style.strokeWidth = donutWidth.value + 'px';\n }\n\n // Fire off draw event\n this.eventEmitter.emit('draw', {\n type: 'slice',\n value: data.normalized.series[index],\n totalDataSum: totalDataSum,\n index: index,\n meta: series.meta,\n series: series,\n group: seriesGroups[index],\n element: pathElement,\n path: path.clone(),\n center: center,\n radius: radius,\n startAngle: startAngle,\n endAngle: endAngle\n });\n\n // If we need to show labels we need to add the label for this slice now\n if(options.showLabel) {\n var labelPosition;\n if(data.raw.series.length === 1) {\n // If we have only 1 series, we can position the label in the center of the pie\n labelPosition = {\n x: center.x,\n y: center.y\n };\n } else {\n // Position at the labelRadius distance from center and between start and end angle\n labelPosition = Chartist.polarToCartesian(\n center.x,\n center.y,\n labelRadius,\n startAngle + (endAngle - startAngle) / 2\n );\n }\n\n var rawValue;\n if(data.normalized.labels && !Chartist.isFalseyButZero(data.normalized.labels[index])) {\n rawValue = data.normalized.labels[index];\n } else {\n rawValue = data.normalized.series[index];\n }\n\n var interpolatedValue = options.labelInterpolationFnc(rawValue, index);\n\n if(interpolatedValue || interpolatedValue === 0) {\n var labelElement = labelsGroup.elem('text', {\n dx: labelPosition.x,\n dy: labelPosition.y,\n 'text-anchor': determineAnchorPosition(center, labelPosition, options.labelDirection)\n }, options.classNames.label).text('' + interpolatedValue);\n\n // Fire off draw event\n this.eventEmitter.emit('draw', {\n type: 'label',\n index: index,\n group: labelsGroup,\n element: labelElement,\n text: '' + interpolatedValue,\n x: labelPosition.x,\n y: labelPosition.y\n });\n }\n }\n\n // Set next startAngle to current endAngle.\n // (except for last slice)\n startAngle = endAngle;\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n chartRect: chartRect,\n svg: this.svg,\n options: options\n });\n }\n\n /**\n * This method creates a new pie chart and returns an object that can be used to redraw the chart.\n *\n * @memberof Chartist.Pie\n * @param {String|Node} query A selector query string or directly a DOM element\n * @param {Object} data The data object in the pie chart needs to have a series property with a one dimensional data array. The values will be normalized against each other and don't necessarily need to be in percentage. The series property can also be an array of value objects that contain a value property and a className property to override the CSS class name for the series group.\n * @param {Object} [options] The options object with options that override the default options. Check the examples for a detailed list.\n * @param {Array} [responsiveOptions] Specify an array of responsive option arrays which are a media query and options object pair => [[mediaQueryString, optionsObject],[more...]]\n * @return {Object} An object with a version and an update method to manually redraw the chart\n *\n * @example\n * // Simple pie chart example with four series\n * new Chartist.Pie('.ct-chart', {\n * series: [10, 2, 4, 3]\n * });\n *\n * @example\n * // Drawing a donut chart\n * new Chartist.Pie('.ct-chart', {\n * series: [10, 2, 4, 3]\n * }, {\n * donut: true\n * });\n *\n * @example\n * // Using donut, startAngle and total to draw a gauge chart\n * new Chartist.Pie('.ct-chart', {\n * series: [20, 10, 30, 40]\n * }, {\n * donut: true,\n * donutWidth: 20,\n * startAngle: 270,\n * total: 200\n * });\n *\n * @example\n * // Drawing a pie chart with padding and labels that are outside the pie\n * new Chartist.Pie('.ct-chart', {\n * series: [20, 10, 30, 40]\n * }, {\n * chartPadding: 30,\n * labelOffset: 50,\n * labelDirection: 'explode'\n * });\n *\n * @example\n * // Overriding the class names for individual series as well as a name and meta data.\n * // The name will be written as ct:series-name attribute and the meta data will be serialized and written\n * // to a ct:meta attribute.\n * new Chartist.Pie('.ct-chart', {\n * series: [{\n * value: 20,\n * name: 'Series 1',\n * className: 'my-custom-class-one',\n * meta: 'Meta One'\n * }, {\n * value: 10,\n * name: 'Series 2',\n * className: 'my-custom-class-two',\n * meta: 'Meta Two'\n * }, {\n * value: 70,\n * name: 'Series 3',\n * className: 'my-custom-class-three',\n * meta: 'Meta Three'\n * }]\n * });\n */\n function Pie(query, data, options, responsiveOptions) {\n Chartist.Pie.super.constructor.call(this,\n query,\n data,\n defaultOptions,\n Chartist.extend({}, defaultOptions, options),\n responsiveOptions);\n }\n\n // Creating pie chart type in Chartist namespace\n Chartist.Pie = Chartist.Base.extend({\n constructor: Pie,\n createChart: createChart,\n determineAnchorPosition: determineAnchorPosition\n });\n\n}(window, document, Chartist));\n\nreturn Chartist;\n\n}));\n"]}
1
+ {"version":3,"sources":["chartist.js"],"names":["root","factory","define","amd","module","exports","this","Chartist","version","globalRoot","window","document","namespaces","svg","xmlns","xhtml","xlink","ct","noop","n","alphaNumerate","String","fromCharCode","extend","target","i","source","sourceProp","arguments","length","prop","Array","replaceAll","str","subStr","newSubStr","replace","RegExp","ensureUnit","value","unit","quantity","input","match","exec","undefined","querySelector","query","Node","times","apply","sum","previous","current","mapMultiply","factor","num","mapAdd","addend","serialMap","arr","cb","result","Math","max","map","e","forEach","index","args","roundWithPrecision","digits","precision","pow","round","escapingMap","&","<",">","\"","'","serialize","data","JSON","stringify","Object","keys","reduce","key","deserialize","parse","createSvg","container","width","height","className","prototype","slice","call","querySelectorAll","filter","getAttributeNS","removeChild","Svg","attr","addClass","_node","style","appendChild","normalizeData","reverse","multi","labelCount","output","raw","normalized","series","getDataArray","every","labels","push","reverseData","safeHasProperty","object","property","hasOwnProperty","isDataHoleValue","isNaN","recursiveConvert","multiValue","getNumberOrUndefined","y","x","normalizePadding","padding","fallback","top","right","bottom","left","getMetaData","meta","orderOfMagnitude","floor","log","abs","LN10","projectLength","axisLength","bounds","range","getAvailableHeight","options","chartPadding","axisX","offset","getHighLow","dimension","recursiveHighLow","findHigh","highLow","high","findLow","low","toUpperCase","Number","MAX_VALUE","referenceValue","min","isNumeric","isFinite","isFalseyButZero","isMultiValue","getMultiValue","rho","gcd","p","q","f","divisor","x1","x2","getBounds","scaleMinSpace","onlyInteger","safeIncrement","increment","EPSILON","newMin","newMax","optimizationCounter","valueRange","oom","step","ceil","numberOfSteps","scaleUp","smallestFactor","Error","values","polarToCartesian","centerX","centerY","radius","angleInDegrees","angleInRadians","PI","cos","sin","createChartRect","fallbackPadding","hasAxis","axisY","yAxisOffset","xAxisOffset","normalizedPadding","chartRect","y1","y2","position","createGrid","axis","group","classes","eventEmitter","positionalData","units","pos","counterUnits","gridElement","elem","join","emit","type","element","createGridBackground","gridGroup","gridBackground","createLabel","axisOffset","labelOffset","useForeignObject","labelElement","len","content","createElement","setAttribute","innerText","foreignObject","text","getSeriesOption","name","seriesOptions","optionsProvider","responsiveOptions","updateCurrentOptions","mediaEvent","previousOptions","currentOptions","baseOptions","mql","matchMedia","matches","removeMediaQueryListeners","mediaQueryListeners","removeListener","addListener","getCurrentOptions","splitIntoSegments","pathCoordinates","valueData","defaultOptions","increasingX","fillHoles","segments","hole","global","Interpolation","none","path","Path","currX","currY","currData","move","line","simple","d","prevX","prevY","prevData","curve","cardinal","tension","t","c","paths","segment","z","iLen","monotoneCubic","xs","ys","ms","ds","dys","dxs","postpone","EventEmitter","addEventHandler","event","handler","handlers","removeEventHandler","splice","indexOf","starHandler","listToArray","list","properties","superProtoOverride","superProto","Class","proto","create","cloneDefinitions","constr","instance","fn","constructor","getOwnPropertyNames","propName","defineProperty","getOwnPropertyDescriptor","update","override","initializeTimeoutId","createChart","detach","clearTimeout","removeEventListener","resizeListener","on","off","initialize","addEventListener","bind","plugins","plugin","Base","supportsForeignObject","isSupported","supportsAnimations","__chartist__","setTimeout","attributes","parent","insertFirst","Element","createElementNS","xmlns:ct","firstChild","insertBefore","ns","getAttribute","namespacedAttribute","split","setAttributeNS","parentNode","SVGElement","node","nodeName","selector","foundNode","foundNodes","List","getNode","innerHTML","fnObj","createTextNode","empty","remove","newElement","replaceChild","append","trim","names","concat","self","removeClass","removedClasses","removeAllClasses","getBoundingClientRect","animate","animations","guided","attribute","createAnimate","animationDefinition","timeout","easing","attributeProperties","Easing","begin","dur","calcMode","keySplines","keyTimes","fill","from","attributeName","beginElement","err","to","params","SvgList","nodeList","svgElements","prototypeProperty","feature","implementation","hasFeature","easingCubicBeziers","easeInSine","easeOutSine","easeInOutSine","easeInQuad","easeOutQuad","easeInOutQuad","easeInCubic","easeOutCubic","easeInOutCubic","easeInQuart","easeOutQuart","easeInOutQuart","easeInQuint","easeOutQuint","easeInOutQuint","easeInExpo","easeOutExpo","easeInOutExpo","easeInCirc","easeOutCirc","easeInOutCirc","easeInBack","easeOutBack","easeInOutBack","command","pathElements","relative","pathElement","toLowerCase","forEachParam","pathElementIndex","elementDescriptions","paramName","paramIndex","SvgPath","close","count","arc","rx","ry","xAr","lAf","sf","chunks","pop","elements","chunk","shift","description","spliceArgs","accuracyMultiplier","accuracy","scale","translate","transform","transformFnc","transformed","clone","splitByCommand","joinedPath","j","m","l","a","Axis","ticks","axisUnits","rectEnd","rectStart","gridOffset","rectOffset","createGridAndLabels","labelGroup","chartOptions","axisOptions","projectedValues","projectValue","labelValues","labelInterpolationFnc","projectedValue","labelLength","showGrid","classNames","grid","dir","showLabel","label","AutoScaleAxis","axisUnit","FixedScaleAxis","sort","b","stepLength","StepAxis","calc","stretch","chart","seriesGroup","fullWidth","showGridBackground","seriesIndex","seriesElement","ct:series-name","ct:meta","pathData","valueIndex","lineSmooth","showPoint","showLine","showArea","areaBase","smoothing","point","ct:value","seriesMeta","areaBaseProjected","pathSegment","solidPathSegments","firstElement","lastElement","areaPath","area","Line","vertical","horizontal","start","end","distributeSeries","horizontalBars","stackBars","serialSums","prev","curr","valueAxis","labelAxisTicks","labelAxis","zeroPoint","stackedBarValues","periodHalfLength","biPol","projected","bar","previousStack","labelAxisValueIndex","seriesBarDistance","positions","stackMode","metaData","Bar","determineAnchorPosition","center","direction","toTheRight","labelsGroup","labelRadius","totalDataSum","seriesGroups","startAngle","donut","chartDonut","chartPie","total","previousValue","currentValue","donutWidth","donutSolid","labelPosition","hasSingleValInSeries","val","ignoreEmptyValues","endAngle","overlappigStartAngle","innerStart","innerEnd","donutSolidRadius","pathClassName","slicePie","sliceDonut","sliceDonutSolid","strokeWidth","rawValue","interpolatedValue","dx","dy","text-anchor","labelDirection","Pie"],"mappings":";;;;;;;CAAC,SAAUA,EAAMC,GACO,kBAAXC,SAAyBA,OAAOC,IAEzCD,OAAO,cAAgB,WACrB,MAAQF,GAAe,SAAIC,MAEF,gBAAXG,SAAuBA,OAAOC,QAI9CD,OAAOC,QAAUJ,IAEjBD,EAAe,SAAIC,KAErBK,KAAM,WAaR,GAAIC,IACFC,QAAS,SAq4IX,OAl4IC,UAAUC,EAAYF,GACrB,YAEA,IAAIG,GAASD,EAAWC,OACpBC,EAAWF,EAAWE,QAQ1BJ,GAASK,YACPC,IAA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,EAAaa,IACbvP,KAAKpV,OAEPA,KAAK0N,aAAaQ,KAAK,WACrBhB,UAAWA,EACX3M,IAAKP,KAAKO,IACV2I,QAASA,IAwEb,QAASyc,GAAIljB,EAAOmC,EAAMsE,EAASsG,GACjCvP,EAAS0lB,IAAT1lB,SAAmBkU,YAAYvO,KAAK5F,KAClCyC,EACAmC,EACA6L,EACAxQ,EAASgB,UAAWwP,EAAgBvH,GACpCsG,GAtXJ,GAQIiB,IARStQ,EAAWC,OACTD,EAAWE,UASxBkF,MAAOhD,OAEPiD,OAAQjD,OAER4G,aAAc,EAEdgW,YACE8E,SAAU,eACVD,WAAY,iBACZld,OAAQ,YACRme,SAAU,eACVC,WAAY,iBACZC,gBAAiB,uBACjB5F,MAAO,YAGTuE,WAAY,EAEZI,MAAO3hB,OAEPwhB,OAAO,EAEPO,YAAY,EAGZD,WAAY,GAEZ/E,WAAW,EAEX5Q,YAAa,EAEb6V,cAAe,SAEfxF,sBAAuB9e,EAASW,KAEhC8kB,eAAgB,UAEhBve,aAAa,EAEbud,mBAAmB,GAyUrBzkB,GAAS0lB,IAAM1lB,EAASsV,KAAKtU,QAC3BkT,YAAawR,EACbhR,YAAaA,EACb2O,wBAAyBA,KAG3BtjB,MAAQ8Q,OAAQ7Q,GAEXA","file":"chartist.min.js","sourcesContent":["(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module unless amdModuleId is set\n define('Chartist', [], function () {\n return (root['Chartist'] = factory());\n });\n } else if (typeof module === 'object' && module.exports) {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory();\n } else {\n root['Chartist'] = factory();\n }\n}(this, function () {\n\n/* Chartist.js 0.11.4\n * Copyright © 2019 Gion Kunz\n * Free to use under either the WTFPL license or the MIT license.\n * https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-WTFPL\n * https://raw.githubusercontent.com/gionkunz/chartist-js/master/LICENSE-MIT\n */\n/**\n * The core module of Chartist that is mainly providing static functions and higher level functions for chart modules.\n *\n * @module Chartist.Core\n */\nvar Chartist = {\n version: '0.11.4'\n};\n\n(function (globalRoot, Chartist) {\n 'use strict';\n\n var window = globalRoot.window;\n var document = globalRoot.document;\n\n /**\n * This object contains all namespaces used within Chartist.\n *\n * @memberof Chartist.Core\n * @type {{svg: string, xmlns: string, xhtml: string, xlink: string, ct: string}}\n */\n Chartist.namespaces = {\n svg: 'http://www.w3.org/2000/svg',\n xmlns: 'http://www.w3.org/2000/xmlns/',\n xhtml: 'http://www.w3.org/1999/xhtml',\n xlink: 'http://www.w3.org/1999/xlink',\n ct: 'http://gionkunz.github.com/chartist-js/ct'\n };\n\n /**\n * Helps to simplify functional style code\n *\n * @memberof Chartist.Core\n * @param {*} n This exact value will be returned by the noop function\n * @return {*} The same value that was provided to the n parameter\n */\n Chartist.noop = function (n) {\n return n;\n };\n\n /**\n * Generates a-z from a number 0 to 26\n *\n * @memberof Chartist.Core\n * @param {Number} n A number from 0 to 26 that will result in a letter a-z\n * @return {String} A character from a-z based on the input number n\n */\n Chartist.alphaNumerate = function (n) {\n // Limit to a-z\n return String.fromCharCode(97 + n % 26);\n };\n\n /**\n * Simple recursive object extend\n *\n * @memberof Chartist.Core\n * @param {Object} target Target object where the source will be merged into\n * @param {Object...} sources This object (objects) will be merged into target and then target is returned\n * @return {Object} An object that has the same reference as target but is extended and merged with the properties of source\n */\n Chartist.extend = function (target) {\n var i, source, sourceProp;\n target = target || {};\n\n for (i = 1; i < arguments.length; i++) {\n source = arguments[i];\n for (var prop in source) {\n sourceProp = source[prop];\n if (typeof sourceProp === 'object' && sourceProp !== null && !(sourceProp instanceof Array)) {\n target[prop] = Chartist.extend(target[prop], sourceProp);\n } else {\n target[prop] = sourceProp;\n }\n }\n }\n\n return target;\n };\n\n /**\n * Replaces all occurrences of subStr in str with newSubStr and returns a new string.\n *\n * @memberof Chartist.Core\n * @param {String} str\n * @param {String} subStr\n * @param {String} newSubStr\n * @return {String}\n */\n Chartist.replaceAll = function(str, subStr, newSubStr) {\n return str.replace(new RegExp(subStr, 'g'), newSubStr);\n };\n\n /**\n * Converts a number to a string with a unit. If a string is passed then this will be returned unmodified.\n *\n * @memberof Chartist.Core\n * @param {Number} value\n * @param {String} unit\n * @return {String} Returns the passed number value with unit.\n */\n Chartist.ensureUnit = function(value, unit) {\n if(typeof value === 'number') {\n value = value + unit;\n }\n\n return value;\n };\n\n /**\n * Converts a number or string to a quantity object.\n *\n * @memberof Chartist.Core\n * @param {String|Number} input\n * @return {Object} Returns an object containing the value as number and the unit as string.\n */\n Chartist.quantity = function(input) {\n if (typeof input === 'string') {\n var match = (/^(\\d+)\\s*(.*)$/g).exec(input);\n return {\n value : +match[1],\n unit: match[2] || undefined\n };\n }\n return { value: input };\n };\n\n /**\n * This is a wrapper around document.querySelector that will return the query if it's already of type Node\n *\n * @memberof Chartist.Core\n * @param {String|Node} query The query to use for selecting a Node or a DOM node that will be returned directly\n * @return {Node}\n */\n Chartist.querySelector = function(query) {\n return query instanceof Node ? query : document.querySelector(query);\n };\n\n /**\n * Functional style helper to produce array with given length initialized with undefined values\n *\n * @memberof Chartist.Core\n * @param length\n * @return {Array}\n */\n Chartist.times = function(length) {\n return Array.apply(null, new Array(length));\n };\n\n /**\n * Sum helper to be used in reduce functions\n *\n * @memberof Chartist.Core\n * @param previous\n * @param current\n * @return {*}\n */\n Chartist.sum = function(previous, current) {\n return previous + (current ? current : 0);\n };\n\n /**\n * Multiply helper to be used in `Array.map` for multiplying each value of an array with a factor.\n *\n * @memberof Chartist.Core\n * @param {Number} factor\n * @returns {Function} Function that can be used in `Array.map` to multiply each value in an array\n */\n Chartist.mapMultiply = function(factor) {\n return function(num) {\n return num * factor;\n };\n };\n\n /**\n * Add helper to be used in `Array.map` for adding a addend to each value of an array.\n *\n * @memberof Chartist.Core\n * @param {Number} addend\n * @returns {Function} Function that can be used in `Array.map` to add a addend to each value in an array\n */\n Chartist.mapAdd = function(addend) {\n return function(num) {\n return num + addend;\n };\n };\n\n /**\n * Map for multi dimensional arrays where their nested arrays will be mapped in serial. The output array will have the length of the largest nested array. The callback function is called with variable arguments where each argument is the nested array value (or undefined if there are no more values).\n *\n * @memberof Chartist.Core\n * @param arr\n * @param cb\n * @return {Array}\n */\n Chartist.serialMap = function(arr, cb) {\n var result = [],\n length = Math.max.apply(null, arr.map(function(e) {\n return e.length;\n }));\n\n Chartist.times(length).forEach(function(e, index) {\n var args = arr.map(function(e) {\n return e[index];\n });\n\n result[index] = cb.apply(null, args);\n });\n\n return result;\n };\n\n /**\n * This helper function can be used to round values with certain precision level after decimal. This is used to prevent rounding errors near float point precision limit.\n *\n * @memberof Chartist.Core\n * @param {Number} value The value that should be rounded with precision\n * @param {Number} [digits] The number of digits after decimal used to do the rounding\n * @returns {number} Rounded value\n */\n Chartist.roundWithPrecision = function(value, digits) {\n var precision = Math.pow(10, digits || Chartist.precision);\n return Math.round(value * precision) / precision;\n };\n\n /**\n * Precision level used internally in Chartist for rounding. If you require more decimal places you can increase this number.\n *\n * @memberof Chartist.Core\n * @type {number}\n */\n Chartist.precision = 8;\n\n /**\n * A map with characters to escape for strings to be safely used as attribute values.\n *\n * @memberof Chartist.Core\n * @type {Object}\n */\n Chartist.escapingMap = {\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n '\\'': '&#039;'\n };\n\n /**\n * This function serializes arbitrary data to a string. In case of data that can't be easily converted to a string, this function will create a wrapper object and serialize the data using JSON.stringify. The outcoming string will always be escaped using Chartist.escapingMap.\n * If called with null or undefined the function will return immediately with null or undefined.\n *\n * @memberof Chartist.Core\n * @param {Number|String|Object} data\n * @return {String}\n */\n Chartist.serialize = function(data) {\n if(data === null || data === undefined) {\n return data;\n } else if(typeof data === 'number') {\n data = ''+data;\n } else if(typeof data === 'object') {\n data = JSON.stringify({data: data});\n }\n\n return Object.keys(Chartist.escapingMap).reduce(function(result, key) {\n return Chartist.replaceAll(result, key, Chartist.escapingMap[key]);\n }, data);\n };\n\n /**\n * This function de-serializes a string previously serialized with Chartist.serialize. The string will always be unescaped using Chartist.escapingMap before it's returned. Based on the input value the return type can be Number, String or Object. JSON.parse is used with try / catch to see if the unescaped string can be parsed into an Object and this Object will be returned on success.\n *\n * @memberof Chartist.Core\n * @param {String} data\n * @return {String|Number|Object}\n */\n Chartist.deserialize = function(data) {\n if(typeof data !== 'string') {\n return data;\n }\n\n data = Object.keys(Chartist.escapingMap).reduce(function(result, key) {\n return Chartist.replaceAll(result, Chartist.escapingMap[key], key);\n }, data);\n\n try {\n data = JSON.parse(data);\n data = data.data !== undefined ? data.data : data;\n } catch(e) {}\n\n return data;\n };\n\n /**\n * Create or reinitialize the SVG element for the chart\n *\n * @memberof Chartist.Core\n * @param {Node} container The containing DOM Node object that will be used to plant the SVG element\n * @param {String} width Set the width of the SVG element. Default is 100%\n * @param {String} height Set the height of the SVG element. Default is 100%\n * @param {String} className Specify a class to be added to the SVG element\n * @return {Object} The created/reinitialized SVG element\n */\n Chartist.createSvg = function (container, width, height, className) {\n var svg;\n\n width = width || '100%';\n height = height || '100%';\n\n // Check if there is a previous SVG element in the container that contains the Chartist XML namespace and remove it\n // Since the DOM API does not support namespaces we need to manually search the returned list http://www.w3.org/TR/selectors-api/\n Array.prototype.slice.call(container.querySelectorAll('svg')).filter(function filterChartistSvgObjects(svg) {\n return svg.getAttributeNS(Chartist.namespaces.xmlns, 'ct');\n }).forEach(function removePreviousElement(svg) {\n container.removeChild(svg);\n });\n\n // Create svg object with width and height or use 100% as default\n svg = new Chartist.Svg('svg').attr({\n width: width,\n height: height\n }).addClass(className);\n\n svg._node.style.width = width;\n svg._node.style.height = height;\n\n // Add the DOM node to our container\n container.appendChild(svg._node);\n\n return svg;\n };\n\n /**\n * Ensures that the data object passed as second argument to the charts is present and correctly initialized.\n *\n * @param {Object} data The data object that is passed as second argument to the charts\n * @return {Object} The normalized data object\n */\n Chartist.normalizeData = function(data, reverse, multi) {\n var labelCount;\n var output = {\n raw: data,\n normalized: {}\n };\n\n // Check if we should generate some labels based on existing series data\n output.normalized.series = Chartist.getDataArray({\n series: data.series || []\n }, reverse, multi);\n\n // If all elements of the normalized data array are arrays we're dealing with\n // multi series data and we need to find the largest series if they are un-even\n if (output.normalized.series.every(function(value) {\n return value instanceof Array;\n })) {\n // Getting the series with the the most elements\n labelCount = Math.max.apply(null, output.normalized.series.map(function(series) {\n return series.length;\n }));\n } else {\n // We're dealing with Pie data so we just take the normalized array length\n labelCount = output.normalized.series.length;\n }\n\n output.normalized.labels = (data.labels || []).slice();\n // Padding the labels to labelCount with empty strings\n Array.prototype.push.apply(\n output.normalized.labels,\n Chartist.times(Math.max(0, labelCount - output.normalized.labels.length)).map(function() {\n return '';\n })\n );\n\n if(reverse) {\n Chartist.reverseData(output.normalized);\n }\n\n return output;\n };\n\n /**\n * This function safely checks if an objects has an owned property.\n *\n * @param {Object} object The object where to check for a property\n * @param {string} property The property name\n * @returns {boolean} Returns true if the object owns the specified property\n */\n Chartist.safeHasProperty = function(object, property) {\n return object !== null &&\n typeof object === 'object' &&\n object.hasOwnProperty(property);\n };\n\n /**\n * Checks if a value is considered a hole in the data series.\n *\n * @param {*} value\n * @returns {boolean} True if the value is considered a data hole\n */\n Chartist.isDataHoleValue = function(value) {\n return value === null ||\n value === undefined ||\n (typeof value === 'number' && isNaN(value));\n };\n\n /**\n * Reverses the series, labels and series data arrays.\n *\n * @memberof Chartist.Core\n * @param data\n */\n Chartist.reverseData = function(data) {\n data.labels.reverse();\n data.series.reverse();\n for (var i = 0; i < data.series.length; i++) {\n if(typeof(data.series[i]) === 'object' && data.series[i].data !== undefined) {\n data.series[i].data.reverse();\n } else if(data.series[i] instanceof Array) {\n data.series[i].reverse();\n }\n }\n };\n\n /**\n * Convert data series into plain array\n *\n * @memberof Chartist.Core\n * @param {Object} data The series object that contains the data to be visualized in the chart\n * @param {Boolean} [reverse] If true the whole data is reversed by the getDataArray call. This will modify the data object passed as first parameter. The labels as well as the series order is reversed. The whole series data arrays are reversed too.\n * @param {Boolean} [multi] Create a multi dimensional array from a series data array where a value object with `x` and `y` values will be created.\n * @return {Array} A plain array that contains the data to be visualized in the chart\n */\n Chartist.getDataArray = function(data, reverse, multi) {\n // Recursively walks through nested arrays and convert string values to numbers and objects with value properties\n // to values. Check the tests in data core -> data normalization for a detailed specification of expected values\n function recursiveConvert(value) {\n if(Chartist.safeHasProperty(value, 'value')) {\n // We are dealing with value object notation so we need to recurse on value property\n return recursiveConvert(value.value);\n } else if(Chartist.safeHasProperty(value, 'data')) {\n // We are dealing with series object notation so we need to recurse on data property\n return recursiveConvert(value.data);\n } else if(value instanceof Array) {\n // Data is of type array so we need to recurse on the series\n return value.map(recursiveConvert);\n } else if(Chartist.isDataHoleValue(value)) {\n // We're dealing with a hole in the data and therefore need to return undefined\n // We're also returning undefined for multi value output\n return undefined;\n } else {\n // We need to prepare multi value output (x and y data)\n if(multi) {\n var multiValue = {};\n\n // Single series value arrays are assumed to specify the Y-Axis value\n // For example: [1, 2] => [{x: undefined, y: 1}, {x: undefined, y: 2}]\n // If multi is a string then it's assumed that it specified which dimension should be filled as default\n if(typeof multi === 'string') {\n multiValue[multi] = Chartist.getNumberOrUndefined(value);\n } else {\n multiValue.y = Chartist.getNumberOrUndefined(value);\n }\n\n multiValue.x = value.hasOwnProperty('x') ? Chartist.getNumberOrUndefined(value.x) : multiValue.x;\n multiValue.y = value.hasOwnProperty('y') ? Chartist.getNumberOrUndefined(value.y) : multiValue.y;\n\n return multiValue;\n\n } else {\n // We can return simple data\n return Chartist.getNumberOrUndefined(value);\n }\n }\n }\n\n return data.series.map(recursiveConvert);\n };\n\n /**\n * Converts a number into a padding object.\n *\n * @memberof Chartist.Core\n * @param {Object|Number} padding\n * @param {Number} [fallback] This value is used to fill missing values if a incomplete padding object was passed\n * @returns {Object} Returns a padding object containing top, right, bottom, left properties filled with the padding number passed in as argument. If the argument is something else than a number (presumably already a correct padding object) then this argument is directly returned.\n */\n Chartist.normalizePadding = function(padding, fallback) {\n fallback = fallback || 0;\n\n return typeof padding === 'number' ? {\n top: padding,\n right: padding,\n bottom: padding,\n left: padding\n } : {\n top: typeof padding.top === 'number' ? padding.top : fallback,\n right: typeof padding.right === 'number' ? padding.right : fallback,\n bottom: typeof padding.bottom === 'number' ? padding.bottom : fallback,\n left: typeof padding.left === 'number' ? padding.left : fallback\n };\n };\n\n Chartist.getMetaData = function(series, index) {\n var value = series.data ? series.data[index] : series[index];\n return value ? value.meta : undefined;\n };\n\n /**\n * Calculate the order of magnitude for the chart scale\n *\n * @memberof Chartist.Core\n * @param {Number} value The value Range of the chart\n * @return {Number} The order of magnitude\n */\n Chartist.orderOfMagnitude = function (value) {\n return Math.floor(Math.log(Math.abs(value)) / Math.LN10);\n };\n\n /**\n * Project a data length into screen coordinates (pixels)\n *\n * @memberof Chartist.Core\n * @param {Object} axisLength The svg element for the chart\n * @param {Number} length Single data value from a series array\n * @param {Object} bounds All the values to set the bounds of the chart\n * @return {Number} The projected data length in pixels\n */\n Chartist.projectLength = function (axisLength, length, bounds) {\n return length / bounds.range * axisLength;\n };\n\n /**\n * Get the height of the area in the chart for the data series\n *\n * @memberof Chartist.Core\n * @param {Object} svg The svg element for the chart\n * @param {Object} options The Object that contains all the optional values for the chart\n * @return {Number} The height of the area in the chart for the data series\n */\n Chartist.getAvailableHeight = function (svg, options) {\n return Math.max((Chartist.quantity(options.height).value || svg.height()) - (options.chartPadding.top + options.chartPadding.bottom) - options.axisX.offset, 0);\n };\n\n /**\n * Get highest and lowest value of data array. This Array contains the data that will be visualized in the chart.\n *\n * @memberof Chartist.Core\n * @param {Array} data The array that contains the data to be visualized in the chart\n * @param {Object} options The Object that contains the chart options\n * @param {String} dimension Axis dimension 'x' or 'y' used to access the correct value and high / low configuration\n * @return {Object} An object that contains the highest and lowest value that will be visualized on the chart.\n */\n Chartist.getHighLow = function (data, options, dimension) {\n // TODO: Remove workaround for deprecated global high / low config. Axis high / low configuration is preferred\n options = Chartist.extend({}, options, dimension ? options['axis' + dimension.toUpperCase()] : {});\n\n var highLow = {\n high: options.high === undefined ? -Number.MAX_VALUE : +options.high,\n low: options.low === undefined ? Number.MAX_VALUE : +options.low\n };\n var findHigh = options.high === undefined;\n var findLow = options.low === undefined;\n\n // Function to recursively walk through arrays and find highest and lowest number\n function recursiveHighLow(data) {\n if(data === undefined) {\n return undefined;\n } else if(data instanceof Array) {\n for (var i = 0; i < data.length; i++) {\n recursiveHighLow(data[i]);\n }\n } else {\n var value = dimension ? +data[dimension] : +data;\n\n if (findHigh && value > highLow.high) {\n highLow.high = value;\n }\n\n if (findLow && value < highLow.low) {\n highLow.low = value;\n }\n }\n }\n\n // Start to find highest and lowest number recursively\n if(findHigh || findLow) {\n recursiveHighLow(data);\n }\n\n // Overrides of high / low based on reference value, it will make sure that the invisible reference value is\n // used to generate the chart. This is useful when the chart always needs to contain the position of the\n // invisible reference value in the view i.e. for bipolar scales.\n if (options.referenceValue || options.referenceValue === 0) {\n highLow.high = Math.max(options.referenceValue, highLow.high);\n highLow.low = Math.min(options.referenceValue, highLow.low);\n }\n\n // If high and low are the same because of misconfiguration or flat data (only the same value) we need\n // to set the high or low to 0 depending on the polarity\n if (highLow.high <= highLow.low) {\n // If both values are 0 we set high to 1\n if (highLow.low === 0) {\n highLow.high = 1;\n } else if (highLow.low < 0) {\n // If we have the same negative value for the bounds we set bounds.high to 0\n highLow.high = 0;\n } else if (highLow.high > 0) {\n // If we have the same positive value for the bounds we set bounds.low to 0\n highLow.low = 0;\n } else {\n // If data array was empty, values are Number.MAX_VALUE and -Number.MAX_VALUE. Set bounds to prevent errors\n highLow.high = 1;\n highLow.low = 0;\n }\n }\n\n return highLow;\n };\n\n /**\n * Checks if a value can be safely coerced to a number. This includes all values except null which result in finite numbers when coerced. This excludes NaN, since it's not finite.\n *\n * @memberof Chartist.Core\n * @param value\n * @returns {Boolean}\n */\n Chartist.isNumeric = function(value) {\n return value === null ? false : isFinite(value);\n };\n\n /**\n * Returns true on all falsey values except the numeric value 0.\n *\n * @memberof Chartist.Core\n * @param value\n * @returns {boolean}\n */\n Chartist.isFalseyButZero = function(value) {\n return !value && value !== 0;\n };\n\n /**\n * Returns a number if the passed parameter is a valid number or the function will return undefined. On all other values than a valid number, this function will return undefined.\n *\n * @memberof Chartist.Core\n * @param value\n * @returns {*}\n */\n Chartist.getNumberOrUndefined = function(value) {\n return Chartist.isNumeric(value) ? +value : undefined;\n };\n\n /**\n * Checks if provided value object is multi value (contains x or y properties)\n *\n * @memberof Chartist.Core\n * @param value\n */\n Chartist.isMultiValue = function(value) {\n return typeof value === 'object' && ('x' in value || 'y' in value);\n };\n\n /**\n * Gets a value from a dimension `value.x` or `value.y` while returning value directly if it's a valid numeric value. If the value is not numeric and it's falsey this function will return `defaultValue`.\n *\n * @memberof Chartist.Core\n * @param value\n * @param dimension\n * @param defaultValue\n * @returns {*}\n */\n Chartist.getMultiValue = function(value, dimension) {\n if(Chartist.isMultiValue(value)) {\n return Chartist.getNumberOrUndefined(value[dimension || 'y']);\n } else {\n return Chartist.getNumberOrUndefined(value);\n }\n };\n\n /**\n * Pollard Rho Algorithm to find smallest factor of an integer value. There are more efficient algorithms for factorization, but this one is quite efficient and not so complex.\n *\n * @memberof Chartist.Core\n * @param {Number} num An integer number where the smallest factor should be searched for\n * @returns {Number} The smallest integer factor of the parameter num.\n */\n Chartist.rho = function(num) {\n if(num === 1) {\n return num;\n }\n\n function gcd(p, q) {\n if (p % q === 0) {\n return q;\n } else {\n return gcd(q, p % q);\n }\n }\n\n function f(x) {\n return x * x + 1;\n }\n\n var x1 = 2, x2 = 2, divisor;\n if (num % 2 === 0) {\n return 2;\n }\n\n do {\n x1 = f(x1) % num;\n x2 = f(f(x2)) % num;\n divisor = gcd(Math.abs(x1 - x2), num);\n } while (divisor === 1);\n\n return divisor;\n };\n\n /**\n * Calculate and retrieve all the bounds for the chart and return them in one array\n *\n * @memberof Chartist.Core\n * @param {Number} axisLength The length of the Axis used for\n * @param {Object} highLow An object containing a high and low property indicating the value range of the chart.\n * @param {Number} scaleMinSpace The minimum projected length a step should result in\n * @param {Boolean} onlyInteger\n * @return {Object} All the values to set the bounds of the chart\n */\n Chartist.getBounds = function (axisLength, highLow, scaleMinSpace, onlyInteger) {\n var i,\n optimizationCounter = 0,\n newMin,\n newMax,\n bounds = {\n high: highLow.high,\n low: highLow.low\n };\n\n bounds.valueRange = bounds.high - bounds.low;\n bounds.oom = Chartist.orderOfMagnitude(bounds.valueRange);\n bounds.step = Math.pow(10, bounds.oom);\n bounds.min = Math.floor(bounds.low / bounds.step) * bounds.step;\n bounds.max = Math.ceil(bounds.high / bounds.step) * bounds.step;\n bounds.range = bounds.max - bounds.min;\n bounds.numberOfSteps = Math.round(bounds.range / bounds.step);\n\n // Optimize scale step by checking if subdivision is possible based on horizontalGridMinSpace\n // If we are already below the scaleMinSpace value we will scale up\n var length = Chartist.projectLength(axisLength, bounds.step, bounds);\n var scaleUp = length < scaleMinSpace;\n var smallestFactor = onlyInteger ? Chartist.rho(bounds.range) : 0;\n\n // First check if we should only use integer steps and if step 1 is still larger than scaleMinSpace so we can use 1\n if(onlyInteger && Chartist.projectLength(axisLength, 1, bounds) >= scaleMinSpace) {\n bounds.step = 1;\n } else if(onlyInteger && smallestFactor < bounds.step && Chartist.projectLength(axisLength, smallestFactor, bounds) >= scaleMinSpace) {\n // If step 1 was too small, we can try the smallest factor of range\n // If the smallest factor is smaller than the current bounds.step and the projected length of smallest factor\n // is larger than the scaleMinSpace we should go for it.\n bounds.step = smallestFactor;\n } else {\n // Trying to divide or multiply by 2 and find the best step value\n while (true) {\n if (scaleUp && Chartist.projectLength(axisLength, bounds.step, bounds) <= scaleMinSpace) {\n bounds.step *= 2;\n } else if (!scaleUp && Chartist.projectLength(axisLength, bounds.step / 2, bounds) >= scaleMinSpace) {\n bounds.step /= 2;\n if(onlyInteger && bounds.step % 1 !== 0) {\n bounds.step *= 2;\n break;\n }\n } else {\n break;\n }\n\n if(optimizationCounter++ > 1000) {\n throw new Error('Exceeded maximum number of iterations while optimizing scale step!');\n }\n }\n }\n\n var EPSILON = 2.221E-16;\n bounds.step = Math.max(bounds.step, EPSILON);\n function safeIncrement(value, increment) {\n // If increment is too small use *= (1+EPSILON) as a simple nextafter\n if (value === (value += increment)) {\n \tvalue *= (1 + (increment > 0 ? EPSILON : -EPSILON));\n }\n return value;\n }\n\n // Narrow min and max based on new step\n newMin = bounds.min;\n newMax = bounds.max;\n while (newMin + bounds.step <= bounds.low) {\n \tnewMin = safeIncrement(newMin, bounds.step);\n }\n while (newMax - bounds.step >= bounds.high) {\n \tnewMax = safeIncrement(newMax, -bounds.step);\n }\n bounds.min = newMin;\n bounds.max = newMax;\n bounds.range = bounds.max - bounds.min;\n\n var values = [];\n for (i = bounds.min; i <= bounds.max; i = safeIncrement(i, bounds.step)) {\n var value = Chartist.roundWithPrecision(i);\n if (value !== values[values.length - 1]) {\n values.push(value);\n }\n }\n bounds.values = values;\n return bounds;\n };\n\n /**\n * Calculate cartesian coordinates of polar coordinates\n *\n * @memberof Chartist.Core\n * @param {Number} centerX X-axis coordinates of center point of circle segment\n * @param {Number} centerY X-axis coordinates of center point of circle segment\n * @param {Number} radius Radius of circle segment\n * @param {Number} angleInDegrees Angle of circle segment in degrees\n * @return {{x:Number, y:Number}} Coordinates of point on circumference\n */\n Chartist.polarToCartesian = function (centerX, centerY, radius, angleInDegrees) {\n var angleInRadians = (angleInDegrees - 90) * Math.PI / 180.0;\n\n return {\n x: centerX + (radius * Math.cos(angleInRadians)),\n y: centerY + (radius * Math.sin(angleInRadians))\n };\n };\n\n /**\n * Initialize chart drawing rectangle (area where chart is drawn) x1,y1 = bottom left / x2,y2 = top right\n *\n * @memberof Chartist.Core\n * @param {Object} svg The svg element for the chart\n * @param {Object} options The Object that contains all the optional values for the chart\n * @param {Number} [fallbackPadding] The fallback padding if partial padding objects are used\n * @return {Object} The chart rectangles coordinates inside the svg element plus the rectangles measurements\n */\n Chartist.createChartRect = function (svg, options, fallbackPadding) {\n var hasAxis = !!(options.axisX || options.axisY);\n var yAxisOffset = hasAxis ? options.axisY.offset : 0;\n var xAxisOffset = hasAxis ? options.axisX.offset : 0;\n // If width or height results in invalid value (including 0) we fallback to the unitless settings or even 0\n var width = svg.width() || Chartist.quantity(options.width).value || 0;\n var height = svg.height() || Chartist.quantity(options.height).value || 0;\n var normalizedPadding = Chartist.normalizePadding(options.chartPadding, fallbackPadding);\n\n // If settings were to small to cope with offset (legacy) and padding, we'll adjust\n width = Math.max(width, yAxisOffset + normalizedPadding.left + normalizedPadding.right);\n height = Math.max(height, xAxisOffset + normalizedPadding.top + normalizedPadding.bottom);\n\n var chartRect = {\n padding: normalizedPadding,\n width: function () {\n return this.x2 - this.x1;\n },\n height: function () {\n return this.y1 - this.y2;\n }\n };\n\n if(hasAxis) {\n if (options.axisX.position === 'start') {\n chartRect.y2 = normalizedPadding.top + xAxisOffset;\n chartRect.y1 = Math.max(height - normalizedPadding.bottom, chartRect.y2 + 1);\n } else {\n chartRect.y2 = normalizedPadding.top;\n chartRect.y1 = Math.max(height - normalizedPadding.bottom - xAxisOffset, chartRect.y2 + 1);\n }\n\n if (options.axisY.position === 'start') {\n chartRect.x1 = normalizedPadding.left + yAxisOffset;\n chartRect.x2 = Math.max(width - normalizedPadding.right, chartRect.x1 + 1);\n } else {\n chartRect.x1 = normalizedPadding.left;\n chartRect.x2 = Math.max(width - normalizedPadding.right - yAxisOffset, chartRect.x1 + 1);\n }\n } else {\n chartRect.x1 = normalizedPadding.left;\n chartRect.x2 = Math.max(width - normalizedPadding.right, chartRect.x1 + 1);\n chartRect.y2 = normalizedPadding.top;\n chartRect.y1 = Math.max(height - normalizedPadding.bottom, chartRect.y2 + 1);\n }\n\n return chartRect;\n };\n\n /**\n * Creates a grid line based on a projected value.\n *\n * @memberof Chartist.Core\n * @param position\n * @param index\n * @param axis\n * @param offset\n * @param length\n * @param group\n * @param classes\n * @param eventEmitter\n */\n Chartist.createGrid = function(position, index, axis, offset, length, group, classes, eventEmitter) {\n var positionalData = {};\n positionalData[axis.units.pos + '1'] = position;\n positionalData[axis.units.pos + '2'] = position;\n positionalData[axis.counterUnits.pos + '1'] = offset;\n positionalData[axis.counterUnits.pos + '2'] = offset + length;\n\n var gridElement = group.elem('line', positionalData, classes.join(' '));\n\n // Event for grid draw\n eventEmitter.emit('draw',\n Chartist.extend({\n type: 'grid',\n axis: axis,\n index: index,\n group: group,\n element: gridElement\n }, positionalData)\n );\n };\n\n /**\n * Creates a grid background rect and emits the draw event.\n *\n * @memberof Chartist.Core\n * @param gridGroup\n * @param chartRect\n * @param className\n * @param eventEmitter\n */\n Chartist.createGridBackground = function (gridGroup, chartRect, className, eventEmitter) {\n var gridBackground = gridGroup.elem('rect', {\n x: chartRect.x1,\n y: chartRect.y2,\n width: chartRect.width(),\n height: chartRect.height(),\n }, className, true);\n\n // Event for grid background draw\n eventEmitter.emit('draw', {\n type: 'gridBackground',\n group: gridGroup,\n element: gridBackground\n });\n };\n\n /**\n * Creates a label based on a projected value and an axis.\n *\n * @memberof Chartist.Core\n * @param position\n * @param length\n * @param index\n * @param labels\n * @param axis\n * @param axisOffset\n * @param labelOffset\n * @param group\n * @param classes\n * @param useForeignObject\n * @param eventEmitter\n */\n Chartist.createLabel = function(position, length, index, labels, axis, axisOffset, labelOffset, group, classes, useForeignObject, eventEmitter) {\n var labelElement;\n var positionalData = {};\n\n positionalData[axis.units.pos] = position + labelOffset[axis.units.pos];\n positionalData[axis.counterUnits.pos] = labelOffset[axis.counterUnits.pos];\n positionalData[axis.units.len] = length;\n positionalData[axis.counterUnits.len] = Math.max(0, axisOffset - 10);\n\n if(useForeignObject) {\n // We need to set width and height explicitly to px as span will not expand with width and height being\n // 100% in all browsers\n var content = document.createElement('span');\n content.className = classes.join(' ');\n content.setAttribute('xmlns', Chartist.namespaces.xhtml);\n content.innerText = labels[index];\n content.style[axis.units.len] = Math.round(positionalData[axis.units.len]) + 'px';\n content.style[axis.counterUnits.len] = Math.round(positionalData[axis.counterUnits.len]) + 'px';\n\n labelElement = group.foreignObject(content, Chartist.extend({\n style: 'overflow: visible;'\n }, positionalData));\n } else {\n labelElement = group.elem('text', positionalData, classes.join(' ')).text(labels[index]);\n }\n\n eventEmitter.emit('draw', Chartist.extend({\n type: 'label',\n axis: axis,\n index: index,\n group: group,\n element: labelElement,\n text: labels[index]\n }, positionalData));\n };\n\n /**\n * Helper to read series specific options from options object. It automatically falls back to the global option if\n * there is no option in the series options.\n *\n * @param {Object} series Series object\n * @param {Object} options Chartist options object\n * @param {string} key The options key that should be used to obtain the options\n * @returns {*}\n */\n Chartist.getSeriesOption = function(series, options, key) {\n if(series.name && options.series && options.series[series.name]) {\n var seriesOptions = options.series[series.name];\n return seriesOptions.hasOwnProperty(key) ? seriesOptions[key] : options[key];\n } else {\n return options[key];\n }\n };\n\n /**\n * Provides options handling functionality with callback for options changes triggered by responsive options and media query matches\n *\n * @memberof Chartist.Core\n * @param {Object} options Options set by user\n * @param {Array} responsiveOptions Optional functions to add responsive behavior to chart\n * @param {Object} eventEmitter The event emitter that will be used to emit the options changed events\n * @return {Object} The consolidated options object from the defaults, base and matching responsive options\n */\n Chartist.optionsProvider = function (options, responsiveOptions, eventEmitter) {\n var baseOptions = Chartist.extend({}, options),\n currentOptions,\n mediaQueryListeners = [],\n i;\n\n function updateCurrentOptions(mediaEvent) {\n var previousOptions = currentOptions;\n currentOptions = Chartist.extend({}, baseOptions);\n\n if (responsiveOptions) {\n for (i = 0; i < responsiveOptions.length; i++) {\n var mql = window.matchMedia(responsiveOptions[i][0]);\n if (mql.matches) {\n currentOptions = Chartist.extend(currentOptions, responsiveOptions[i][1]);\n }\n }\n }\n\n if(eventEmitter && mediaEvent) {\n eventEmitter.emit('optionsChanged', {\n previousOptions: previousOptions,\n currentOptions: currentOptions\n });\n }\n }\n\n function removeMediaQueryListeners() {\n mediaQueryListeners.forEach(function(mql) {\n mql.removeListener(updateCurrentOptions);\n });\n }\n\n if (!window.matchMedia) {\n throw 'window.matchMedia not found! Make sure you\\'re using a polyfill.';\n } else if (responsiveOptions) {\n\n for (i = 0; i < responsiveOptions.length; i++) {\n var mql = window.matchMedia(responsiveOptions[i][0]);\n mql.addListener(updateCurrentOptions);\n mediaQueryListeners.push(mql);\n }\n }\n // Execute initially without an event argument so we get the correct options\n updateCurrentOptions();\n\n return {\n removeMediaQueryListeners: removeMediaQueryListeners,\n getCurrentOptions: function getCurrentOptions() {\n return Chartist.extend({}, currentOptions);\n }\n };\n };\n\n\n /**\n * Splits a list of coordinates and associated values into segments. Each returned segment contains a pathCoordinates\n * valueData property describing the segment.\n *\n * With the default options, segments consist of contiguous sets of points that do not have an undefined value. Any\n * points with undefined values are discarded.\n *\n * **Options**\n * The following options are used to determine how segments are formed\n * ```javascript\n * var options = {\n * // If fillHoles is true, undefined values are simply discarded without creating a new segment. Assuming other options are default, this returns single segment.\n * fillHoles: false,\n * // If increasingX is true, the coordinates in all segments have strictly increasing x-values.\n * increasingX: false\n * };\n * ```\n *\n * @memberof Chartist.Core\n * @param {Array} pathCoordinates List of point coordinates to be split in the form [x1, y1, x2, y2 ... xn, yn]\n * @param {Array} values List of associated point values in the form [v1, v2 .. vn]\n * @param {Object} options Options set by user\n * @return {Array} List of segments, each containing a pathCoordinates and valueData property.\n */\n Chartist.splitIntoSegments = function(pathCoordinates, valueData, options) {\n var defaultOptions = {\n increasingX: false,\n fillHoles: false\n };\n\n options = Chartist.extend({}, defaultOptions, options);\n\n var segments = [];\n var hole = true;\n\n for(var i = 0; i < pathCoordinates.length; i += 2) {\n // If this value is a \"hole\" we set the hole flag\n if(Chartist.getMultiValue(valueData[i / 2].value) === undefined) {\n // if(valueData[i / 2].value === undefined) {\n if(!options.fillHoles) {\n hole = true;\n }\n } else {\n if(options.increasingX && i >= 2 && pathCoordinates[i] <= pathCoordinates[i-2]) {\n // X is not increasing, so we need to make sure we start a new segment\n hole = true;\n }\n\n\n // If it's a valid value we need to check if we're coming out of a hole and create a new empty segment\n if(hole) {\n segments.push({\n pathCoordinates: [],\n valueData: []\n });\n // As we have a valid value now, we are not in a \"hole\" anymore\n hole = false;\n }\n\n // Add to the segment pathCoordinates and valueData\n segments[segments.length - 1].pathCoordinates.push(pathCoordinates[i], pathCoordinates[i + 1]);\n segments[segments.length - 1].valueData.push(valueData[i / 2]);\n }\n }\n\n return segments;\n };\n}(this || global, Chartist));\n;/**\n * Chartist path interpolation functions.\n *\n * @module Chartist.Interpolation\n */\n/* global Chartist */\n(function(globalRoot, Chartist) {\n 'use strict';\n\n Chartist.Interpolation = {};\n\n /**\n * This interpolation function does not smooth the path and the result is only containing lines and no curves.\n *\n * @example\n * var chart = new Chartist.Line('.ct-chart', {\n * labels: [1, 2, 3, 4, 5],\n * series: [[1, 2, 8, 1, 7]]\n * }, {\n * lineSmooth: Chartist.Interpolation.none({\n * fillHoles: false\n * })\n * });\n *\n *\n * @memberof Chartist.Interpolation\n * @return {Function}\n */\n Chartist.Interpolation.none = function(options) {\n var defaultOptions = {\n fillHoles: false\n };\n options = Chartist.extend({}, defaultOptions, options);\n return function none(pathCoordinates, valueData) {\n var path = new Chartist.Svg.Path();\n var hole = true;\n\n for(var i = 0; i < pathCoordinates.length; i += 2) {\n var currX = pathCoordinates[i];\n var currY = pathCoordinates[i + 1];\n var currData = valueData[i / 2];\n\n if(Chartist.getMultiValue(currData.value) !== undefined) {\n\n if(hole) {\n path.move(currX, currY, false, currData);\n } else {\n path.line(currX, currY, false, currData);\n }\n\n hole = false;\n } else if(!options.fillHoles) {\n hole = true;\n }\n }\n\n return path;\n };\n };\n\n /**\n * Simple smoothing creates horizontal handles that are positioned with a fraction of the length between two data points. You can use the divisor option to specify the amount of smoothing.\n *\n * Simple smoothing can be used instead of `Chartist.Smoothing.cardinal` if you'd like to get rid of the artifacts it produces sometimes. Simple smoothing produces less flowing lines but is accurate by hitting the points and it also doesn't swing below or above the given data point.\n *\n * All smoothing functions within Chartist are factory functions that accept an options parameter. The simple interpolation function accepts one configuration parameter `divisor`, between 1 and ∞, which controls the smoothing characteristics.\n *\n * @example\n * var chart = new Chartist.Line('.ct-chart', {\n * labels: [1, 2, 3, 4, 5],\n * series: [[1, 2, 8, 1, 7]]\n * }, {\n * lineSmooth: Chartist.Interpolation.simple({\n * divisor: 2,\n * fillHoles: false\n * })\n * });\n *\n *\n * @memberof Chartist.Interpolation\n * @param {Object} options The options of the simple interpolation factory function.\n * @return {Function}\n */\n Chartist.Interpolation.simple = function(options) {\n var defaultOptions = {\n divisor: 2,\n fillHoles: false\n };\n options = Chartist.extend({}, defaultOptions, options);\n\n var d = 1 / Math.max(1, options.divisor);\n\n return function simple(pathCoordinates, valueData) {\n var path = new Chartist.Svg.Path();\n var prevX, prevY, prevData;\n\n for(var i = 0; i < pathCoordinates.length; i += 2) {\n var currX = pathCoordinates[i];\n var currY = pathCoordinates[i + 1];\n var length = (currX - prevX) * d;\n var currData = valueData[i / 2];\n\n if(currData.value !== undefined) {\n\n if(prevData === undefined) {\n path.move(currX, currY, false, currData);\n } else {\n path.curve(\n prevX + length,\n prevY,\n currX - length,\n currY,\n currX,\n currY,\n false,\n currData\n );\n }\n\n prevX = currX;\n prevY = currY;\n prevData = currData;\n } else if(!options.fillHoles) {\n prevX = currX = prevData = undefined;\n }\n }\n\n return path;\n };\n };\n\n /**\n * Cardinal / Catmull-Rome spline interpolation is the default smoothing function in Chartist. It produces nice results where the splines will always meet the points. It produces some artifacts though when data values are increased or decreased rapidly. The line may not follow a very accurate path and if the line should be accurate this smoothing function does not produce the best results.\n *\n * Cardinal splines can only be created if there are more than two data points. If this is not the case this smoothing will fallback to `Chartist.Smoothing.none`.\n *\n * All smoothing functions within Chartist are factory functions that accept an options parameter. The cardinal interpolation function accepts one configuration parameter `tension`, between 0 and 1, which controls the smoothing intensity.\n *\n * @example\n * var chart = new Chartist.Line('.ct-chart', {\n * labels: [1, 2, 3, 4, 5],\n * series: [[1, 2, 8, 1, 7]]\n * }, {\n * lineSmooth: Chartist.Interpolation.cardinal({\n * tension: 1,\n * fillHoles: false\n * })\n * });\n *\n * @memberof Chartist.Interpolation\n * @param {Object} options The options of the cardinal factory function.\n * @return {Function}\n */\n Chartist.Interpolation.cardinal = function(options) {\n var defaultOptions = {\n tension: 1,\n fillHoles: false\n };\n\n options = Chartist.extend({}, defaultOptions, options);\n\n var t = Math.min(1, Math.max(0, options.tension)),\n c = 1 - t;\n\n return function cardinal(pathCoordinates, valueData) {\n // First we try to split the coordinates into segments\n // This is necessary to treat \"holes\" in line charts\n var segments = Chartist.splitIntoSegments(pathCoordinates, valueData, {\n fillHoles: options.fillHoles\n });\n\n if(!segments.length) {\n // If there were no segments return 'Chartist.Interpolation.none'\n return Chartist.Interpolation.none()([]);\n } else if(segments.length > 1) {\n // If the split resulted in more that one segment we need to interpolate each segment individually and join them\n // afterwards together into a single path.\n var paths = [];\n // For each segment we will recurse the cardinal function\n segments.forEach(function(segment) {\n paths.push(cardinal(segment.pathCoordinates, segment.valueData));\n });\n // Join the segment path data into a single path and return\n return Chartist.Svg.Path.join(paths);\n } else {\n // If there was only one segment we can proceed regularly by using pathCoordinates and valueData from the first\n // segment\n pathCoordinates = segments[0].pathCoordinates;\n valueData = segments[0].valueData;\n\n // If less than two points we need to fallback to no smoothing\n if(pathCoordinates.length <= 4) {\n return Chartist.Interpolation.none()(pathCoordinates, valueData);\n }\n\n var path = new Chartist.Svg.Path().move(pathCoordinates[0], pathCoordinates[1], false, valueData[0]),\n z;\n\n for (var i = 0, iLen = pathCoordinates.length; iLen - 2 * !z > i; i += 2) {\n var p = [\n {x: +pathCoordinates[i - 2], y: +pathCoordinates[i - 1]},\n {x: +pathCoordinates[i], y: +pathCoordinates[i + 1]},\n {x: +pathCoordinates[i + 2], y: +pathCoordinates[i + 3]},\n {x: +pathCoordinates[i + 4], y: +pathCoordinates[i + 5]}\n ];\n if (z) {\n if (!i) {\n p[0] = {x: +pathCoordinates[iLen - 2], y: +pathCoordinates[iLen - 1]};\n } else if (iLen - 4 === i) {\n p[3] = {x: +pathCoordinates[0], y: +pathCoordinates[1]};\n } else if (iLen - 2 === i) {\n p[2] = {x: +pathCoordinates[0], y: +pathCoordinates[1]};\n p[3] = {x: +pathCoordinates[2], y: +pathCoordinates[3]};\n }\n } else {\n if (iLen - 4 === i) {\n p[3] = p[2];\n } else if (!i) {\n p[0] = {x: +pathCoordinates[i], y: +pathCoordinates[i + 1]};\n }\n }\n\n path.curve(\n (t * (-p[0].x + 6 * p[1].x + p[2].x) / 6) + (c * p[2].x),\n (t * (-p[0].y + 6 * p[1].y + p[2].y) / 6) + (c * p[2].y),\n (t * (p[1].x + 6 * p[2].x - p[3].x) / 6) + (c * p[2].x),\n (t * (p[1].y + 6 * p[2].y - p[3].y) / 6) + (c * p[2].y),\n p[2].x,\n p[2].y,\n false,\n valueData[(i + 2) / 2]\n );\n }\n\n return path;\n }\n };\n };\n\n /**\n * Monotone Cubic spline interpolation produces a smooth curve which preserves monotonicity. Unlike cardinal splines, the curve will not extend beyond the range of y-values of the original data points.\n *\n * Monotone Cubic splines can only be created if there are more than two data points. If this is not the case this smoothing will fallback to `Chartist.Smoothing.none`.\n *\n * The x-values of subsequent points must be increasing to fit a Monotone Cubic spline. If this condition is not met for a pair of adjacent points, then there will be a break in the curve between those data points.\n *\n * All smoothing functions within Chartist are factory functions that accept an options parameter.\n *\n * @example\n * var chart = new Chartist.Line('.ct-chart', {\n * labels: [1, 2, 3, 4, 5],\n * series: [[1, 2, 8, 1, 7]]\n * }, {\n * lineSmooth: Chartist.Interpolation.monotoneCubic({\n * fillHoles: false\n * })\n * });\n *\n * @memberof Chartist.Interpolation\n * @param {Object} options The options of the monotoneCubic factory function.\n * @return {Function}\n */\n Chartist.Interpolation.monotoneCubic = function(options) {\n var defaultOptions = {\n fillHoles: false\n };\n\n options = Chartist.extend({}, defaultOptions, options);\n\n return function monotoneCubic(pathCoordinates, valueData) {\n // First we try to split the coordinates into segments\n // This is necessary to treat \"holes\" in line charts\n var segments = Chartist.splitIntoSegments(pathCoordinates, valueData, {\n fillHoles: options.fillHoles,\n increasingX: true\n });\n\n if(!segments.length) {\n // If there were no segments return 'Chartist.Interpolation.none'\n return Chartist.Interpolation.none()([]);\n } else if(segments.length > 1) {\n // If the split resulted in more that one segment we need to interpolate each segment individually and join them\n // afterwards together into a single path.\n var paths = [];\n // For each segment we will recurse the monotoneCubic fn function\n segments.forEach(function(segment) {\n paths.push(monotoneCubic(segment.pathCoordinates, segment.valueData));\n });\n // Join the segment path data into a single path and return\n return Chartist.Svg.Path.join(paths);\n } else {\n // If there was only one segment we can proceed regularly by using pathCoordinates and valueData from the first\n // segment\n pathCoordinates = segments[0].pathCoordinates;\n valueData = segments[0].valueData;\n\n // If less than three points we need to fallback to no smoothing\n if(pathCoordinates.length <= 4) {\n return Chartist.Interpolation.none()(pathCoordinates, valueData);\n }\n\n var xs = [],\n ys = [],\n i,\n n = pathCoordinates.length / 2,\n ms = [],\n ds = [], dys = [], dxs = [],\n path;\n\n // Populate x and y coordinates into separate arrays, for readability\n\n for(i = 0; i < n; i++) {\n xs[i] = pathCoordinates[i * 2];\n ys[i] = pathCoordinates[i * 2 + 1];\n }\n\n // Calculate deltas and derivative\n\n for(i = 0; i < n - 1; i++) {\n dys[i] = ys[i + 1] - ys[i];\n dxs[i] = xs[i + 1] - xs[i];\n ds[i] = dys[i] / dxs[i];\n }\n\n // Determine desired slope (m) at each point using Fritsch-Carlson method\n // See: http://math.stackexchange.com/questions/45218/implementation-of-monotone-cubic-interpolation\n\n ms[0] = ds[0];\n ms[n - 1] = ds[n - 2];\n\n for(i = 1; i < n - 1; i++) {\n if(ds[i] === 0 || ds[i - 1] === 0 || (ds[i - 1] > 0) !== (ds[i] > 0)) {\n ms[i] = 0;\n } else {\n ms[i] = 3 * (dxs[i - 1] + dxs[i]) / (\n (2 * dxs[i] + dxs[i - 1]) / ds[i - 1] +\n (dxs[i] + 2 * dxs[i - 1]) / ds[i]);\n\n if(!isFinite(ms[i])) {\n ms[i] = 0;\n }\n }\n }\n\n // Now build a path from the slopes\n\n path = new Chartist.Svg.Path().move(xs[0], ys[0], false, valueData[0]);\n\n for(i = 0; i < n - 1; i++) {\n path.curve(\n // First control point\n xs[i] + dxs[i] / 3,\n ys[i] + ms[i] * dxs[i] / 3,\n // Second control point\n xs[i + 1] - dxs[i] / 3,\n ys[i + 1] - ms[i + 1] * dxs[i] / 3,\n // End point\n xs[i + 1],\n ys[i + 1],\n\n false,\n valueData[i + 1]\n );\n }\n\n return path;\n }\n };\n };\n\n /**\n * Step interpolation will cause the line chart to move in steps rather than diagonal or smoothed lines. This interpolation will create additional points that will also be drawn when the `showPoint` option is enabled.\n *\n * All smoothing functions within Chartist are factory functions that accept an options parameter. The step interpolation function accepts one configuration parameter `postpone`, that can be `true` or `false`. The default value is `true` and will cause the step to occur where the value actually changes. If a different behaviour is needed where the step is shifted to the left and happens before the actual value, this option can be set to `false`.\n *\n * @example\n * var chart = new Chartist.Line('.ct-chart', {\n * labels: [1, 2, 3, 4, 5],\n * series: [[1, 2, 8, 1, 7]]\n * }, {\n * lineSmooth: Chartist.Interpolation.step({\n * postpone: true,\n * fillHoles: false\n * })\n * });\n *\n * @memberof Chartist.Interpolation\n * @param options\n * @returns {Function}\n */\n Chartist.Interpolation.step = function(options) {\n var defaultOptions = {\n postpone: true,\n fillHoles: false\n };\n\n options = Chartist.extend({}, defaultOptions, options);\n\n return function step(pathCoordinates, valueData) {\n var path = new Chartist.Svg.Path();\n\n var prevX, prevY, prevData;\n\n for (var i = 0; i < pathCoordinates.length; i += 2) {\n var currX = pathCoordinates[i];\n var currY = pathCoordinates[i + 1];\n var currData = valueData[i / 2];\n\n // If the current point is also not a hole we can draw the step lines\n if(currData.value !== undefined) {\n if(prevData === undefined) {\n path.move(currX, currY, false, currData);\n } else {\n if(options.postpone) {\n // If postponed we should draw the step line with the value of the previous value\n path.line(currX, prevY, false, prevData);\n } else {\n // If not postponed we should draw the step line with the value of the current value\n path.line(prevX, currY, false, currData);\n }\n // Line to the actual point (this should only be a Y-Axis movement\n path.line(currX, currY, false, currData);\n }\n\n prevX = currX;\n prevY = currY;\n prevData = currData;\n } else if(!options.fillHoles) {\n prevX = prevY = prevData = undefined;\n }\n }\n\n return path;\n };\n };\n\n}(this || global, Chartist));\n;/**\n * A very basic event module that helps to generate and catch events.\n *\n * @module Chartist.Event\n */\n/* global Chartist */\n(function (globalRoot, Chartist) {\n 'use strict';\n\n Chartist.EventEmitter = function () {\n var handlers = [];\n\n /**\n * Add an event handler for a specific event\n *\n * @memberof Chartist.Event\n * @param {String} event The event name\n * @param {Function} handler A event handler function\n */\n function addEventHandler(event, handler) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n }\n\n /**\n * Remove an event handler of a specific event name or remove all event handlers for a specific event.\n *\n * @memberof Chartist.Event\n * @param {String} event The event name where a specific or all handlers should be removed\n * @param {Function} [handler] An optional event handler function. If specified only this specific handler will be removed and otherwise all handlers are removed.\n */\n function removeEventHandler(event, handler) {\n // Only do something if there are event handlers with this name existing\n if(handlers[event]) {\n // If handler is set we will look for a specific handler and only remove this\n if(handler) {\n handlers[event].splice(handlers[event].indexOf(handler), 1);\n if(handlers[event].length === 0) {\n delete handlers[event];\n }\n } else {\n // If no handler is specified we remove all handlers for this event\n delete handlers[event];\n }\n }\n }\n\n /**\n * Use this function to emit an event. All handlers that are listening for this event will be triggered with the data parameter.\n *\n * @memberof Chartist.Event\n * @param {String} event The event name that should be triggered\n * @param {*} data Arbitrary data that will be passed to the event handler callback functions\n */\n function emit(event, data) {\n // Only do something if there are event handlers with this name existing\n if(handlers[event]) {\n handlers[event].forEach(function(handler) {\n handler(data);\n });\n }\n\n // Emit event to star event handlers\n if(handlers['*']) {\n handlers['*'].forEach(function(starHandler) {\n starHandler(event, data);\n });\n }\n }\n\n return {\n addEventHandler: addEventHandler,\n removeEventHandler: removeEventHandler,\n emit: emit\n };\n };\n\n}(this || global, Chartist));\n;/**\n * This module provides some basic prototype inheritance utilities.\n *\n * @module Chartist.Class\n */\n/* global Chartist */\n(function(globalRoot, Chartist) {\n 'use strict';\n\n function listToArray(list) {\n var arr = [];\n if (list.length) {\n for (var i = 0; i < list.length; i++) {\n arr.push(list[i]);\n }\n }\n return arr;\n }\n\n /**\n * Method to extend from current prototype.\n *\n * @memberof Chartist.Class\n * @param {Object} properties The object that serves as definition for the prototype that gets created for the new class. This object should always contain a constructor property that is the desired constructor for the newly created class.\n * @param {Object} [superProtoOverride] By default extens will use the current class prototype or Chartist.class. With this parameter you can specify any super prototype that will be used.\n * @return {Function} Constructor function of the new class\n *\n * @example\n * var Fruit = Class.extend({\n * color: undefined,\n * sugar: undefined,\n *\n * constructor: function(color, sugar) {\n * this.color = color;\n * this.sugar = sugar;\n * },\n *\n * eat: function() {\n * this.sugar = 0;\n * return this;\n * }\n * });\n *\n * var Banana = Fruit.extend({\n * length: undefined,\n *\n * constructor: function(length, sugar) {\n * Banana.super.constructor.call(this, 'Yellow', sugar);\n * this.length = length;\n * }\n * });\n *\n * var banana = new Banana(20, 40);\n * console.log('banana instanceof Fruit', banana instanceof Fruit);\n * console.log('Fruit is prototype of banana', Fruit.prototype.isPrototypeOf(banana));\n * console.log('bananas prototype is Fruit', Object.getPrototypeOf(banana) === Fruit.prototype);\n * console.log(banana.sugar);\n * console.log(banana.eat().sugar);\n * console.log(banana.color);\n */\n function extend(properties, superProtoOverride) {\n var superProto = superProtoOverride || this.prototype || Chartist.Class;\n var proto = Object.create(superProto);\n\n Chartist.Class.cloneDefinitions(proto, properties);\n\n var constr = function() {\n var fn = proto.constructor || function () {},\n instance;\n\n // If this is linked to the Chartist namespace the constructor was not called with new\n // To provide a fallback we will instantiate here and return the instance\n instance = this === Chartist ? Object.create(proto) : this;\n fn.apply(instance, Array.prototype.slice.call(arguments, 0));\n\n // If this constructor was not called with new we need to return the instance\n // This will not harm when the constructor has been called with new as the returned value is ignored\n return instance;\n };\n\n constr.prototype = proto;\n constr.super = superProto;\n constr.extend = this.extend;\n\n return constr;\n }\n\n // Variable argument list clones args > 0 into args[0] and retruns modified args[0]\n function cloneDefinitions() {\n var args = listToArray(arguments);\n var target = args[0];\n\n args.splice(1, args.length - 1).forEach(function (source) {\n Object.getOwnPropertyNames(source).forEach(function (propName) {\n // If this property already exist in target we delete it first\n delete target[propName];\n // Define the property with the descriptor from source\n Object.defineProperty(target, propName,\n Object.getOwnPropertyDescriptor(source, propName));\n });\n });\n\n return target;\n }\n\n Chartist.Class = {\n extend: extend,\n cloneDefinitions: cloneDefinitions\n };\n\n}(this || global, Chartist));\n;/**\n * Base for all chart types. The methods in Chartist.Base are inherited to all chart types.\n *\n * @module Chartist.Base\n */\n/* global Chartist */\n(function(globalRoot, Chartist) {\n 'use strict';\n\n var window = globalRoot.window;\n\n // TODO: Currently we need to re-draw the chart on window resize. This is usually very bad and will affect performance.\n // This is done because we can't work with relative coordinates when drawing the chart because SVG Path does not\n // work with relative positions yet. We need to check if we can do a viewBox hack to switch to percentage.\n // See http://mozilla.6506.n7.nabble.com/Specyfing-paths-with-percentages-unit-td247474.html\n // Update: can be done using the above method tested here: http://codepen.io/gionkunz/pen/KDvLj\n // The problem is with the label offsets that can't be converted into percentage and affecting the chart container\n /**\n * Updates the chart which currently does a full reconstruction of the SVG DOM\n *\n * @param {Object} [data] Optional data you'd like to set for the chart before it will update. If not specified the update method will use the data that is already configured with the chart.\n * @param {Object} [options] Optional options you'd like to add to the previous options for the chart before it will update. If not specified the update method will use the options that have been already configured with the chart.\n * @param {Boolean} [override] If set to true, the passed options will be used to extend the options that have been configured already. Otherwise the chart default options will be used as the base\n * @memberof Chartist.Base\n */\n function update(data, options, override) {\n if(data) {\n this.data = data || {};\n this.data.labels = this.data.labels || [];\n this.data.series = this.data.series || [];\n // Event for data transformation that allows to manipulate the data before it gets rendered in the charts\n this.eventEmitter.emit('data', {\n type: 'update',\n data: this.data\n });\n }\n\n if(options) {\n this.options = Chartist.extend({}, override ? this.options : this.defaultOptions, options);\n\n // If chartist was not initialized yet, we just set the options and leave the rest to the initialization\n // Otherwise we re-create the optionsProvider at this point\n if(!this.initializeTimeoutId) {\n this.optionsProvider.removeMediaQueryListeners();\n this.optionsProvider = Chartist.optionsProvider(this.options, this.responsiveOptions, this.eventEmitter);\n }\n }\n\n // Only re-created the chart if it has been initialized yet\n if(!this.initializeTimeoutId) {\n this.createChart(this.optionsProvider.getCurrentOptions());\n }\n\n // Return a reference to the chart object to chain up calls\n return this;\n }\n\n /**\n * This method can be called on the API object of each chart and will un-register all event listeners that were added to other components. This currently includes a window.resize listener as well as media query listeners if any responsive options have been provided. Use this function if you need to destroy and recreate Chartist charts dynamically.\n *\n * @memberof Chartist.Base\n */\n function detach() {\n // Only detach if initialization already occurred on this chart. If this chart still hasn't initialized (therefore\n // the initializationTimeoutId is still a valid timeout reference, we will clear the timeout\n if(!this.initializeTimeoutId) {\n window.removeEventListener('resize', this.resizeListener);\n this.optionsProvider.removeMediaQueryListeners();\n } else {\n window.clearTimeout(this.initializeTimeoutId);\n }\n\n return this;\n }\n\n /**\n * Use this function to register event handlers. The handler callbacks are synchronous and will run in the main thread rather than the event loop.\n *\n * @memberof Chartist.Base\n * @param {String} event Name of the event. Check the examples for supported events.\n * @param {Function} handler The handler function that will be called when an event with the given name was emitted. This function will receive a data argument which contains event data. See the example for more details.\n */\n function on(event, handler) {\n this.eventEmitter.addEventHandler(event, handler);\n return this;\n }\n\n /**\n * Use this function to un-register event handlers. If the handler function parameter is omitted all handlers for the given event will be un-registered.\n *\n * @memberof Chartist.Base\n * @param {String} event Name of the event for which a handler should be removed\n * @param {Function} [handler] The handler function that that was previously used to register a new event handler. This handler will be removed from the event handler list. If this parameter is omitted then all event handlers for the given event are removed from the list.\n */\n function off(event, handler) {\n this.eventEmitter.removeEventHandler(event, handler);\n return this;\n }\n\n function initialize() {\n // Add window resize listener that re-creates the chart\n window.addEventListener('resize', this.resizeListener);\n\n // Obtain current options based on matching media queries (if responsive options are given)\n // This will also register a listener that is re-creating the chart based on media changes\n this.optionsProvider = Chartist.optionsProvider(this.options, this.responsiveOptions, this.eventEmitter);\n // Register options change listener that will trigger a chart update\n this.eventEmitter.addEventHandler('optionsChanged', function() {\n this.update();\n }.bind(this));\n\n // Before the first chart creation we need to register us with all plugins that are configured\n // Initialize all relevant plugins with our chart object and the plugin options specified in the config\n if(this.options.plugins) {\n this.options.plugins.forEach(function(plugin) {\n if(plugin instanceof Array) {\n plugin[0](this, plugin[1]);\n } else {\n plugin(this);\n }\n }.bind(this));\n }\n\n // Event for data transformation that allows to manipulate the data before it gets rendered in the charts\n this.eventEmitter.emit('data', {\n type: 'initial',\n data: this.data\n });\n\n // Create the first chart\n this.createChart(this.optionsProvider.getCurrentOptions());\n\n // As chart is initialized from the event loop now we can reset our timeout reference\n // This is important if the chart gets initialized on the same element twice\n this.initializeTimeoutId = undefined;\n }\n\n /**\n * Constructor of chart base class.\n *\n * @param query\n * @param data\n * @param defaultOptions\n * @param options\n * @param responsiveOptions\n * @constructor\n */\n function Base(query, data, defaultOptions, options, responsiveOptions) {\n this.container = Chartist.querySelector(query);\n this.data = data || {};\n this.data.labels = this.data.labels || [];\n this.data.series = this.data.series || [];\n this.defaultOptions = defaultOptions;\n this.options = options;\n this.responsiveOptions = responsiveOptions;\n this.eventEmitter = Chartist.EventEmitter();\n this.supportsForeignObject = Chartist.Svg.isSupported('Extensibility');\n this.supportsAnimations = Chartist.Svg.isSupported('AnimationEventsAttribute');\n this.resizeListener = function resizeListener(){\n this.update();\n }.bind(this);\n\n if(this.container) {\n // If chartist was already initialized in this container we are detaching all event listeners first\n if(this.container.__chartist__) {\n this.container.__chartist__.detach();\n }\n\n this.container.__chartist__ = this;\n }\n\n // Using event loop for first draw to make it possible to register event listeners in the same call stack where\n // the chart was created.\n this.initializeTimeoutId = setTimeout(initialize.bind(this), 0);\n }\n\n // Creating the chart base class\n Chartist.Base = Chartist.Class.extend({\n constructor: Base,\n optionsProvider: undefined,\n container: undefined,\n svg: undefined,\n eventEmitter: undefined,\n createChart: function() {\n throw new Error('Base chart type can\\'t be instantiated!');\n },\n update: update,\n detach: detach,\n on: on,\n off: off,\n version: Chartist.version,\n supportsForeignObject: false\n });\n\n}(this || global, Chartist));\n;/**\n * Chartist SVG module for simple SVG DOM abstraction\n *\n * @module Chartist.Svg\n */\n/* global Chartist */\n(function(globalRoot, Chartist) {\n 'use strict';\n\n var document = globalRoot.document;\n\n /**\n * Chartist.Svg creates a new SVG object wrapper with a starting element. You can use the wrapper to fluently create sub-elements and modify them.\n *\n * @memberof Chartist.Svg\n * @constructor\n * @param {String|Element} name The name of the SVG element to create or an SVG dom element which should be wrapped into Chartist.Svg\n * @param {Object} attributes An object with properties that will be added as attributes to the SVG element that is created. Attributes with undefined values will not be added.\n * @param {String} className This class or class list will be added to the SVG element\n * @param {Object} parent The parent SVG wrapper object where this newly created wrapper and it's element will be attached to as child\n * @param {Boolean} insertFirst If this param is set to true in conjunction with a parent element the newly created element will be added as first child element in the parent element\n */\n function Svg(name, attributes, className, parent, insertFirst) {\n // If Svg is getting called with an SVG element we just return the wrapper\n if(name instanceof Element) {\n this._node = name;\n } else {\n this._node = document.createElementNS(Chartist.namespaces.svg, name);\n\n // If this is an SVG element created then custom namespace\n if(name === 'svg') {\n this.attr({\n 'xmlns:ct': Chartist.namespaces.ct\n });\n }\n }\n\n if(attributes) {\n this.attr(attributes);\n }\n\n if(className) {\n this.addClass(className);\n }\n\n if(parent) {\n if (insertFirst && parent._node.firstChild) {\n parent._node.insertBefore(this._node, parent._node.firstChild);\n } else {\n parent._node.appendChild(this._node);\n }\n }\n }\n\n /**\n * Set attributes on the current SVG element of the wrapper you're currently working on.\n *\n * @memberof Chartist.Svg\n * @param {Object|String} attributes An object with properties that will be added as attributes to the SVG element that is created. Attributes with undefined values will not be added. If this parameter is a String then the function is used as a getter and will return the attribute value.\n * @param {String} [ns] If specified, the attribute will be obtained using getAttributeNs. In order to write namepsaced attributes you can use the namespace:attribute notation within the attributes object.\n * @return {Object|String} The current wrapper object will be returned so it can be used for chaining or the attribute value if used as getter function.\n */\n function attr(attributes, ns) {\n if(typeof attributes === 'string') {\n if(ns) {\n return this._node.getAttributeNS(ns, attributes);\n } else {\n return this._node.getAttribute(attributes);\n }\n }\n\n Object.keys(attributes).forEach(function(key) {\n // If the attribute value is undefined we can skip this one\n if(attributes[key] === undefined) {\n return;\n }\n\n if (key.indexOf(':') !== -1) {\n var namespacedAttribute = key.split(':');\n this._node.setAttributeNS(Chartist.namespaces[namespacedAttribute[0]], key, attributes[key]);\n } else {\n this._node.setAttribute(key, attributes[key]);\n }\n }.bind(this));\n\n return this;\n }\n\n /**\n * Create a new SVG element whose wrapper object will be selected for further operations. This way you can also create nested groups easily.\n *\n * @memberof Chartist.Svg\n * @param {String} name The name of the SVG element that should be created as child element of the currently selected element wrapper\n * @param {Object} [attributes] An object with properties that will be added as attributes to the SVG element that is created. Attributes with undefined values will not be added.\n * @param {String} [className] This class or class list will be added to the SVG element\n * @param {Boolean} [insertFirst] If this param is set to true in conjunction with a parent element the newly created element will be added as first child element in the parent element\n * @return {Chartist.Svg} Returns a Chartist.Svg wrapper object that can be used to modify the containing SVG data\n */\n function elem(name, attributes, className, insertFirst) {\n return new Chartist.Svg(name, attributes, className, this, insertFirst);\n }\n\n /**\n * Returns the parent Chartist.SVG wrapper object\n *\n * @memberof Chartist.Svg\n * @return {Chartist.Svg} Returns a Chartist.Svg wrapper around the parent node of the current node. If the parent node is not existing or it's not an SVG node then this function will return null.\n */\n function parent() {\n return this._node.parentNode instanceof SVGElement ? new Chartist.Svg(this._node.parentNode) : null;\n }\n\n /**\n * This method returns a Chartist.Svg wrapper around the root SVG element of the current tree.\n *\n * @memberof Chartist.Svg\n * @return {Chartist.Svg} The root SVG element wrapped in a Chartist.Svg element\n */\n function root() {\n var node = this._node;\n while(node.nodeName !== 'svg') {\n node = node.parentNode;\n }\n return new Chartist.Svg(node);\n }\n\n /**\n * Find the first child SVG element of the current element that matches a CSS selector. The returned object is a Chartist.Svg wrapper.\n *\n * @memberof Chartist.Svg\n * @param {String} selector A CSS selector that is used to query for child SVG elements\n * @return {Chartist.Svg} The SVG wrapper for the element found or null if no element was found\n */\n function querySelector(selector) {\n var foundNode = this._node.querySelector(selector);\n return foundNode ? new Chartist.Svg(foundNode) : null;\n }\n\n /**\n * Find the all child SVG elements of the current element that match a CSS selector. The returned object is a Chartist.Svg.List wrapper.\n *\n * @memberof Chartist.Svg\n * @param {String} selector A CSS selector that is used to query for child SVG elements\n * @return {Chartist.Svg.List} The SVG wrapper list for the element found or null if no element was found\n */\n function querySelectorAll(selector) {\n var foundNodes = this._node.querySelectorAll(selector);\n return foundNodes.length ? new Chartist.Svg.List(foundNodes) : null;\n }\n\n /**\n * Returns the underlying SVG node for the current element.\n *\n * @memberof Chartist.Svg\n * @returns {Node}\n */\n function getNode() {\n return this._node;\n }\n\n /**\n * This method creates a foreignObject (see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/foreignObject) that allows to embed HTML content into a SVG graphic. With the help of foreignObjects you can enable the usage of regular HTML elements inside of SVG where they are subject for SVG positioning and transformation but the Browser will use the HTML rendering capabilities for the containing DOM.\n *\n * @memberof Chartist.Svg\n * @param {Node|String} content The DOM Node, or HTML string that will be converted to a DOM Node, that is then placed into and wrapped by the foreignObject\n * @param {String} [attributes] An object with properties that will be added as attributes to the foreignObject element that is created. Attributes with undefined values will not be added.\n * @param {String} [className] This class or class list will be added to the SVG element\n * @param {Boolean} [insertFirst] Specifies if the foreignObject should be inserted as first child\n * @return {Chartist.Svg} New wrapper object that wraps the foreignObject element\n */\n function foreignObject(content, attributes, className, insertFirst) {\n // If content is string then we convert it to DOM\n // TODO: Handle case where content is not a string nor a DOM Node\n if(typeof content === 'string') {\n var container = document.createElement('div');\n container.innerHTML = content;\n content = container.firstChild;\n }\n\n // Adding namespace to content element\n content.setAttribute('xmlns', Chartist.namespaces.xmlns);\n\n // Creating the foreignObject without required extension attribute (as described here\n // http://www.w3.org/TR/SVG/extend.html#ForeignObjectElement)\n var fnObj = this.elem('foreignObject', attributes, className, insertFirst);\n\n // Add content to foreignObjectElement\n fnObj._node.appendChild(content);\n\n return fnObj;\n }\n\n /**\n * This method adds a new text element to the current Chartist.Svg wrapper.\n *\n * @memberof Chartist.Svg\n * @param {String} t The text that should be added to the text element that is created\n * @return {Chartist.Svg} The same wrapper object that was used to add the newly created element\n */\n function text(t) {\n this._node.appendChild(document.createTextNode(t));\n return this;\n }\n\n /**\n * This method will clear all child nodes of the current wrapper object.\n *\n * @memberof Chartist.Svg\n * @return {Chartist.Svg} The same wrapper object that got emptied\n */\n function empty() {\n while (this._node.firstChild) {\n this._node.removeChild(this._node.firstChild);\n }\n\n return this;\n }\n\n /**\n * This method will cause the current wrapper to remove itself from its parent wrapper. Use this method if you'd like to get rid of an element in a given DOM structure.\n *\n * @memberof Chartist.Svg\n * @return {Chartist.Svg} The parent wrapper object of the element that got removed\n */\n function remove() {\n this._node.parentNode.removeChild(this._node);\n return this.parent();\n }\n\n /**\n * This method will replace the element with a new element that can be created outside of the current DOM.\n *\n * @memberof Chartist.Svg\n * @param {Chartist.Svg} newElement The new Chartist.Svg object that will be used to replace the current wrapper object\n * @return {Chartist.Svg} The wrapper of the new element\n */\n function replace(newElement) {\n this._node.parentNode.replaceChild(newElement._node, this._node);\n return newElement;\n }\n\n /**\n * This method will append an element to the current element as a child.\n *\n * @memberof Chartist.Svg\n * @param {Chartist.Svg} element The Chartist.Svg element that should be added as a child\n * @param {Boolean} [insertFirst] Specifies if the element should be inserted as first child\n * @return {Chartist.Svg} The wrapper of the appended object\n */\n function append(element, insertFirst) {\n if(insertFirst && this._node.firstChild) {\n this._node.insertBefore(element._node, this._node.firstChild);\n } else {\n this._node.appendChild(element._node);\n }\n\n return this;\n }\n\n /**\n * Returns an array of class names that are attached to the current wrapper element. This method can not be chained further.\n *\n * @memberof Chartist.Svg\n * @return {Array} A list of classes or an empty array if there are no classes on the current element\n */\n function classes() {\n return this._node.getAttribute('class') ? this._node.getAttribute('class').trim().split(/\\s+/) : [];\n }\n\n /**\n * Adds one or a space separated list of classes to the current element and ensures the classes are only existing once.\n *\n * @memberof Chartist.Svg\n * @param {String} names A white space separated list of class names\n * @return {Chartist.Svg} The wrapper of the current element\n */\n function addClass(names) {\n this._node.setAttribute('class',\n this.classes(this._node)\n .concat(names.trim().split(/\\s+/))\n .filter(function(elem, pos, self) {\n return self.indexOf(elem) === pos;\n }).join(' ')\n );\n\n return this;\n }\n\n /**\n * Removes one or a space separated list of classes from the current element.\n *\n * @memberof Chartist.Svg\n * @param {String} names A white space separated list of class names\n * @return {Chartist.Svg} The wrapper of the current element\n */\n function removeClass(names) {\n var removedClasses = names.trim().split(/\\s+/);\n\n this._node.setAttribute('class', this.classes(this._node).filter(function(name) {\n return removedClasses.indexOf(name) === -1;\n }).join(' '));\n\n return this;\n }\n\n /**\n * Removes all classes from the current element.\n *\n * @memberof Chartist.Svg\n * @return {Chartist.Svg} The wrapper of the current element\n */\n function removeAllClasses() {\n this._node.setAttribute('class', '');\n\n return this;\n }\n\n /**\n * Get element height using `getBoundingClientRect`\n *\n * @memberof Chartist.Svg\n * @return {Number} The elements height in pixels\n */\n function height() {\n return this._node.getBoundingClientRect().height;\n }\n\n /**\n * Get element width using `getBoundingClientRect`\n *\n * @memberof Chartist.Core\n * @return {Number} The elements width in pixels\n */\n function width() {\n return this._node.getBoundingClientRect().width;\n }\n\n /**\n * The animate function lets you animate the current element with SMIL animations. You can add animations for multiple attributes at the same time by using an animation definition object. This object should contain SMIL animation attributes. Please refer to http://www.w3.org/TR/SVG/animate.html for a detailed specification about the available animation attributes. Additionally an easing property can be passed in the animation definition object. This can be a string with a name of an easing function in `Chartist.Svg.Easing` or an array with four numbers specifying a cubic Bézier curve.\n * **An animations object could look like this:**\n * ```javascript\n * element.animate({\n * opacity: {\n * dur: 1000,\n * from: 0,\n * to: 1\n * },\n * x1: {\n * dur: '1000ms',\n * from: 100,\n * to: 200,\n * easing: 'easeOutQuart'\n * },\n * y1: {\n * dur: '2s',\n * from: 0,\n * to: 100\n * }\n * });\n * ```\n * **Automatic unit conversion**\n * For the `dur` and the `begin` animate attribute you can also omit a unit by passing a number. The number will automatically be converted to milli seconds.\n * **Guided mode**\n * The default behavior of SMIL animations with offset using the `begin` attribute is that the attribute will keep it's original value until the animation starts. Mostly this behavior is not desired as you'd like to have your element attributes already initialized with the animation `from` value even before the animation starts. Also if you don't specify `fill=\"freeze\"` on an animate element or if you delete the animation after it's done (which is done in guided mode) the attribute will switch back to the initial value. This behavior is also not desired when performing simple one-time animations. For one-time animations you'd want to trigger animations immediately instead of relative to the document begin time. That's why in guided mode Chartist.Svg will also use the `begin` property to schedule a timeout and manually start the animation after the timeout. If you're using multiple SMIL definition objects for an attribute (in an array), guided mode will be disabled for this attribute, even if you explicitly enabled it.\n * If guided mode is enabled the following behavior is added:\n * - Before the animation starts (even when delayed with `begin`) the animated attribute will be set already to the `from` value of the animation\n * - `begin` is explicitly set to `indefinite` so it can be started manually without relying on document begin time (creation)\n * - The animate element will be forced to use `fill=\"freeze\"`\n * - The animation will be triggered with `beginElement()` in a timeout where `begin` of the definition object is interpreted in milli seconds. If no `begin` was specified the timeout is triggered immediately.\n * - After the animation the element attribute value will be set to the `to` value of the animation\n * - The animate element is deleted from the DOM\n *\n * @memberof Chartist.Svg\n * @param {Object} animations An animations object where the property keys are the attributes you'd like to animate. The properties should be objects again that contain the SMIL animation attributes (usually begin, dur, from, and to). The property begin and dur is auto converted (see Automatic unit conversion). You can also schedule multiple animations for the same attribute by passing an Array of SMIL definition objects. Attributes that contain an array of SMIL definition objects will not be executed in guided mode.\n * @param {Boolean} guided Specify if guided mode should be activated for this animation (see Guided mode). If not otherwise specified, guided mode will be activated.\n * @param {Object} eventEmitter If specified, this event emitter will be notified when an animation starts or ends.\n * @return {Chartist.Svg} The current element where the animation was added\n */\n function animate(animations, guided, eventEmitter) {\n if(guided === undefined) {\n guided = true;\n }\n\n Object.keys(animations).forEach(function createAnimateForAttributes(attribute) {\n\n function createAnimate(animationDefinition, guided) {\n var attributeProperties = {},\n animate,\n timeout,\n easing;\n\n // Check if an easing is specified in the definition object and delete it from the object as it will not\n // be part of the animate element attributes.\n if(animationDefinition.easing) {\n // If already an easing Bézier curve array we take it or we lookup a easing array in the Easing object\n easing = animationDefinition.easing instanceof Array ?\n animationDefinition.easing :\n Chartist.Svg.Easing[animationDefinition.easing];\n delete animationDefinition.easing;\n }\n\n // If numeric dur or begin was provided we assume milli seconds\n animationDefinition.begin = Chartist.ensureUnit(animationDefinition.begin, 'ms');\n animationDefinition.dur = Chartist.ensureUnit(animationDefinition.dur, 'ms');\n\n if(easing) {\n animationDefinition.calcMode = 'spline';\n animationDefinition.keySplines = easing.join(' ');\n animationDefinition.keyTimes = '0;1';\n }\n\n // Adding \"fill: freeze\" if we are in guided mode and set initial attribute values\n if(guided) {\n animationDefinition.fill = 'freeze';\n // Animated property on our element should already be set to the animation from value in guided mode\n attributeProperties[attribute] = animationDefinition.from;\n this.attr(attributeProperties);\n\n // In guided mode we also set begin to indefinite so we can trigger the start manually and put the begin\n // which needs to be in ms aside\n timeout = Chartist.quantity(animationDefinition.begin || 0).value;\n animationDefinition.begin = 'indefinite';\n }\n\n animate = this.elem('animate', Chartist.extend({\n attributeName: attribute\n }, animationDefinition));\n\n if(guided) {\n // If guided we take the value that was put aside in timeout and trigger the animation manually with a timeout\n setTimeout(function() {\n // If beginElement fails we set the animated attribute to the end position and remove the animate element\n // This happens if the SMIL ElementTimeControl interface is not supported or any other problems occured in\n // the browser. (Currently FF 34 does not support animate elements in foreignObjects)\n try {\n animate._node.beginElement();\n } catch(err) {\n // Set animated attribute to current animated value\n attributeProperties[attribute] = animationDefinition.to;\n this.attr(attributeProperties);\n // Remove the animate element as it's no longer required\n animate.remove();\n }\n }.bind(this), timeout);\n }\n\n if(eventEmitter) {\n animate._node.addEventListener('beginEvent', function handleBeginEvent() {\n eventEmitter.emit('animationBegin', {\n element: this,\n animate: animate._node,\n params: animationDefinition\n });\n }.bind(this));\n }\n\n animate._node.addEventListener('endEvent', function handleEndEvent() {\n if(eventEmitter) {\n eventEmitter.emit('animationEnd', {\n element: this,\n animate: animate._node,\n params: animationDefinition\n });\n }\n\n if(guided) {\n // Set animated attribute to current animated value\n attributeProperties[attribute] = animationDefinition.to;\n this.attr(attributeProperties);\n // Remove the animate element as it's no longer required\n animate.remove();\n }\n }.bind(this));\n }\n\n // If current attribute is an array of definition objects we create an animate for each and disable guided mode\n if(animations[attribute] instanceof Array) {\n animations[attribute].forEach(function(animationDefinition) {\n createAnimate.bind(this)(animationDefinition, false);\n }.bind(this));\n } else {\n createAnimate.bind(this)(animations[attribute], guided);\n }\n\n }.bind(this));\n\n return this;\n }\n\n Chartist.Svg = Chartist.Class.extend({\n constructor: Svg,\n attr: attr,\n elem: elem,\n parent: parent,\n root: root,\n querySelector: querySelector,\n querySelectorAll: querySelectorAll,\n getNode: getNode,\n foreignObject: foreignObject,\n text: text,\n empty: empty,\n remove: remove,\n replace: replace,\n append: append,\n classes: classes,\n addClass: addClass,\n removeClass: removeClass,\n removeAllClasses: removeAllClasses,\n height: height,\n width: width,\n animate: animate\n });\n\n /**\n * This method checks for support of a given SVG feature like Extensibility, SVG-animation or the like. Check http://www.w3.org/TR/SVG11/feature for a detailed list.\n *\n * @memberof Chartist.Svg\n * @param {String} feature The SVG 1.1 feature that should be checked for support.\n * @return {Boolean} True of false if the feature is supported or not\n */\n Chartist.Svg.isSupported = function(feature) {\n return document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#' + feature, '1.1');\n };\n\n /**\n * This Object contains some standard easing cubic bezier curves. Then can be used with their name in the `Chartist.Svg.animate`. You can also extend the list and use your own name in the `animate` function. Click the show code button to see the available bezier functions.\n *\n * @memberof Chartist.Svg\n */\n var easingCubicBeziers = {\n easeInSine: [0.47, 0, 0.745, 0.715],\n easeOutSine: [0.39, 0.575, 0.565, 1],\n easeInOutSine: [0.445, 0.05, 0.55, 0.95],\n easeInQuad: [0.55, 0.085, 0.68, 0.53],\n easeOutQuad: [0.25, 0.46, 0.45, 0.94],\n easeInOutQuad: [0.455, 0.03, 0.515, 0.955],\n easeInCubic: [0.55, 0.055, 0.675, 0.19],\n easeOutCubic: [0.215, 0.61, 0.355, 1],\n easeInOutCubic: [0.645, 0.045, 0.355, 1],\n easeInQuart: [0.895, 0.03, 0.685, 0.22],\n easeOutQuart: [0.165, 0.84, 0.44, 1],\n easeInOutQuart: [0.77, 0, 0.175, 1],\n easeInQuint: [0.755, 0.05, 0.855, 0.06],\n easeOutQuint: [0.23, 1, 0.32, 1],\n easeInOutQuint: [0.86, 0, 0.07, 1],\n easeInExpo: [0.95, 0.05, 0.795, 0.035],\n easeOutExpo: [0.19, 1, 0.22, 1],\n easeInOutExpo: [1, 0, 0, 1],\n easeInCirc: [0.6, 0.04, 0.98, 0.335],\n easeOutCirc: [0.075, 0.82, 0.165, 1],\n easeInOutCirc: [0.785, 0.135, 0.15, 0.86],\n easeInBack: [0.6, -0.28, 0.735, 0.045],\n easeOutBack: [0.175, 0.885, 0.32, 1.275],\n easeInOutBack: [0.68, -0.55, 0.265, 1.55]\n };\n\n Chartist.Svg.Easing = easingCubicBeziers;\n\n /**\n * This helper class is to wrap multiple `Chartist.Svg` elements into a list where you can call the `Chartist.Svg` functions on all elements in the list with one call. This is helpful when you'd like to perform calls with `Chartist.Svg` on multiple elements.\n * An instance of this class is also returned by `Chartist.Svg.querySelectorAll`.\n *\n * @memberof Chartist.Svg\n * @param {Array<Node>|NodeList} nodeList An Array of SVG DOM nodes or a SVG DOM NodeList (as returned by document.querySelectorAll)\n * @constructor\n */\n function SvgList(nodeList) {\n var list = this;\n\n this.svgElements = [];\n for(var i = 0; i < nodeList.length; i++) {\n this.svgElements.push(new Chartist.Svg(nodeList[i]));\n }\n\n // Add delegation methods for Chartist.Svg\n Object.keys(Chartist.Svg.prototype).filter(function(prototypeProperty) {\n return ['constructor',\n 'parent',\n 'querySelector',\n 'querySelectorAll',\n 'replace',\n 'append',\n 'classes',\n 'height',\n 'width'].indexOf(prototypeProperty) === -1;\n }).forEach(function(prototypeProperty) {\n list[prototypeProperty] = function() {\n var args = Array.prototype.slice.call(arguments, 0);\n list.svgElements.forEach(function(element) {\n Chartist.Svg.prototype[prototypeProperty].apply(element, args);\n });\n return list;\n };\n });\n }\n\n Chartist.Svg.List = Chartist.Class.extend({\n constructor: SvgList\n });\n}(this || global, Chartist));\n;/**\n * Chartist SVG path module for SVG path description creation and modification.\n *\n * @module Chartist.Svg.Path\n */\n/* global Chartist */\n(function(globalRoot, Chartist) {\n 'use strict';\n\n /**\n * Contains the descriptors of supported element types in a SVG path. Currently only move, line and curve are supported.\n *\n * @memberof Chartist.Svg.Path\n * @type {Object}\n */\n var elementDescriptions = {\n m: ['x', 'y'],\n l: ['x', 'y'],\n c: ['x1', 'y1', 'x2', 'y2', 'x', 'y'],\n a: ['rx', 'ry', 'xAr', 'lAf', 'sf', 'x', 'y']\n };\n\n /**\n * Default options for newly created SVG path objects.\n *\n * @memberof Chartist.Svg.Path\n * @type {Object}\n */\n var defaultOptions = {\n // The accuracy in digit count after the decimal point. This will be used to round numbers in the SVG path. If this option is set to false then no rounding will be performed.\n accuracy: 3\n };\n\n function element(command, params, pathElements, pos, relative, data) {\n var pathElement = Chartist.extend({\n command: relative ? command.toLowerCase() : command.toUpperCase()\n }, params, data ? { data: data } : {} );\n\n pathElements.splice(pos, 0, pathElement);\n }\n\n function forEachParam(pathElements, cb) {\n pathElements.forEach(function(pathElement, pathElementIndex) {\n elementDescriptions[pathElement.command.toLowerCase()].forEach(function(paramName, paramIndex) {\n cb(pathElement, paramName, pathElementIndex, paramIndex, pathElements);\n });\n });\n }\n\n /**\n * Used to construct a new path object.\n *\n * @memberof Chartist.Svg.Path\n * @param {Boolean} close If set to true then this path will be closed when stringified (with a Z at the end)\n * @param {Object} options Options object that overrides the default objects. See default options for more details.\n * @constructor\n */\n function SvgPath(close, options) {\n this.pathElements = [];\n this.pos = 0;\n this.close = close;\n this.options = Chartist.extend({}, defaultOptions, options);\n }\n\n /**\n * Gets or sets the current position (cursor) inside of the path. You can move around the cursor freely but limited to 0 or the count of existing elements. All modifications with element functions will insert new elements at the position of this cursor.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} [pos] If a number is passed then the cursor is set to this position in the path element array.\n * @return {Chartist.Svg.Path|Number} If the position parameter was passed then the return value will be the path object for easy call chaining. If no position parameter was passed then the current position is returned.\n */\n function position(pos) {\n if(pos !== undefined) {\n this.pos = Math.max(0, Math.min(this.pathElements.length, pos));\n return this;\n } else {\n return this.pos;\n }\n }\n\n /**\n * Removes elements from the path starting at the current position.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} count Number of path elements that should be removed from the current position.\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function remove(count) {\n this.pathElements.splice(this.pos, count);\n return this;\n }\n\n /**\n * Use this function to add a new move SVG path element.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} x The x coordinate for the move element.\n * @param {Number} y The y coordinate for the move element.\n * @param {Boolean} [relative] If set to true the move element will be created with relative coordinates (lowercase letter)\n * @param {*} [data] Any data that should be stored with the element object that will be accessible in pathElement\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function move(x, y, relative, data) {\n element('M', {\n x: +x,\n y: +y\n }, this.pathElements, this.pos++, relative, data);\n return this;\n }\n\n /**\n * Use this function to add a new line SVG path element.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} x The x coordinate for the line element.\n * @param {Number} y The y coordinate for the line element.\n * @param {Boolean} [relative] If set to true the line element will be created with relative coordinates (lowercase letter)\n * @param {*} [data] Any data that should be stored with the element object that will be accessible in pathElement\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function line(x, y, relative, data) {\n element('L', {\n x: +x,\n y: +y\n }, this.pathElements, this.pos++, relative, data);\n return this;\n }\n\n /**\n * Use this function to add a new curve SVG path element.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} x1 The x coordinate for the first control point of the bezier curve.\n * @param {Number} y1 The y coordinate for the first control point of the bezier curve.\n * @param {Number} x2 The x coordinate for the second control point of the bezier curve.\n * @param {Number} y2 The y coordinate for the second control point of the bezier curve.\n * @param {Number} x The x coordinate for the target point of the curve element.\n * @param {Number} y The y coordinate for the target point of the curve element.\n * @param {Boolean} [relative] If set to true the curve element will be created with relative coordinates (lowercase letter)\n * @param {*} [data] Any data that should be stored with the element object that will be accessible in pathElement\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function curve(x1, y1, x2, y2, x, y, relative, data) {\n element('C', {\n x1: +x1,\n y1: +y1,\n x2: +x2,\n y2: +y2,\n x: +x,\n y: +y\n }, this.pathElements, this.pos++, relative, data);\n return this;\n }\n\n /**\n * Use this function to add a new non-bezier curve SVG path element.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} rx The radius to be used for the x-axis of the arc.\n * @param {Number} ry The radius to be used for the y-axis of the arc.\n * @param {Number} xAr Defines the orientation of the arc\n * @param {Number} lAf Large arc flag\n * @param {Number} sf Sweep flag\n * @param {Number} x The x coordinate for the target point of the curve element.\n * @param {Number} y The y coordinate for the target point of the curve element.\n * @param {Boolean} [relative] If set to true the curve element will be created with relative coordinates (lowercase letter)\n * @param {*} [data] Any data that should be stored with the element object that will be accessible in pathElement\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function arc(rx, ry, xAr, lAf, sf, x, y, relative, data) {\n element('A', {\n rx: +rx,\n ry: +ry,\n xAr: +xAr,\n lAf: +lAf,\n sf: +sf,\n x: +x,\n y: +y\n }, this.pathElements, this.pos++, relative, data);\n return this;\n }\n\n /**\n * Parses an SVG path seen in the d attribute of path elements, and inserts the parsed elements into the existing path object at the current cursor position. Any closing path indicators (Z at the end of the path) will be ignored by the parser as this is provided by the close option in the options of the path object.\n *\n * @memberof Chartist.Svg.Path\n * @param {String} path Any SVG path that contains move (m), line (l) or curve (c) components.\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function parse(path) {\n // Parsing the SVG path string into an array of arrays [['M', '10', '10'], ['L', '100', '100']]\n var chunks = path.replace(/([A-Za-z])([0-9])/g, '$1 $2')\n .replace(/([0-9])([A-Za-z])/g, '$1 $2')\n .split(/[\\s,]+/)\n .reduce(function(result, element) {\n if(element.match(/[A-Za-z]/)) {\n result.push([]);\n }\n\n result[result.length - 1].push(element);\n return result;\n }, []);\n\n // If this is a closed path we remove the Z at the end because this is determined by the close option\n if(chunks[chunks.length - 1][0].toUpperCase() === 'Z') {\n chunks.pop();\n }\n\n // Using svgPathElementDescriptions to map raw path arrays into objects that contain the command and the parameters\n // For example {command: 'M', x: '10', y: '10'}\n var elements = chunks.map(function(chunk) {\n var command = chunk.shift(),\n description = elementDescriptions[command.toLowerCase()];\n\n return Chartist.extend({\n command: command\n }, description.reduce(function(result, paramName, index) {\n result[paramName] = +chunk[index];\n return result;\n }, {}));\n });\n\n // Preparing a splice call with the elements array as var arg params and insert the parsed elements at the current position\n var spliceArgs = [this.pos, 0];\n Array.prototype.push.apply(spliceArgs, elements);\n Array.prototype.splice.apply(this.pathElements, spliceArgs);\n // Increase the internal position by the element count\n this.pos += elements.length;\n\n return this;\n }\n\n /**\n * This function renders to current SVG path object into a final SVG string that can be used in the d attribute of SVG path elements. It uses the accuracy option to round big decimals. If the close parameter was set in the constructor of this path object then a path closing Z will be appended to the output string.\n *\n * @memberof Chartist.Svg.Path\n * @return {String}\n */\n function stringify() {\n var accuracyMultiplier = Math.pow(10, this.options.accuracy);\n\n return this.pathElements.reduce(function(path, pathElement) {\n var params = elementDescriptions[pathElement.command.toLowerCase()].map(function(paramName) {\n return this.options.accuracy ?\n (Math.round(pathElement[paramName] * accuracyMultiplier) / accuracyMultiplier) :\n pathElement[paramName];\n }.bind(this));\n\n return path + pathElement.command + params.join(',');\n }.bind(this), '') + (this.close ? 'Z' : '');\n }\n\n /**\n * Scales all elements in the current SVG path object. There is an individual parameter for each coordinate. Scaling will also be done for control points of curves, affecting the given coordinate.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} x The number which will be used to scale the x, x1 and x2 of all path elements.\n * @param {Number} y The number which will be used to scale the y, y1 and y2 of all path elements.\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function scale(x, y) {\n forEachParam(this.pathElements, function(pathElement, paramName) {\n pathElement[paramName] *= paramName[0] === 'x' ? x : y;\n });\n return this;\n }\n\n /**\n * Translates all elements in the current SVG path object. The translation is relative and there is an individual parameter for each coordinate. Translation will also be done for control points of curves, affecting the given coordinate.\n *\n * @memberof Chartist.Svg.Path\n * @param {Number} x The number which will be used to translate the x, x1 and x2 of all path elements.\n * @param {Number} y The number which will be used to translate the y, y1 and y2 of all path elements.\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function translate(x, y) {\n forEachParam(this.pathElements, function(pathElement, paramName) {\n pathElement[paramName] += paramName[0] === 'x' ? x : y;\n });\n return this;\n }\n\n /**\n * This function will run over all existing path elements and then loop over their attributes. The callback function will be called for every path element attribute that exists in the current path.\n * The method signature of the callback function looks like this:\n * ```javascript\n * function(pathElement, paramName, pathElementIndex, paramIndex, pathElements)\n * ```\n * If something else than undefined is returned by the callback function, this value will be used to replace the old value. This allows you to build custom transformations of path objects that can't be achieved using the basic transformation functions scale and translate.\n *\n * @memberof Chartist.Svg.Path\n * @param {Function} transformFnc The callback function for the transformation. Check the signature in the function description.\n * @return {Chartist.Svg.Path} The current path object for easy call chaining.\n */\n function transform(transformFnc) {\n forEachParam(this.pathElements, function(pathElement, paramName, pathElementIndex, paramIndex, pathElements) {\n var transformed = transformFnc(pathElement, paramName, pathElementIndex, paramIndex, pathElements);\n if(transformed || transformed === 0) {\n pathElement[paramName] = transformed;\n }\n });\n return this;\n }\n\n /**\n * This function clones a whole path object with all its properties. This is a deep clone and path element objects will also be cloned.\n *\n * @memberof Chartist.Svg.Path\n * @param {Boolean} [close] Optional option to set the new cloned path to closed. If not specified or false, the original path close option will be used.\n * @return {Chartist.Svg.Path}\n */\n function clone(close) {\n var c = new Chartist.Svg.Path(close || this.close);\n c.pos = this.pos;\n c.pathElements = this.pathElements.slice().map(function cloneElements(pathElement) {\n return Chartist.extend({}, pathElement);\n });\n c.options = Chartist.extend({}, this.options);\n return c;\n }\n\n /**\n * Split a Svg.Path object by a specific command in the path chain. The path chain will be split and an array of newly created paths objects will be returned. This is useful if you'd like to split an SVG path by it's move commands, for example, in order to isolate chunks of drawings.\n *\n * @memberof Chartist.Svg.Path\n * @param {String} command The command you'd like to use to split the path\n * @return {Array<Chartist.Svg.Path>}\n */\n function splitByCommand(command) {\n var split = [\n new Chartist.Svg.Path()\n ];\n\n this.pathElements.forEach(function(pathElement) {\n if(pathElement.command === command.toUpperCase() && split[split.length - 1].pathElements.length !== 0) {\n split.push(new Chartist.Svg.Path());\n }\n\n split[split.length - 1].pathElements.push(pathElement);\n });\n\n return split;\n }\n\n /**\n * This static function on `Chartist.Svg.Path` is joining multiple paths together into one paths.\n *\n * @memberof Chartist.Svg.Path\n * @param {Array<Chartist.Svg.Path>} paths A list of paths to be joined together. The order is important.\n * @param {boolean} close If the newly created path should be a closed path\n * @param {Object} options Path options for the newly created path.\n * @return {Chartist.Svg.Path}\n */\n\n function join(paths, close, options) {\n var joinedPath = new Chartist.Svg.Path(close, options);\n for(var i = 0; i < paths.length; i++) {\n var path = paths[i];\n for(var j = 0; j < path.pathElements.length; j++) {\n joinedPath.pathElements.push(path.pathElements[j]);\n }\n }\n return joinedPath;\n }\n\n Chartist.Svg.Path = Chartist.Class.extend({\n constructor: SvgPath,\n position: position,\n remove: remove,\n move: move,\n line: line,\n curve: curve,\n arc: arc,\n scale: scale,\n translate: translate,\n transform: transform,\n parse: parse,\n stringify: stringify,\n clone: clone,\n splitByCommand: splitByCommand\n });\n\n Chartist.Svg.Path.elementDescriptions = elementDescriptions;\n Chartist.Svg.Path.join = join;\n}(this || global, Chartist));\n;/* global Chartist */\n(function (globalRoot, Chartist) {\n 'use strict';\n\n var window = globalRoot.window;\n var document = globalRoot.document;\n\n var axisUnits = {\n x: {\n pos: 'x',\n len: 'width',\n dir: 'horizontal',\n rectStart: 'x1',\n rectEnd: 'x2',\n rectOffset: 'y2'\n },\n y: {\n pos: 'y',\n len: 'height',\n dir: 'vertical',\n rectStart: 'y2',\n rectEnd: 'y1',\n rectOffset: 'x1'\n }\n };\n\n function Axis(units, chartRect, ticks, options) {\n this.units = units;\n this.counterUnits = units === axisUnits.x ? axisUnits.y : axisUnits.x;\n this.chartRect = chartRect;\n this.axisLength = chartRect[units.rectEnd] - chartRect[units.rectStart];\n this.gridOffset = chartRect[units.rectOffset];\n this.ticks = ticks;\n this.options = options;\n }\n\n function createGridAndLabels(gridGroup, labelGroup, useForeignObject, chartOptions, eventEmitter) {\n var axisOptions = chartOptions['axis' + this.units.pos.toUpperCase()];\n var projectedValues = this.ticks.map(this.projectValue.bind(this));\n var labelValues = this.ticks.map(axisOptions.labelInterpolationFnc);\n\n projectedValues.forEach(function(projectedValue, index) {\n var labelOffset = {\n x: 0,\n y: 0\n };\n\n // TODO: Find better solution for solving this problem\n // Calculate how much space we have available for the label\n var labelLength;\n if(projectedValues[index + 1]) {\n // If we still have one label ahead, we can calculate the distance to the next tick / label\n labelLength = projectedValues[index + 1] - projectedValue;\n } else {\n // If we don't have a label ahead and we have only two labels in total, we just take the remaining distance to\n // on the whole axis length. We limit that to a minimum of 30 pixel, so that labels close to the border will\n // still be visible inside of the chart padding.\n labelLength = Math.max(this.axisLength - projectedValue, 30);\n }\n\n // Skip grid lines and labels where interpolated label values are falsey (execpt for 0)\n if(Chartist.isFalseyButZero(labelValues[index]) && labelValues[index] !== '') {\n return;\n }\n\n // Transform to global coordinates using the chartRect\n // We also need to set the label offset for the createLabel function\n if(this.units.pos === 'x') {\n projectedValue = this.chartRect.x1 + projectedValue;\n labelOffset.x = chartOptions.axisX.labelOffset.x;\n\n // If the labels should be positioned in start position (top side for vertical axis) we need to set a\n // different offset as for positioned with end (bottom)\n if(chartOptions.axisX.position === 'start') {\n labelOffset.y = this.chartRect.padding.top + chartOptions.axisX.labelOffset.y + (useForeignObject ? 5 : 20);\n } else {\n labelOffset.y = this.chartRect.y1 + chartOptions.axisX.labelOffset.y + (useForeignObject ? 5 : 20);\n }\n } else {\n projectedValue = this.chartRect.y1 - projectedValue;\n labelOffset.y = chartOptions.axisY.labelOffset.y - (useForeignObject ? labelLength : 0);\n\n // If the labels should be positioned in start position (left side for horizontal axis) we need to set a\n // different offset as for positioned with end (right side)\n if(chartOptions.axisY.position === 'start') {\n labelOffset.x = useForeignObject ? this.chartRect.padding.left + chartOptions.axisY.labelOffset.x : this.chartRect.x1 - 10;\n } else {\n labelOffset.x = this.chartRect.x2 + chartOptions.axisY.labelOffset.x + 10;\n }\n }\n\n if(axisOptions.showGrid) {\n Chartist.createGrid(projectedValue, index, this, this.gridOffset, this.chartRect[this.counterUnits.len](), gridGroup, [\n chartOptions.classNames.grid,\n chartOptions.classNames[this.units.dir]\n ], eventEmitter);\n }\n\n if(axisOptions.showLabel) {\n Chartist.createLabel(projectedValue, labelLength, index, labelValues, this, axisOptions.offset, labelOffset, labelGroup, [\n chartOptions.classNames.label,\n chartOptions.classNames[this.units.dir],\n (axisOptions.position === 'start' ? chartOptions.classNames[axisOptions.position] : chartOptions.classNames['end'])\n ], useForeignObject, eventEmitter);\n }\n }.bind(this));\n }\n\n Chartist.Axis = Chartist.Class.extend({\n constructor: Axis,\n createGridAndLabels: createGridAndLabels,\n projectValue: function(value, index, data) {\n throw new Error('Base axis can\\'t be instantiated!');\n }\n });\n\n Chartist.Axis.units = axisUnits;\n\n}(this || global, Chartist));\n;/**\n * The auto scale axis uses standard linear scale projection of values along an axis. It uses order of magnitude to find a scale automatically and evaluates the available space in order to find the perfect amount of ticks for your chart.\n * **Options**\n * The following options are used by this axis in addition to the default axis options outlined in the axis configuration of the chart default settings.\n * ```javascript\n * var options = {\n * // If high is specified then the axis will display values explicitly up to this value and the computed maximum from the data is ignored\n * high: 100,\n * // If low is specified then the axis will display values explicitly down to this value and the computed minimum from the data is ignored\n * low: 0,\n * // This option will be used when finding the right scale division settings. The amount of ticks on the scale will be determined so that as many ticks as possible will be displayed, while not violating this minimum required space (in pixel).\n * scaleMinSpace: 20,\n * // Can be set to true or false. If set to true, the scale will be generated with whole numbers only.\n * onlyInteger: true,\n * // The reference value can be used to make sure that this value will always be on the chart. This is especially useful on bipolar charts where the bipolar center always needs to be part of the chart.\n * referenceValue: 5\n * };\n * ```\n *\n * @module Chartist.AutoScaleAxis\n */\n/* global Chartist */\n(function (globalRoot, Chartist) {\n 'use strict';\n\n var window = globalRoot.window;\n var document = globalRoot.document;\n\n function AutoScaleAxis(axisUnit, data, chartRect, options) {\n // Usually we calculate highLow based on the data but this can be overriden by a highLow object in the options\n var highLow = options.highLow || Chartist.getHighLow(data, options, axisUnit.pos);\n this.bounds = Chartist.getBounds(chartRect[axisUnit.rectEnd] - chartRect[axisUnit.rectStart], highLow, options.scaleMinSpace || 20, options.onlyInteger);\n this.range = {\n min: this.bounds.min,\n max: this.bounds.max\n };\n\n Chartist.AutoScaleAxis.super.constructor.call(this,\n axisUnit,\n chartRect,\n this.bounds.values,\n options);\n }\n\n function projectValue(value) {\n return this.axisLength * (+Chartist.getMultiValue(value, this.units.pos) - this.bounds.min) / this.bounds.range;\n }\n\n Chartist.AutoScaleAxis = Chartist.Axis.extend({\n constructor: AutoScaleAxis,\n projectValue: projectValue\n });\n\n}(this || global, Chartist));\n;/**\n * The fixed scale axis uses standard linear projection of values along an axis. It makes use of a divisor option to divide the range provided from the minimum and maximum value or the options high and low that will override the computed minimum and maximum.\n * **Options**\n * The following options are used by this axis in addition to the default axis options outlined in the axis configuration of the chart default settings.\n * ```javascript\n * var options = {\n * // If high is specified then the axis will display values explicitly up to this value and the computed maximum from the data is ignored\n * high: 100,\n * // If low is specified then the axis will display values explicitly down to this value and the computed minimum from the data is ignored\n * low: 0,\n * // If specified then the value range determined from minimum to maximum (or low and high) will be divided by this number and ticks will be generated at those division points. The default divisor is 1.\n * divisor: 4,\n * // If ticks is explicitly set, then the axis will not compute the ticks with the divisor, but directly use the data in ticks to determine at what points on the axis a tick need to be generated.\n * ticks: [1, 10, 20, 30]\n * };\n * ```\n *\n * @module Chartist.FixedScaleAxis\n */\n/* global Chartist */\n(function (globalRoot, Chartist) {\n 'use strict';\n\n var window = globalRoot.window;\n var document = globalRoot.document;\n\n function FixedScaleAxis(axisUnit, data, chartRect, options) {\n var highLow = options.highLow || Chartist.getHighLow(data, options, axisUnit.pos);\n this.divisor = options.divisor || 1;\n this.ticks = options.ticks || Chartist.times(this.divisor).map(function(value, index) {\n return highLow.low + (highLow.high - highLow.low) / this.divisor * index;\n }.bind(this));\n this.ticks.sort(function(a, b) {\n return a - b;\n });\n this.range = {\n min: highLow.low,\n max: highLow.high\n };\n\n Chartist.FixedScaleAxis.super.constructor.call(this,\n axisUnit,\n chartRect,\n this.ticks,\n options);\n\n this.stepLength = this.axisLength / this.divisor;\n }\n\n function projectValue(value) {\n return this.axisLength * (+Chartist.getMultiValue(value, this.units.pos) - this.range.min) / (this.range.max - this.range.min);\n }\n\n Chartist.FixedScaleAxis = Chartist.Axis.extend({\n constructor: FixedScaleAxis,\n projectValue: projectValue\n });\n\n}(this || global, Chartist));\n;/**\n * The step axis for step based charts like bar chart or step based line charts. It uses a fixed amount of ticks that will be equally distributed across the whole axis length. The projection is done using the index of the data value rather than the value itself and therefore it's only useful for distribution purpose.\n * **Options**\n * The following options are used by this axis in addition to the default axis options outlined in the axis configuration of the chart default settings.\n * ```javascript\n * var options = {\n * // Ticks to be used to distribute across the axis length. As this axis type relies on the index of the value rather than the value, arbitrary data that can be converted to a string can be used as ticks.\n * ticks: ['One', 'Two', 'Three'],\n * // If set to true the full width will be used to distribute the values where the last value will be at the maximum of the axis length. If false the spaces between the ticks will be evenly distributed instead.\n * stretch: true\n * };\n * ```\n *\n * @module Chartist.StepAxis\n */\n/* global Chartist */\n(function (globalRoot, Chartist) {\n 'use strict';\n\n var window = globalRoot.window;\n var document = globalRoot.document;\n\n function StepAxis(axisUnit, data, chartRect, options) {\n Chartist.StepAxis.super.constructor.call(this,\n axisUnit,\n chartRect,\n options.ticks,\n options);\n\n var calc = Math.max(1, options.ticks.length - (options.stretch ? 1 : 0));\n this.stepLength = this.axisLength / calc;\n }\n\n function projectValue(value, index) {\n return this.stepLength * index;\n }\n\n Chartist.StepAxis = Chartist.Axis.extend({\n constructor: StepAxis,\n projectValue: projectValue\n });\n\n}(this || global, Chartist));\n;/**\n * The Chartist line chart can be used to draw Line or Scatter charts. If used in the browser you can access the global `Chartist` namespace where you find the `Line` function as a main entry point.\n *\n * For examples on how to use the line chart please check the examples of the `Chartist.Line` method.\n *\n * @module Chartist.Line\n */\n/* global Chartist */\n(function(globalRoot, Chartist){\n 'use strict';\n\n var window = globalRoot.window;\n var document = globalRoot.document;\n\n /**\n * Default options in line charts. Expand the code view to see a detailed list of options with comments.\n *\n * @memberof Chartist.Line\n */\n var defaultOptions = {\n // Options for X-Axis\n axisX: {\n // The offset of the labels to the chart area\n offset: 30,\n // Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis.\n position: 'end',\n // Allows you to correct label positioning on this axis by positive or negative x and y offset.\n labelOffset: {\n x: 0,\n y: 0\n },\n // If labels should be shown or not\n showLabel: true,\n // If the axis grid should be drawn or not\n showGrid: true,\n // Interpolation function that allows you to intercept the value from the axis label\n labelInterpolationFnc: Chartist.noop,\n // Set the axis type to be used to project values on this axis. If not defined, Chartist.StepAxis will be used for the X-Axis, where the ticks option will be set to the labels in the data and the stretch option will be set to the global fullWidth option. This type can be changed to any axis constructor available (e.g. Chartist.FixedScaleAxis), where all axis options should be present here.\n type: undefined\n },\n // Options for Y-Axis\n axisY: {\n // The offset of the labels to the chart area\n offset: 40,\n // Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis.\n position: 'start',\n // Allows you to correct label positioning on this axis by positive or negative x and y offset.\n labelOffset: {\n x: 0,\n y: 0\n },\n // If labels should be shown or not\n showLabel: true,\n // If the axis grid should be drawn or not\n showGrid: true,\n // Interpolation function that allows you to intercept the value from the axis label\n labelInterpolationFnc: Chartist.noop,\n // Set the axis type to be used to project values on this axis. If not defined, Chartist.AutoScaleAxis will be used for the Y-Axis, where the high and low options will be set to the global high and low options. This type can be changed to any axis constructor available (e.g. Chartist.FixedScaleAxis), where all axis options should be present here.\n type: undefined,\n // This value specifies the minimum height in pixel of the scale steps\n scaleMinSpace: 20,\n // Use only integer values (whole numbers) for the scale steps\n onlyInteger: false\n },\n // Specify a fixed width for the chart as a string (i.e. '100px' or '50%')\n width: undefined,\n // Specify a fixed height for the chart as a string (i.e. '100px' or '50%')\n height: undefined,\n // If the line should be drawn or not\n showLine: true,\n // If dots should be drawn or not\n showPoint: true,\n // If the line chart should draw an area\n showArea: false,\n // The base for the area chart that will be used to close the area shape (is normally 0)\n areaBase: 0,\n // Specify if the lines should be smoothed. This value can be true or false where true will result in smoothing using the default smoothing interpolation function Chartist.Interpolation.cardinal and false results in Chartist.Interpolation.none. You can also choose other smoothing / interpolation functions available in the Chartist.Interpolation module, or write your own interpolation function. Check the examples for a brief description.\n lineSmooth: true,\n // If the line chart should add a background fill to the .ct-grids group.\n showGridBackground: false,\n // Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value\n low: undefined,\n // Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value\n high: undefined,\n // Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5}\n chartPadding: {\n top: 15,\n right: 15,\n bottom: 5,\n left: 10\n },\n // When set to true, the last grid line on the x-axis is not drawn and the chart elements will expand to the full available width of the chart. For the last label to be drawn correctly you might need to add chart padding or offset the last label with a draw event handler.\n fullWidth: false,\n // If true the whole data is reversed including labels, the series order as well as the whole series data arrays.\n reverseData: false,\n // Override the class names that get used to generate the SVG structure of the chart\n classNames: {\n chart: 'ct-chart-line',\n label: 'ct-label',\n labelGroup: 'ct-labels',\n series: 'ct-series',\n line: 'ct-line',\n point: 'ct-point',\n area: 'ct-area',\n grid: 'ct-grid',\n gridGroup: 'ct-grids',\n gridBackground: 'ct-grid-background',\n vertical: 'ct-vertical',\n horizontal: 'ct-horizontal',\n start: 'ct-start',\n end: 'ct-end'\n }\n };\n\n /**\n * Creates a new chart\n *\n */\n function createChart(options) {\n var data = Chartist.normalizeData(this.data, options.reverseData, true);\n\n // Create new svg object\n this.svg = Chartist.createSvg(this.container, options.width, options.height, options.classNames.chart);\n // Create groups for labels, grid and series\n var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n var seriesGroup = this.svg.elem('g');\n var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\n var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n var axisX, axisY;\n\n if(options.axisX.type === undefined) {\n axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n ticks: data.normalized.labels,\n stretch: options.fullWidth\n }));\n } else {\n axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, options.axisX);\n }\n\n if(options.axisY.type === undefined) {\n axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n high: Chartist.isNumeric(options.high) ? options.high : options.axisY.high,\n low: Chartist.isNumeric(options.low) ? options.low : options.axisY.low\n }));\n } else {\n axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, options.axisY);\n }\n\n axisX.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n axisY.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\n if (options.showGridBackground) {\n Chartist.createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);\n }\n\n // Draw the series\n data.raw.series.forEach(function(series, seriesIndex) {\n var seriesElement = seriesGroup.elem('g');\n\n // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n seriesElement.attr({\n 'ct:series-name': series.name,\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // Use series class from series data or if not set generate one\n seriesElement.addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))\n ].join(' '));\n\n var pathCoordinates = [],\n pathData = [];\n\n data.normalized.series[seriesIndex].forEach(function(value, valueIndex) {\n var p = {\n x: chartRect.x1 + axisX.projectValue(value, valueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - axisY.projectValue(value, valueIndex, data.normalized.series[seriesIndex])\n };\n pathCoordinates.push(p.x, p.y);\n pathData.push({\n value: value,\n valueIndex: valueIndex,\n meta: Chartist.getMetaData(series, valueIndex)\n });\n }.bind(this));\n\n var seriesOptions = {\n lineSmooth: Chartist.getSeriesOption(series, options, 'lineSmooth'),\n showPoint: Chartist.getSeriesOption(series, options, 'showPoint'),\n showLine: Chartist.getSeriesOption(series, options, 'showLine'),\n showArea: Chartist.getSeriesOption(series, options, 'showArea'),\n areaBase: Chartist.getSeriesOption(series, options, 'areaBase')\n };\n\n var smoothing = typeof seriesOptions.lineSmooth === 'function' ?\n seriesOptions.lineSmooth : (seriesOptions.lineSmooth ? Chartist.Interpolation.monotoneCubic() : Chartist.Interpolation.none());\n // Interpolating path where pathData will be used to annotate each path element so we can trace back the original\n // index, value and meta data\n var path = smoothing(pathCoordinates, pathData);\n\n // If we should show points we need to create them now to avoid secondary loop\n // Points are drawn from the pathElements returned by the interpolation function\n // Small offset for Firefox to render squares correctly\n if (seriesOptions.showPoint) {\n\n path.pathElements.forEach(function(pathElement) {\n var point = seriesElement.elem('line', {\n x1: pathElement.x,\n y1: pathElement.y,\n x2: pathElement.x + 0.01,\n y2: pathElement.y\n }, options.classNames.point).attr({\n 'ct:value': [pathElement.data.value.x, pathElement.data.value.y].filter(Chartist.isNumeric).join(','),\n 'ct:meta': Chartist.serialize(pathElement.data.meta)\n });\n\n this.eventEmitter.emit('draw', {\n type: 'point',\n value: pathElement.data.value,\n index: pathElement.data.valueIndex,\n meta: pathElement.data.meta,\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n group: seriesElement,\n element: point,\n x: pathElement.x,\n y: pathElement.y\n });\n }.bind(this));\n }\n\n if(seriesOptions.showLine) {\n var line = seriesElement.elem('path', {\n d: path.stringify()\n }, options.classNames.line, true);\n\n this.eventEmitter.emit('draw', {\n type: 'line',\n values: data.normalized.series[seriesIndex],\n path: path.clone(),\n chartRect: chartRect,\n index: seriesIndex,\n series: series,\n seriesIndex: seriesIndex,\n seriesMeta: series.meta,\n axisX: axisX,\n axisY: axisY,\n group: seriesElement,\n element: line\n });\n }\n\n // Area currently only works with axes that support a range!\n if(seriesOptions.showArea && axisY.range) {\n // If areaBase is outside the chart area (< min or > max) we need to set it respectively so that\n // the area is not drawn outside the chart area.\n var areaBase = Math.max(Math.min(seriesOptions.areaBase, axisY.range.max), axisY.range.min);\n\n // We project the areaBase value into screen coordinates\n var areaBaseProjected = chartRect.y1 - axisY.projectValue(areaBase);\n\n // In order to form the area we'll first split the path by move commands so we can chunk it up into segments\n path.splitByCommand('M').filter(function onlySolidSegments(pathSegment) {\n // We filter only \"solid\" segments that contain more than one point. Otherwise there's no need for an area\n return pathSegment.pathElements.length > 1;\n }).map(function convertToArea(solidPathSegments) {\n // Receiving the filtered solid path segments we can now convert those segments into fill areas\n var firstElement = solidPathSegments.pathElements[0];\n var lastElement = solidPathSegments.pathElements[solidPathSegments.pathElements.length - 1];\n\n // Cloning the solid path segment with closing option and removing the first move command from the clone\n // We then insert a new move that should start at the area base and draw a straight line up or down\n // at the end of the path we add an additional straight line to the projected area base value\n // As the closing option is set our path will be automatically closed\n return solidPathSegments.clone(true)\n .position(0)\n .remove(1)\n .move(firstElement.x, areaBaseProjected)\n .line(firstElement.x, firstElement.y)\n .position(solidPathSegments.pathElements.length + 1)\n .line(lastElement.x, areaBaseProjected);\n\n }).forEach(function createArea(areaPath) {\n // For each of our newly created area paths, we'll now create path elements by stringifying our path objects\n // and adding the created DOM elements to the correct series group\n var area = seriesElement.elem('path', {\n d: areaPath.stringify()\n }, options.classNames.area, true);\n\n // Emit an event for each area that was drawn\n this.eventEmitter.emit('draw', {\n type: 'area',\n values: data.normalized.series[seriesIndex],\n path: areaPath.clone(),\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n chartRect: chartRect,\n index: seriesIndex,\n group: seriesElement,\n element: area\n });\n }.bind(this));\n }\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n bounds: axisY.bounds,\n chartRect: chartRect,\n axisX: axisX,\n axisY: axisY,\n svg: this.svg,\n options: options\n });\n }\n\n /**\n * This method creates a new line chart.\n *\n * @memberof Chartist.Line\n * @param {String|Node} query A selector query string or directly a DOM element\n * @param {Object} data The data object that needs to consist of a labels and a series array\n * @param {Object} [options] The options object with options that override the default options. Check the examples for a detailed list.\n * @param {Array} [responsiveOptions] Specify an array of responsive option arrays which are a media query and options object pair => [[mediaQueryString, optionsObject],[more...]]\n * @return {Object} An object which exposes the API for the created chart\n *\n * @example\n * // Create a simple line chart\n * var data = {\n * // A labels array that can contain any sort of values\n * labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],\n * // Our series array that contains series objects or in this case series data arrays\n * series: [\n * [5, 2, 4, 2, 0]\n * ]\n * };\n *\n * // As options we currently only set a static size of 300x200 px\n * var options = {\n * width: '300px',\n * height: '200px'\n * };\n *\n * // In the global name space Chartist we call the Line function to initialize a line chart. As a first parameter we pass in a selector where we would like to get our chart created. Second parameter is the actual data object and as a third parameter we pass in our options\n * new Chartist.Line('.ct-chart', data, options);\n *\n * @example\n * // Use specific interpolation function with configuration from the Chartist.Interpolation module\n *\n * var chart = new Chartist.Line('.ct-chart', {\n * labels: [1, 2, 3, 4, 5],\n * series: [\n * [1, 1, 8, 1, 7]\n * ]\n * }, {\n * lineSmooth: Chartist.Interpolation.cardinal({\n * tension: 0.2\n * })\n * });\n *\n * @example\n * // Create a line chart with responsive options\n *\n * var data = {\n * // A labels array that can contain any sort of values\n * labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'],\n * // Our series array that contains series objects or in this case series data arrays\n * series: [\n * [5, 2, 4, 2, 0]\n * ]\n * };\n *\n * // In addition to the regular options we specify responsive option overrides that will override the default configutation based on the matching media queries.\n * var responsiveOptions = [\n * ['screen and (min-width: 641px) and (max-width: 1024px)', {\n * showPoint: false,\n * axisX: {\n * labelInterpolationFnc: function(value) {\n * // Will return Mon, Tue, Wed etc. on medium screens\n * return value.slice(0, 3);\n * }\n * }\n * }],\n * ['screen and (max-width: 640px)', {\n * showLine: false,\n * axisX: {\n * labelInterpolationFnc: function(value) {\n * // Will return M, T, W etc. on small screens\n * return value[0];\n * }\n * }\n * }]\n * ];\n *\n * new Chartist.Line('.ct-chart', data, null, responsiveOptions);\n *\n */\n function Line(query, data, options, responsiveOptions) {\n Chartist.Line.super.constructor.call(this,\n query,\n data,\n defaultOptions,\n Chartist.extend({}, defaultOptions, options),\n responsiveOptions);\n }\n\n // Creating line chart type in Chartist namespace\n Chartist.Line = Chartist.Base.extend({\n constructor: Line,\n createChart: createChart\n });\n\n}(this || global, Chartist));\n;/**\n * The bar chart module of Chartist that can be used to draw unipolar or bipolar bar and grouped bar charts.\n *\n * @module Chartist.Bar\n */\n/* global Chartist */\n(function(globalRoot, Chartist){\n 'use strict';\n\n var window = globalRoot.window;\n var document = globalRoot.document;\n\n /**\n * Default options in bar charts. Expand the code view to see a detailed list of options with comments.\n *\n * @memberof Chartist.Bar\n */\n var defaultOptions = {\n // Options for X-Axis\n axisX: {\n // The offset of the chart drawing area to the border of the container\n offset: 30,\n // Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis.\n position: 'end',\n // Allows you to correct label positioning on this axis by positive or negative x and y offset.\n labelOffset: {\n x: 0,\n y: 0\n },\n // If labels should be shown or not\n showLabel: true,\n // If the axis grid should be drawn or not\n showGrid: true,\n // Interpolation function that allows you to intercept the value from the axis label\n labelInterpolationFnc: Chartist.noop,\n // This value specifies the minimum width in pixel of the scale steps\n scaleMinSpace: 30,\n // Use only integer values (whole numbers) for the scale steps\n onlyInteger: false\n },\n // Options for Y-Axis\n axisY: {\n // The offset of the chart drawing area to the border of the container\n offset: 40,\n // Position where labels are placed. Can be set to `start` or `end` where `start` is equivalent to left or top on vertical axis and `end` is equivalent to right or bottom on horizontal axis.\n position: 'start',\n // Allows you to correct label positioning on this axis by positive or negative x and y offset.\n labelOffset: {\n x: 0,\n y: 0\n },\n // If labels should be shown or not\n showLabel: true,\n // If the axis grid should be drawn or not\n showGrid: true,\n // Interpolation function that allows you to intercept the value from the axis label\n labelInterpolationFnc: Chartist.noop,\n // This value specifies the minimum height in pixel of the scale steps\n scaleMinSpace: 20,\n // Use only integer values (whole numbers) for the scale steps\n onlyInteger: false\n },\n // Specify a fixed width for the chart as a string (i.e. '100px' or '50%')\n width: undefined,\n // Specify a fixed height for the chart as a string (i.e. '100px' or '50%')\n height: undefined,\n // Overriding the natural high of the chart allows you to zoom in or limit the charts highest displayed value\n high: undefined,\n // Overriding the natural low of the chart allows you to zoom in or limit the charts lowest displayed value\n low: undefined,\n // Unless low/high are explicitly set, bar chart will be centered at zero by default. Set referenceValue to null to auto scale.\n referenceValue: 0,\n // Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5}\n chartPadding: {\n top: 15,\n right: 15,\n bottom: 5,\n left: 10\n },\n // Specify the distance in pixel of bars in a group\n seriesBarDistance: 15,\n // If set to true this property will cause the series bars to be stacked. Check the `stackMode` option for further stacking options.\n stackBars: false,\n // If set to 'overlap' this property will force the stacked bars to draw from the zero line.\n // If set to 'accumulate' this property will form a total for each series point. This will also influence the y-axis and the overall bounds of the chart. In stacked mode the seriesBarDistance property will have no effect.\n stackMode: 'accumulate',\n // Inverts the axes of the bar chart in order to draw a horizontal bar chart. Be aware that you also need to invert your axis settings as the Y Axis will now display the labels and the X Axis the values.\n horizontalBars: false,\n // If set to true then each bar will represent a series and the data array is expected to be a one dimensional array of data values rather than a series array of series. This is useful if the bar chart should represent a profile rather than some data over time.\n distributeSeries: false,\n // If true the whole data is reversed including labels, the series order as well as the whole series data arrays.\n reverseData: false,\n // If the bar chart should add a background fill to the .ct-grids group.\n showGridBackground: false,\n // Override the class names that get used to generate the SVG structure of the chart\n classNames: {\n chart: 'ct-chart-bar',\n horizontalBars: 'ct-horizontal-bars',\n label: 'ct-label',\n labelGroup: 'ct-labels',\n series: 'ct-series',\n bar: 'ct-bar',\n grid: 'ct-grid',\n gridGroup: 'ct-grids',\n gridBackground: 'ct-grid-background',\n vertical: 'ct-vertical',\n horizontal: 'ct-horizontal',\n start: 'ct-start',\n end: 'ct-end'\n }\n };\n\n /**\n * Creates a new chart\n *\n */\n function createChart(options) {\n var data;\n var highLow;\n\n if(options.distributeSeries) {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n data.normalized.series = data.normalized.series.map(function(value) {\n return [value];\n });\n } else {\n data = Chartist.normalizeData(this.data, options.reverseData, options.horizontalBars ? 'x' : 'y');\n }\n\n // Create new svg element\n this.svg = Chartist.createSvg(\n this.container,\n options.width,\n options.height,\n options.classNames.chart + (options.horizontalBars ? ' ' + options.classNames.horizontalBars : '')\n );\n\n // Drawing groups in correct order\n var gridGroup = this.svg.elem('g').addClass(options.classNames.gridGroup);\n var seriesGroup = this.svg.elem('g');\n var labelGroup = this.svg.elem('g').addClass(options.classNames.labelGroup);\n\n if(options.stackBars && data.normalized.series.length !== 0) {\n\n // If stacked bars we need to calculate the high low from stacked values from each series\n var serialSums = Chartist.serialMap(data.normalized.series, function serialSums() {\n return Array.prototype.slice.call(arguments).map(function(value) {\n return value;\n }).reduce(function(prev, curr) {\n return {\n x: prev.x + (curr && curr.x) || 0,\n y: prev.y + (curr && curr.y) || 0\n };\n }, {x: 0, y: 0});\n });\n\n highLow = Chartist.getHighLow([serialSums], options, options.horizontalBars ? 'x' : 'y');\n\n } else {\n\n highLow = Chartist.getHighLow(data.normalized.series, options, options.horizontalBars ? 'x' : 'y');\n }\n\n // Overrides of high / low from settings\n highLow.high = +options.high || (options.high === 0 ? 0 : highLow.high);\n highLow.low = +options.low || (options.low === 0 ? 0 : highLow.low);\n\n var chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n\n var valueAxis,\n labelAxisTicks,\n labelAxis,\n axisX,\n axisY;\n\n // We need to set step count based on some options combinations\n if(options.distributeSeries && options.stackBars) {\n // If distributed series are enabled and bars need to be stacked, we'll only have one bar and therefore should\n // use only the first label for the step axis\n labelAxisTicks = data.normalized.labels.slice(0, 1);\n } else {\n // If distributed series are enabled but stacked bars aren't, we should use the series labels\n // If we are drawing a regular bar chart with two dimensional series data, we just use the labels array\n // as the bars are normalized\n labelAxisTicks = data.normalized.labels;\n }\n\n // Set labelAxis and valueAxis based on the horizontalBars setting. This setting will flip the axes if necessary.\n if(options.horizontalBars) {\n if(options.axisX.type === undefined) {\n valueAxis = axisX = new Chartist.AutoScaleAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, Chartist.extend({}, options.axisX, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n\n if(options.axisY.type === undefined) {\n labelAxis = axisY = new Chartist.StepAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, options.axisY);\n }\n } else {\n if(options.axisX.type === undefined) {\n labelAxis = axisX = new Chartist.StepAxis(Chartist.Axis.units.x, data.normalized.series, chartRect, {\n ticks: labelAxisTicks\n });\n } else {\n labelAxis = axisX = options.axisX.type.call(Chartist, Chartist.Axis.units.x, data.normalized.series, chartRect, options.axisX);\n }\n\n if(options.axisY.type === undefined) {\n valueAxis = axisY = new Chartist.AutoScaleAxis(Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n } else {\n valueAxis = axisY = options.axisY.type.call(Chartist, Chartist.Axis.units.y, data.normalized.series, chartRect, Chartist.extend({}, options.axisY, {\n highLow: highLow,\n referenceValue: 0\n }));\n }\n }\n\n // Projected 0 point\n var zeroPoint = options.horizontalBars ? (chartRect.x1 + valueAxis.projectValue(0)) : (chartRect.y1 - valueAxis.projectValue(0));\n // Used to track the screen coordinates of stacked bars\n var stackedBarValues = [];\n\n labelAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n valueAxis.createGridAndLabels(gridGroup, labelGroup, this.supportsForeignObject, options, this.eventEmitter);\n\n if (options.showGridBackground) {\n Chartist.createGridBackground(gridGroup, chartRect, options.classNames.gridBackground, this.eventEmitter);\n }\n\n // Draw the series\n data.raw.series.forEach(function(series, seriesIndex) {\n // Calculating bi-polar value of index for seriesOffset. For i = 0..4 biPol will be -1.5, -0.5, 0.5, 1.5 etc.\n var biPol = seriesIndex - (data.raw.series.length - 1) / 2;\n // Half of the period width between vertical grid lines used to position bars\n var periodHalfLength;\n // Current series SVG element\n var seriesElement;\n\n // We need to set periodHalfLength based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we need to use the length of the normaizedData array\n // which is the series count and divide by 2\n periodHalfLength = labelAxis.axisLength / data.normalized.series.length / 2;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled we'll only get one bar so we should just divide the axis\n // length by 2\n periodHalfLength = labelAxis.axisLength / 2;\n } else {\n // On regular bar charts we should just use the series length\n periodHalfLength = labelAxis.axisLength / data.normalized.series[seriesIndex].length / 2;\n }\n\n // Adding the series group to the series element\n seriesElement = seriesGroup.elem('g');\n\n // Write attributes to series group element. If series name or meta is undefined the attributes will not be written\n seriesElement.attr({\n 'ct:series-name': series.name,\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // Use series class from series data or if not set generate one\n seriesElement.addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(seriesIndex))\n ].join(' '));\n\n data.normalized.series[seriesIndex].forEach(function(value, valueIndex) {\n var projected,\n bar,\n previousStack,\n labelAxisValueIndex;\n\n // We need to set labelAxisValueIndex based on some options combinations\n if(options.distributeSeries && !options.stackBars) {\n // If distributed series are enabled but stacked bars aren't, we can use the seriesIndex for later projection\n // on the step axis for label positioning\n labelAxisValueIndex = seriesIndex;\n } else if(options.distributeSeries && options.stackBars) {\n // If distributed series and stacked bars are enabled, we will only get one bar and therefore always use\n // 0 for projection on the label step axis\n labelAxisValueIndex = 0;\n } else {\n // On regular bar charts we just use the value index to project on the label step axis\n labelAxisValueIndex = valueIndex;\n }\n\n // We need to transform coordinates differently based on the chart layout\n if(options.horizontalBars) {\n projected = {\n x: chartRect.x1 + valueAxis.projectValue(value && value.x ? value.x : 0, valueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - labelAxis.projectValue(value && value.y ? value.y : 0, labelAxisValueIndex, data.normalized.series[seriesIndex])\n };\n } else {\n projected = {\n x: chartRect.x1 + labelAxis.projectValue(value && value.x ? value.x : 0, labelAxisValueIndex, data.normalized.series[seriesIndex]),\n y: chartRect.y1 - valueAxis.projectValue(value && value.y ? value.y : 0, valueIndex, data.normalized.series[seriesIndex])\n }\n }\n\n // If the label axis is a step based axis we will offset the bar into the middle of between two steps using\n // the periodHalfLength value. Also we do arrange the different series so that they align up to each other using\n // the seriesBarDistance. If we don't have a step axis, the bar positions can be chosen freely so we should not\n // add any automated positioning.\n if(labelAxis instanceof Chartist.StepAxis) {\n // Offset to center bar between grid lines, but only if the step axis is not stretched\n if(!labelAxis.options.stretch) {\n projected[labelAxis.units.pos] += periodHalfLength * (options.horizontalBars ? -1 : 1);\n }\n // Using bi-polar offset for multiple series if no stacked bars or series distribution is used\n projected[labelAxis.units.pos] += (options.stackBars || options.distributeSeries) ? 0 : biPol * options.seriesBarDistance * (options.horizontalBars ? -1 : 1);\n }\n\n // Enter value in stacked bar values used to remember previous screen value for stacking up bars\n previousStack = stackedBarValues[valueIndex] || zeroPoint;\n stackedBarValues[valueIndex] = previousStack - (zeroPoint - projected[labelAxis.counterUnits.pos]);\n\n // Skip if value is undefined\n if(value === undefined) {\n return;\n }\n\n var positions = {};\n positions[labelAxis.units.pos + '1'] = projected[labelAxis.units.pos];\n positions[labelAxis.units.pos + '2'] = projected[labelAxis.units.pos];\n\n if(options.stackBars && (options.stackMode === 'accumulate' || !options.stackMode)) {\n // Stack mode: accumulate (default)\n // If bars are stacked we use the stackedBarValues reference and otherwise base all bars off the zero line\n // We want backwards compatibility, so the expected fallback without the 'stackMode' option\n // to be the original behaviour (accumulate)\n positions[labelAxis.counterUnits.pos + '1'] = previousStack;\n positions[labelAxis.counterUnits.pos + '2'] = stackedBarValues[valueIndex];\n } else {\n // Draw from the zero line normally\n // This is also the same code for Stack mode: overlap\n positions[labelAxis.counterUnits.pos + '1'] = zeroPoint;\n positions[labelAxis.counterUnits.pos + '2'] = projected[labelAxis.counterUnits.pos];\n }\n\n // Limit x and y so that they are within the chart rect\n positions.x1 = Math.min(Math.max(positions.x1, chartRect.x1), chartRect.x2);\n positions.x2 = Math.min(Math.max(positions.x2, chartRect.x1), chartRect.x2);\n positions.y1 = Math.min(Math.max(positions.y1, chartRect.y2), chartRect.y1);\n positions.y2 = Math.min(Math.max(positions.y2, chartRect.y2), chartRect.y1);\n\n var metaData = Chartist.getMetaData(series, valueIndex);\n\n // Create bar element\n bar = seriesElement.elem('line', positions, options.classNames.bar).attr({\n 'ct:value': [value.x, value.y].filter(Chartist.isNumeric).join(','),\n 'ct:meta': Chartist.serialize(metaData)\n });\n\n this.eventEmitter.emit('draw', Chartist.extend({\n type: 'bar',\n value: value,\n index: valueIndex,\n meta: metaData,\n series: series,\n seriesIndex: seriesIndex,\n axisX: axisX,\n axisY: axisY,\n chartRect: chartRect,\n group: seriesElement,\n element: bar\n }, positions));\n }.bind(this));\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n bounds: valueAxis.bounds,\n chartRect: chartRect,\n axisX: axisX,\n axisY: axisY,\n svg: this.svg,\n options: options\n });\n }\n\n /**\n * This method creates a new bar chart and returns API object that you can use for later changes.\n *\n * @memberof Chartist.Bar\n * @param {String|Node} query A selector query string or directly a DOM element\n * @param {Object} data The data object that needs to consist of a labels and a series array\n * @param {Object} [options] The options object with options that override the default options. Check the examples for a detailed list.\n * @param {Array} [responsiveOptions] Specify an array of responsive option arrays which are a media query and options object pair => [[mediaQueryString, optionsObject],[more...]]\n * @return {Object} An object which exposes the API for the created chart\n *\n * @example\n * // Create a simple bar chart\n * var data = {\n * labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'],\n * series: [\n * [5, 2, 4, 2, 0]\n * ]\n * };\n *\n * // In the global name space Chartist we call the Bar function to initialize a bar chart. As a first parameter we pass in a selector where we would like to get our chart created and as a second parameter we pass our data object.\n * new Chartist.Bar('.ct-chart', data);\n *\n * @example\n * // This example creates a bipolar grouped bar chart where the boundaries are limitted to -10 and 10\n * new Chartist.Bar('.ct-chart', {\n * labels: [1, 2, 3, 4, 5, 6, 7],\n * series: [\n * [1, 3, 2, -5, -3, 1, -6],\n * [-5, -2, -4, -1, 2, -3, 1]\n * ]\n * }, {\n * seriesBarDistance: 12,\n * low: -10,\n * high: 10\n * });\n *\n */\n function Bar(query, data, options, responsiveOptions) {\n Chartist.Bar.super.constructor.call(this,\n query,\n data,\n defaultOptions,\n Chartist.extend({}, defaultOptions, options),\n responsiveOptions);\n }\n\n // Creating bar chart type in Chartist namespace\n Chartist.Bar = Chartist.Base.extend({\n constructor: Bar,\n createChart: createChart\n });\n\n}(this || global, Chartist));\n;/**\n * The pie chart module of Chartist that can be used to draw pie, donut or gauge charts\n *\n * @module Chartist.Pie\n */\n/* global Chartist */\n(function(globalRoot, Chartist) {\n 'use strict';\n\n var window = globalRoot.window;\n var document = globalRoot.document;\n\n /**\n * Default options in line charts. Expand the code view to see a detailed list of options with comments.\n *\n * @memberof Chartist.Pie\n */\n var defaultOptions = {\n // Specify a fixed width for the chart as a string (i.e. '100px' or '50%')\n width: undefined,\n // Specify a fixed height for the chart as a string (i.e. '100px' or '50%')\n height: undefined,\n // Padding of the chart drawing area to the container element and labels as a number or padding object {top: 5, right: 5, bottom: 5, left: 5}\n chartPadding: 5,\n // Override the class names that are used to generate the SVG structure of the chart\n classNames: {\n chartPie: 'ct-chart-pie',\n chartDonut: 'ct-chart-donut',\n series: 'ct-series',\n slicePie: 'ct-slice-pie',\n sliceDonut: 'ct-slice-donut',\n sliceDonutSolid: 'ct-slice-donut-solid',\n label: 'ct-label'\n },\n // The start angle of the pie chart in degrees where 0 points north. A higher value offsets the start angle clockwise.\n startAngle: 0,\n // An optional total you can specify. By specifying a total value, the sum of the values in the series must be this total in order to draw a full pie. You can use this parameter to draw only parts of a pie or gauge charts.\n total: undefined,\n // If specified the donut CSS classes will be used and strokes will be drawn instead of pie slices.\n donut: false,\n // If specified the donut segments will be drawn as shapes instead of strokes.\n donutSolid: false,\n // Specify the donut stroke width, currently done in javascript for convenience. May move to CSS styles in the future.\n // This option can be set as number or string to specify a relative width (i.e. 100 or '30%').\n donutWidth: 60,\n // If a label should be shown or not\n showLabel: true,\n // Label position offset from the standard position which is half distance of the radius. This value can be either positive or negative. Positive values will position the label away from the center.\n labelOffset: 0,\n // This option can be set to 'inside', 'outside' or 'center'. Positioned with 'inside' the labels will be placed on half the distance of the radius to the border of the Pie by respecting the 'labelOffset'. The 'outside' option will place the labels at the border of the pie and 'center' will place the labels in the absolute center point of the chart. The 'center' option only makes sense in conjunction with the 'labelOffset' option.\n labelPosition: 'inside',\n // An interpolation function for the label value\n labelInterpolationFnc: Chartist.noop,\n // Label direction can be 'neutral', 'explode' or 'implode'. The labels anchor will be positioned based on those settings as well as the fact if the labels are on the right or left side of the center of the chart. Usually explode is useful when labels are positioned far away from the center.\n labelDirection: 'neutral',\n // If true the whole data is reversed including labels, the series order as well as the whole series data arrays.\n reverseData: false,\n // If true empty values will be ignored to avoid drawing unncessary slices and labels\n ignoreEmptyValues: false\n };\n\n /**\n * Determines SVG anchor position based on direction and center parameter\n *\n * @param center\n * @param label\n * @param direction\n * @return {string}\n */\n function determineAnchorPosition(center, label, direction) {\n var toTheRight = label.x > center.x;\n\n if(toTheRight && direction === 'explode' ||\n !toTheRight && direction === 'implode') {\n return 'start';\n } else if(toTheRight && direction === 'implode' ||\n !toTheRight && direction === 'explode') {\n return 'end';\n } else {\n return 'middle';\n }\n }\n\n /**\n * Creates the pie chart\n *\n * @param options\n */\n function createChart(options) {\n var data = Chartist.normalizeData(this.data);\n var seriesGroups = [],\n labelsGroup,\n chartRect,\n radius,\n labelRadius,\n totalDataSum,\n startAngle = options.startAngle;\n\n // Create SVG.js draw\n this.svg = Chartist.createSvg(this.container, options.width, options.height,options.donut ? options.classNames.chartDonut : options.classNames.chartPie);\n // Calculate charting rect\n chartRect = Chartist.createChartRect(this.svg, options, defaultOptions.padding);\n // Get biggest circle radius possible within chartRect\n radius = Math.min(chartRect.width() / 2, chartRect.height() / 2);\n // Calculate total of all series to get reference value or use total reference from optional options\n totalDataSum = options.total || data.normalized.series.reduce(function(previousValue, currentValue) {\n return previousValue + currentValue;\n }, 0);\n\n var donutWidth = Chartist.quantity(options.donutWidth);\n if (donutWidth.unit === '%') {\n donutWidth.value *= radius / 100;\n }\n\n // If this is a donut chart we need to adjust our radius to enable strokes to be drawn inside\n // Unfortunately this is not possible with the current SVG Spec\n // See this proposal for more details: http://lists.w3.org/Archives/Public/www-svg/2003Oct/0000.html\n radius -= options.donut && !options.donutSolid ? donutWidth.value / 2 : 0;\n\n // If labelPosition is set to `outside` or a donut chart is drawn then the label position is at the radius,\n // if regular pie chart it's half of the radius\n if(options.labelPosition === 'outside' || options.donut && !options.donutSolid) {\n labelRadius = radius;\n } else if(options.labelPosition === 'center') {\n // If labelPosition is center we start with 0 and will later wait for the labelOffset\n labelRadius = 0;\n } else if(options.donutSolid) {\n labelRadius = radius - donutWidth.value / 2;\n } else {\n // Default option is 'inside' where we use half the radius so the label will be placed in the center of the pie\n // slice\n labelRadius = radius / 2;\n }\n // Add the offset to the labelRadius where a negative offset means closed to the center of the chart\n labelRadius += options.labelOffset;\n\n // Calculate end angle based on total sum and current data value and offset with padding\n var center = {\n x: chartRect.x1 + chartRect.width() / 2,\n y: chartRect.y2 + chartRect.height() / 2\n };\n\n // Check if there is only one non-zero value in the series array.\n var hasSingleValInSeries = data.raw.series.filter(function(val) {\n return val.hasOwnProperty('value') ? val.value !== 0 : val !== 0;\n }).length === 1;\n\n // Creating the series groups\n data.raw.series.forEach(function(series, index) {\n seriesGroups[index] = this.svg.elem('g', null, null);\n }.bind(this));\n //if we need to show labels we create the label group now\n if(options.showLabel) {\n labelsGroup = this.svg.elem('g', null, null);\n }\n\n // Draw the series\n // initialize series groups\n data.raw.series.forEach(function(series, index) {\n // If current value is zero and we are ignoring empty values then skip to next value\n if (data.normalized.series[index] === 0 && options.ignoreEmptyValues) return;\n\n // If the series is an object and contains a name or meta data we add a custom attribute\n seriesGroups[index].attr({\n 'ct:series-name': series.name\n });\n\n // Use series class from series data or if not set generate one\n seriesGroups[index].addClass([\n options.classNames.series,\n (series.className || options.classNames.series + '-' + Chartist.alphaNumerate(index))\n ].join(' '));\n\n // If the whole dataset is 0 endAngle should be zero. Can't divide by 0.\n var endAngle = (totalDataSum > 0 ? startAngle + data.normalized.series[index] / totalDataSum * 360 : 0);\n\n // Use slight offset so there are no transparent hairline issues\n var overlappigStartAngle = Math.max(0, startAngle - (index === 0 || hasSingleValInSeries ? 0 : 0.2));\n\n // If we need to draw the arc for all 360 degrees we need to add a hack where we close the circle\n // with Z and use 359.99 degrees\n if(endAngle - overlappigStartAngle >= 359.99) {\n endAngle = overlappigStartAngle + 359.99;\n }\n\n var start = Chartist.polarToCartesian(center.x, center.y, radius, overlappigStartAngle),\n end = Chartist.polarToCartesian(center.x, center.y, radius, endAngle);\n\n var innerStart,\n innerEnd,\n donutSolidRadius;\n\n // Create a new path element for the pie chart. If this isn't a donut chart we should close the path for a correct stroke\n var path = new Chartist.Svg.Path(!options.donut || options.donutSolid)\n .move(end.x, end.y)\n .arc(radius, radius, 0, endAngle - startAngle > 180, 0, start.x, start.y);\n\n // If regular pie chart (no donut) we add a line to the center of the circle for completing the pie\n if(!options.donut) {\n path.line(center.x, center.y);\n } else if (options.donutSolid) {\n donutSolidRadius = radius - donutWidth.value;\n innerStart = Chartist.polarToCartesian(center.x, center.y, donutSolidRadius, startAngle - (index === 0 || hasSingleValInSeries ? 0 : 0.2));\n innerEnd = Chartist.polarToCartesian(center.x, center.y, donutSolidRadius, endAngle);\n path.line(innerStart.x, innerStart.y);\n path.arc(donutSolidRadius, donutSolidRadius, 0, endAngle - startAngle > 180, 1, innerEnd.x, innerEnd.y);\n }\n\n // Create the SVG path\n // If this is a donut chart we add the donut class, otherwise just a regular slice\n var pathClassName = options.classNames.slicePie;\n if (options.donut) {\n pathClassName = options.classNames.sliceDonut;\n if (options.donutSolid) {\n pathClassName = options.classNames.sliceDonutSolid;\n }\n }\n var pathElement = seriesGroups[index].elem('path', {\n d: path.stringify()\n }, pathClassName);\n\n // Adding the pie series value to the path\n pathElement.attr({\n 'ct:value': data.normalized.series[index],\n 'ct:meta': Chartist.serialize(series.meta)\n });\n\n // If this is a donut, we add the stroke-width as style attribute\n if(options.donut && !options.donutSolid) {\n pathElement._node.style.strokeWidth = donutWidth.value + 'px';\n }\n\n // Fire off draw event\n this.eventEmitter.emit('draw', {\n type: 'slice',\n value: data.normalized.series[index],\n totalDataSum: totalDataSum,\n index: index,\n meta: series.meta,\n series: series,\n group: seriesGroups[index],\n element: pathElement,\n path: path.clone(),\n center: center,\n radius: radius,\n startAngle: startAngle,\n endAngle: endAngle\n });\n\n // If we need to show labels we need to add the label for this slice now\n if(options.showLabel) {\n var labelPosition;\n if(data.raw.series.length === 1) {\n // If we have only 1 series, we can position the label in the center of the pie\n labelPosition = {\n x: center.x,\n y: center.y\n };\n } else {\n // Position at the labelRadius distance from center and between start and end angle\n labelPosition = Chartist.polarToCartesian(\n center.x,\n center.y,\n labelRadius,\n startAngle + (endAngle - startAngle) / 2\n );\n }\n\n var rawValue;\n if(data.normalized.labels && !Chartist.isFalseyButZero(data.normalized.labels[index])) {\n rawValue = data.normalized.labels[index];\n } else {\n rawValue = data.normalized.series[index];\n }\n\n var interpolatedValue = options.labelInterpolationFnc(rawValue, index);\n\n if(interpolatedValue || interpolatedValue === 0) {\n var labelElement = labelsGroup.elem('text', {\n dx: labelPosition.x,\n dy: labelPosition.y,\n 'text-anchor': determineAnchorPosition(center, labelPosition, options.labelDirection)\n }, options.classNames.label).text('' + interpolatedValue);\n\n // Fire off draw event\n this.eventEmitter.emit('draw', {\n type: 'label',\n index: index,\n group: labelsGroup,\n element: labelElement,\n text: '' + interpolatedValue,\n x: labelPosition.x,\n y: labelPosition.y\n });\n }\n }\n\n // Set next startAngle to current endAngle.\n // (except for last slice)\n startAngle = endAngle;\n }.bind(this));\n\n this.eventEmitter.emit('created', {\n chartRect: chartRect,\n svg: this.svg,\n options: options\n });\n }\n\n /**\n * This method creates a new pie chart and returns an object that can be used to redraw the chart.\n *\n * @memberof Chartist.Pie\n * @param {String|Node} query A selector query string or directly a DOM element\n * @param {Object} data The data object in the pie chart needs to have a series property with a one dimensional data array. The values will be normalized against each other and don't necessarily need to be in percentage. The series property can also be an array of value objects that contain a value property and a className property to override the CSS class name for the series group.\n * @param {Object} [options] The options object with options that override the default options. Check the examples for a detailed list.\n * @param {Array} [responsiveOptions] Specify an array of responsive option arrays which are a media query and options object pair => [[mediaQueryString, optionsObject],[more...]]\n * @return {Object} An object with a version and an update method to manually redraw the chart\n *\n * @example\n * // Simple pie chart example with four series\n * new Chartist.Pie('.ct-chart', {\n * series: [10, 2, 4, 3]\n * });\n *\n * @example\n * // Drawing a donut chart\n * new Chartist.Pie('.ct-chart', {\n * series: [10, 2, 4, 3]\n * }, {\n * donut: true\n * });\n *\n * @example\n * // Using donut, startAngle and total to draw a gauge chart\n * new Chartist.Pie('.ct-chart', {\n * series: [20, 10, 30, 40]\n * }, {\n * donut: true,\n * donutWidth: 20,\n * startAngle: 270,\n * total: 200\n * });\n *\n * @example\n * // Drawing a pie chart with padding and labels that are outside the pie\n * new Chartist.Pie('.ct-chart', {\n * series: [20, 10, 30, 40]\n * }, {\n * chartPadding: 30,\n * labelOffset: 50,\n * labelDirection: 'explode'\n * });\n *\n * @example\n * // Overriding the class names for individual series as well as a name and meta data.\n * // The name will be written as ct:series-name attribute and the meta data will be serialized and written\n * // to a ct:meta attribute.\n * new Chartist.Pie('.ct-chart', {\n * series: [{\n * value: 20,\n * name: 'Series 1',\n * className: 'my-custom-class-one',\n * meta: 'Meta One'\n * }, {\n * value: 10,\n * name: 'Series 2',\n * className: 'my-custom-class-two',\n * meta: 'Meta Two'\n * }, {\n * value: 70,\n * name: 'Series 3',\n * className: 'my-custom-class-three',\n * meta: 'Meta Three'\n * }]\n * });\n */\n function Pie(query, data, options, responsiveOptions) {\n Chartist.Pie.super.constructor.call(this,\n query,\n data,\n defaultOptions,\n Chartist.extend({}, defaultOptions, options),\n responsiveOptions);\n }\n\n // Creating pie chart type in Chartist namespace\n Chartist.Pie = Chartist.Base.extend({\n constructor: Pie,\n createChart: createChart,\n determineAnchorPosition: determineAnchorPosition\n });\n\n}(this || global, Chartist));\n\nreturn Chartist;\n\n}));\n"]}
js/dashboard.js CHANGED
@@ -1,75 +1,93 @@
1
- (function () {
2
  // Initialize.
3
  var labels = [];
4
  var data = [];
5
- var statify_data_table = jQuery('#statify_chart_data');
 
 
 
 
 
6
 
7
  // Abort if no data is present.
8
- if (!statify_data_table.length) {
9
  return;
10
  }
11
 
12
  // Collect data from hidden table.
13
- jQuery('th', statify_data_table).each(function () {
14
- labels.push(jQuery(this).text());
15
- });
16
 
17
- jQuery('td', statify_data_table).each(function () {
18
- data.push(jQuery(this).text());
19
- });
20
 
21
  // Determine maximum value for scaling.
22
- var maxValue = Math.max.apply(Math, data);
 
 
 
 
 
 
 
 
 
 
 
23
 
24
  // Draw chart.
25
- var chart = new Chartist.Line('#statify_chart', {
26
  labels: labels,
27
  series: [
28
- data
29
- ]
30
  }, {
31
- low : 0,
32
- showArea : true,
33
- fullWidth: true,
34
- axisX : {
35
- showGrid : false,
 
36
  showLabel: false,
37
- offset : 0
38
  },
39
- axisY : {
40
- showGrid : false,
41
  showLabel: true,
42
- type : Chartist.FixedScaleAxis,
43
- low : 0,
44
- high : maxValue + 1,
45
- ticks : [maxValue],
46
- offset : 15
 
 
 
 
 
 
47
  },
48
- plugins : [
49
- Chartist.plugins.tooltip({
50
  appendToBody: true,
51
- class : 'statify-chartist-tooltip'
52
- })
53
- ]
54
- });
55
-
56
- var pointRadius = 4;
57
- if (data.length > 365) pointRadius = 0;
58
- else if (data.length > 180) pointRadius = 1;
59
- else if (data.length > 90) pointRadius = 2;
60
 
61
  // Replace default points with hollow circles, add "pageview(s) to value and append date (label) as meta data.
62
- chart.on('draw', function (data) {
63
- if ('point' === data.type) {
64
- var circle = new Chartist.Svg('circle', {
65
- cx: [data.x],
66
- cy: [data.y],
67
- r: [pointRadius],
68
- 'ct:value': data.value.y + ' ' + (data.value.y > 1 ? statify_translations.pageviews : statify_translations.pageview),
69
- 'ct:meta': labels[data.index]
70
- }, 'ct-point');
71
- data.element.replace(circle);
 
72
  }
73
- });
74
-
75
- })();
1
+ ( function() {
2
  // Initialize.
3
  var labels = [];
4
  var data = [];
5
+ var statifyDataTable = jQuery( '#statify_chart_data' );
6
+ var maxValue;
7
+ var chartWidth;
8
+ var fullWidth = true;
9
+ var pointRadius = 4;
10
+ var chart;
11
 
12
  // Abort if no data is present.
13
+ if ( ! statifyDataTable.length ) {
14
  return;
15
  }
16
 
17
  // Collect data from hidden table.
18
+ jQuery( 'th', statifyDataTable ).each( function() {
19
+ labels.push( jQuery( this ).text() );
20
+ } );
21
 
22
+ jQuery( 'td', statifyDataTable ).each( function() {
23
+ data.push( jQuery( this ).text() );
24
+ } );
25
 
26
  // Determine maximum value for scaling.
27
+ maxValue = Math.max.apply( Math, data );
28
+
29
+ // Adjust display according if there are too many values to display redable.
30
+ chartWidth = jQuery( '#statify_chart' ).width();
31
+ if ( chartWidth < data.length * 4 ) {
32
+ // Make chart scrollable, if 2px points are overlapping.
33
+ fullWidth = false;
34
+ pointRadius = 3;
35
+ } else if ( chartWidth < data.length * 8 ) {
36
+ // Shrink datapoints if 4px is overlapping, but 2 is not.
37
+ pointRadius = 2;
38
+ }
39
 
40
  // Draw chart.
41
+ chart = new Chartist.Line( '#statify_chart', {
42
  labels: labels,
43
  series: [
44
+ data,
45
+ ],
46
  }, {
47
+ low: 0,
48
+ showArea: true,
49
+ fullWidth: fullWidth,
50
+ width: ( fullWidth ? null : 5 * data.length ),
51
+ axisX: {
52
+ showGrid: false,
53
  showLabel: false,
54
+ offset: 0,
55
  },
56
+ axisY: {
57
+ showGrid: true,
58
  showLabel: true,
59
+ type: Chartist.FixedScaleAxis,
60
+ low: 0,
61
+ high: maxValue + 1,
62
+ ticks: [
63
+ 0,
64
+ Math.round( maxValue * 1 / 4 ),
65
+ Math.round( maxValue * 2 / 4 ),
66
+ Math.round( maxValue * 3 / 4 ),
67
+ maxValue,
68
+ ],
69
+ offset: 30,
70
  },
71
+ plugins: [
72
+ Chartist.plugins.tooltip( {
73
  appendToBody: true,
74
+ class: 'statify-chartist-tooltip',
75
+ } ),
76
+ ],
77
+ } );
 
 
 
 
 
78
 
79
  // Replace default points with hollow circles, add "pageview(s) to value and append date (label) as meta data.
80
+ chart.on( 'draw', function( d ) {
81
+ var circle;
82
+ if ( 'point' === d.type ) {
83
+ circle = new Chartist.Svg( 'circle', {
84
+ cx: [ d.x ],
85
+ cy: [ d.y ],
86
+ r: [ pointRadius ],
87
+ 'ct:value': d.value.y + ' ' + ( d.value.y > 1 ? statify_translations.pageviews : statify_translations.pageview ),
88
+ 'ct:meta': labels[d.index],
89
+ }, 'ct-point' );
90
+ d.element.replace( circle );
91
  }
92
+ } );
93
+ }() );
 
js/dashboard.min.js CHANGED
@@ -1,2 +1,3 @@
1
- (function(){var labels=[];var data=[];var statify_data_table=jQuery('#statify_chart_data');if(!statify_data_table.length){return}
2
- jQuery('th',statify_data_table).each(function(){labels.push(jQuery(this).text())});jQuery('td',statify_data_table).each(function(){data.push(jQuery(this).text())});var maxValue=Math.max.apply(Math,data);var chart=new Chartist.Line('#statify_chart',{labels:labels,series:[data]},{low:0,showArea:!0,fullWidth:!0,axisX:{showGrid:!1,showLabel:!1,offset:0},axisY:{showGrid:!1,showLabel:!0,type:Chartist.FixedScaleAxis,low:0,high:maxValue+1,ticks:[maxValue],offset:15},plugins:[Chartist.plugins.tooltip({appendToBody:!0,class:'statify-chartist-tooltip'})]});var pointRadius=4;if(data.length>365)pointRadius=0;else if(data.length>180)pointRadius=1;else if(data.length>90)pointRadius=2;chart.on('draw',function(data){if('point'===data.type){var circle=new Chartist.Svg('circle',{cx:[data.x],cy:[data.y],r:[pointRadius],'ct:value':data.value.y+' '+(data.value.y>1?statify_translations.pageviews:statify_translations.pageview),'ct:meta':labels[data.index]},'ct-point');data.element.replace(circle)}})})()
 
1
+ (function(){var labels=[];var data=[];var statifyDataTable=jQuery('#statify_chart_data');var maxValue;var chartWidth;var fullWidth=!0;var pointRadius=4;var chart;if(!statifyDataTable.length){return}
2
+ jQuery('th',statifyDataTable).each(function(){labels.push(jQuery(this).text())});jQuery('td',statifyDataTable).each(function(){data.push(jQuery(this).text())});maxValue=Math.max.apply(Math,data);chartWidth=jQuery('#statify_chart').width();if(chartWidth<data.length*4){fullWidth=!1;pointRadius=3}else if(chartWidth<data.length*8){pointRadius=2}
3
+ chart=new Chartist.Line('#statify_chart',{labels:labels,series:[data,],},{low:0,showArea:!0,fullWidth:fullWidth,width:(fullWidth?null:5*data.length),axisX:{showGrid:!1,showLabel:!1,offset:0,},axisY:{showGrid:!0,showLabel:!0,type:Chartist.FixedScaleAxis,low:0,high:maxValue+1,ticks:[0,Math.round(maxValue*1/4),Math.round(maxValue*2/4),Math.round(maxValue*3/4),maxValue,],offset:30,},plugins:[Chartist.plugins.tooltip({appendToBody:!0,class:'statify-chartist-tooltip',}),],});chart.on('draw',function(d){var circle;if('point'===d.type){circle=new Chartist.Svg('circle',{cx:[d.x],cy:[d.y],r:[pointRadius],'ct:value':d.value.y+' '+(d.value.y>1?statify_translations.pageviews:statify_translations.pageview),'ct:meta':labels[d.index],},'ct-point');d.element.replace(circle)}})}())
js/snippet.js CHANGED
@@ -1,11 +1,15 @@
1
- try {
2
- const statifyReq = new XMLHttpRequest();
3
- statifyReq.open(
4
- 'GET',
5
- document.getElementById('statify-js-snippet').getAttribute('data-home-url')
6
- + '?statify_referrer=' + encodeURIComponent(document.referrer)
7
- + '&statify_target=' + encodeURIComponent(location.pathname + location.search)
8
- );
9
- statifyReq.send(null);
10
- } catch (e) {
11
- }
 
 
 
 
1
+ ( function() {
2
+ var statifyReq;
3
+ try {
4
+ statifyReq = new XMLHttpRequest();
5
+ statifyReq.open( 'POST', statify_ajax.url, true );
6
+ statifyReq.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded;' );
7
+ statifyReq.send(
8
+ '_ajax_nonce=' + statify_ajax.nonce +
9
+ '&action=statify_track' +
10
+ '&statify_referrer=' + encodeURIComponent( document.referrer ) +
11
+ '&statify_target=' + encodeURIComponent( location.pathname + location.search )
12
+ );
13
+ } catch ( e ) {
14
+ }
15
+ }() );
js/snippet.min.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(){var statifyReq;try{statifyReq=new XMLHttpRequest();statifyReq.open('POST',statify_ajax.url,!0);statifyReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded;');statifyReq.send('_ajax_nonce='+statify_ajax.nonce+'&action=statify_track'+'&statify_referrer='+encodeURIComponent(document.referrer)+'&statify_target='+encodeURIComponent(location.pathname+location.search))}catch(e){}}())
readme.txt CHANGED
@@ -3,9 +3,9 @@
3
  * Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW
4
  * Tags: analytics, dashboard, pageviews, privacy, statistics, stats, visits, web stats, widget
5
  * Requires at least: 4.7
6
- * Tested up to: 4.9
7
- * Requires PHP: 5.6
8
- * Stable tag: 1.6.3
9
  * License: GPLv3 or later
10
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -34,7 +34,7 @@ The statistics for the dashboard widget are cached for four minutes.
34
  ### Period of data saving ###
35
  *Statify* stores the data only for a limited period (default: two weeks), longer intervals can be selected as option in the widget. Data which is older than the selected period is deleted by a daily cron job.
36
 
37
- An increase in the database volume can be expected because all statistic values are collected and managed in the local WordPress database (expecially if you increase the period of data saving).
38
 
39
  ### JavaScript tracking for caching compatibility ###
40
  For compatibility with caching plugins like [Cachify](http://cachify.de) *Statify* offers an optional switchable tracking via JavaScript. This function allows reliable count of cached blog pages.
@@ -62,7 +62,7 @@ If you've problems or think you’ve found a bug (e.g. you’re experiencing une
62
  * trackbacks
63
  * searches
64
  * previews
65
- * views by logged in users
66
  * error pages
67
 
68
  This behavior can be modified with the `statify__skip_tracking` hook.
@@ -115,6 +115,22 @@ has to be added to the theme's `functions.php`. The condition has modified such
115
  ## Changelog ##
116
  You can find the full changelog in [our GitHub repository](https://github.com/pluginkollektiv/statify/blob/master/CHANGELOG.md).
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  ### 1.6.3
119
  * Fix compatibility issue with some PHP implementations not populating `INPUT_SERVER`
120
  * Fix failing blacklist check for empty referrers
@@ -143,6 +159,10 @@ For the complete changelog, check out our [GitHub repository](https://github.com
143
 
144
  ## Upgrade Notice ##
145
 
 
 
 
 
146
  ### 1.6.3 ###
147
  This bugfix release is recommended for all users.
148
  It fixes completely broken tracking with some PHP implementations. Sorry for that, we might owe you a couple of visitors.
@@ -156,4 +176,5 @@ This bugfix release is recommended for all users.
156
 
157
  ## Screenshots ##
158
  1. Statify dashboard widget
159
- 2. Statify dashboard widget options
 
3
  * Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW
4
  * Tags: analytics, dashboard, pageviews, privacy, statistics, stats, visits, web stats, widget
5
  * Requires at least: 4.7
6
+ * Tested up to: 5.4
7
+ * Requires PHP: 5.2
8
+ * Stable tag: 1.7.0
9
  * License: GPLv3 or later
10
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
34
  ### Period of data saving ###
35
  *Statify* stores the data only for a limited period (default: two weeks), longer intervals can be selected as option in the widget. Data which is older than the selected period is deleted by a daily cron job.
36
 
37
+ An increase in the database volume can be expected because all statistic values are collected and managed in the local WordPress database (especially if you increase the period of data saving).
38
 
39
  ### JavaScript tracking for caching compatibility ###
40
  For compatibility with caching plugins like [Cachify](http://cachify.de) *Statify* offers an optional switchable tracking via JavaScript. This function allows reliable count of cached blog pages.
62
  * trackbacks
63
  * searches
64
  * previews
65
+ * views by logged in users (unless tracking is activated via the settings page)
66
  * error pages
67
 
68
  This behavior can be modified with the `statify__skip_tracking` hook.
115
  ## Changelog ##
116
  You can find the full changelog in [our GitHub repository](https://github.com/pluginkollektiv/statify/blob/master/CHANGELOG.md).
117
 
118
+ ### 1.7.0
119
+ * Fix JavaScript embedding when bots visit before caching (#84) (#86)
120
+ * Fix offset in visitor reporting due to different timezones between PHP and database (#117, props @sophiehuiberts)
121
+ * Fix untranslatable support link (#122) (#126, props @arkonisus)
122
+ * Add separate settings page and reduced widget backview to widget settings only (#111)
123
+ * Add options to track logged in users (#103) (#111)
124
+ * Add option to show total visits (#134, props @yurihs)
125
+ * Refactored JavaScript tracking to use WP AJAX (#109) (#142)
126
+ * Introduced new option to separate display from storage range (#72)
127
+ * Automatically add AMP analytics trigger if official AMP PlugIn is installed (#110) (#116, props @tthemann)
128
+ * Dashboard widget is now scrollable with dynamic point radius to keep long-term statistics readable (#71) (#101, props @manumeter)
129
+ * Improved bot detection (#112) (#125, props @mahype)
130
+ * Updated Chartist JS library for dashboard widget (#132)
131
+ * Skip tracking for favicon.ico redirects (since WP 5.4) (#144)
132
+ * Tested up to WordPress 5.4
133
+
134
  ### 1.6.3
135
  * Fix compatibility issue with some PHP implementations not populating `INPUT_SERVER`
136
  * Fix failing blacklist check for empty referrers
159
 
160
  ## Upgrade Notice ##
161
 
162
+ ### 1.7.0 ###
163
+ JavaScript tracking has been changed to use the WordPress AJAX endpoint.
164
+ If you are using Statify without modifications, you are all set. Custom logic however might require adjustments (see snippet.js for reference).
165
+
166
  ### 1.6.3 ###
167
  This bugfix release is recommended for all users.
168
  It fixes completely broken tracking with some PHP implementations. Sorry for that, we might owe you a couple of visitors.
176
 
177
  ## Screenshots ##
178
  1. Statify dashboard widget
179
+ 2. Statify dashboard widget settings
180
+ 3. Statify settings page
statify.php CHANGED
@@ -7,7 +7,7 @@
7
  * Author URI: https://pluginkollektiv.org
8
  * Plugin URI: https://wordpress.org/plugins/statify/
9
  * License: GPLv3 or later
10
- * Version: 1.6.3
11
  *
12
  * @package WordPress
13
  */
@@ -18,8 +18,9 @@ defined( 'ABSPATH' ) || exit;
18
 
19
  /* Constants */
20
  define( 'STATIFY_FILE', __FILE__ );
21
- define( 'STATIFY_DIR', __DIR__ );
22
  define( 'STATIFY_BASE', plugin_basename( __FILE__ ) );
 
23
 
24
 
25
  /* Hooks */
@@ -27,7 +28,7 @@ add_action(
27
  'plugins_loaded',
28
  array(
29
  'Statify',
30
- 'instance',
31
  )
32
  );
33
  register_activation_hook(
@@ -71,18 +72,17 @@ function statify_autoload( $class ) {
71
  'Statify_Install',
72
  'Statify_Uninstall',
73
  'Statify_Deactivate',
 
74
  'Statify_Table',
75
  'Statify_XMLRPC',
76
  'Statify_Cron',
77
  );
78
 
79
  if ( in_array( $class, $plugin_classes, true ) ) {
80
- require_once(
81
- sprintf(
82
- '%s/inc/class-%s.php',
83
- STATIFY_DIR,
84
- strtolower( str_replace( '_', '-', $class ) )
85
- )
86
  );
87
  }
88
  }
7
  * Author URI: https://pluginkollektiv.org
8
  * Plugin URI: https://wordpress.org/plugins/statify/
9
  * License: GPLv3 or later
10
+ * Version: 1.7.0
11
  *
12
  * @package WordPress
13
  */
18
 
19
  /* Constants */
20
  define( 'STATIFY_FILE', __FILE__ );
21
+ define( 'STATIFY_DIR', dirname( __FILE__ ) );
22
  define( 'STATIFY_BASE', plugin_basename( __FILE__ ) );
23
+ define( 'STATIFY_VERSION', '1.7.0' );
24
 
25
 
26
  /* Hooks */
28
  'plugins_loaded',
29
  array(
30
  'Statify',
31
+ 'init',
32
  )
33
  );
34
  register_activation_hook(
72
  'Statify_Install',
73
  'Statify_Uninstall',
74
  'Statify_Deactivate',
75
+ 'Statify_Settings',
76
  'Statify_Table',
77
  'Statify_XMLRPC',
78
  'Statify_Cron',
79
  );
80
 
81
  if ( in_array( $class, $plugin_classes, true ) ) {
82
+ require_once sprintf(
83
+ '%s/inc/class-%s.php',
84
+ STATIFY_DIR,
85
+ strtolower( str_replace( '_', '-', $class ) )
 
 
86
  );
87
  }
88
  }
views/js-snippet.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- /**
3
- * Statify: JavaScript Snippet View
4
- *
5
- * This file contains the template for the plugin's JS snippet.
6
- *
7
- * @package Statify
8
- */
9
-
10
- class_exists( 'Statify' ) || exit; ?>
11
-
12
- <!-- Stats by http://statify.de -->
13
- <div id="statify-js-snippet"
14
- style="display:none"
15
- data-home-url="<?php echo esc_url( home_url( '/', 'relative' ) ); ?>">
16
- </div>
17
- <script type="text/javascript"
18
- src="<?php echo esc_attr( plugins_url( 'js/snippet.js', STATIFY_FILE ) ); ?>">
19
- </script>
20
-
21
- <?php /* Markup space */ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
views/widget-back.php CHANGED
@@ -10,12 +10,24 @@
10
  // Quit if accessed outside WP context.
11
  class_exists( 'Statify' ) || exit; ?>
12
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  <fieldset>
14
- <label for="statify_days">
15
- <input name="statify[days]" id="statify_days" type="number" min="1"
16
- value="<?php echo esc_attr( Statify::$_options['days'] ); ?>">
17
  <?php esc_html_e( 'days', 'statify' ); ?> -
18
- <?php esc_html_e( 'Period of data saving', 'statify' ); ?>
19
  </label>
20
  <label for="statify_limit">
21
  <input name="statify[limit]" id="statify_limit" type="number" min="1" max="100"
@@ -26,20 +38,15 @@ class_exists( 'Statify' ) || exit; ?>
26
  <input type="checkbox" name="statify[today]" id="statify_today" value="1" <?php checked( Statify::$_options['today'], 1 ); ?> />
27
  <?php esc_html_e( 'Entries in top lists only for today', 'statify' ); ?>
28
  </label>
29
- <label for="statify_snippet">
30
- <input type="checkbox" name="statify[snippet]" id="statify_snippet" value="1" <?php checked( Statify::$_options['snippet'], 1 ); ?> />
31
- <?php esc_html_e( 'Page tracking via JavaScript', 'statify' ); ?>
32
- <small>(<?php esc_html_e( 'recommended if caching is in use', 'statify' ); ?>)</small>
33
- </label>
34
- <label for="statify_blacklist">
35
- <input type="checkbox" name="statify[blacklist]" id="statify_blacklist" value="1" <?php checked( Statify::$_options['blacklist'], 1 ); ?> />
36
- <?php esc_html_e( 'Skip tracking for referrers listed in the comment blacklist', 'statify' ); ?>
37
  </label>
38
  </fieldset>
39
  <?php wp_nonce_field( 'statify-dashboard' ); ?>
40
 
41
  <p class="meta-links">
42
- <a href="<?php esc_html_e( 'https://wordpress.org/plugins/statify/', 'statify' ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Documentation', 'statify' ); ?></a>
43
  &bull; <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Donate', 'statify' ); ?></a>
44
- &bull; <a href="https://wordpress.org/support/plugin/statify" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Support', 'statify' ); ?></a>
45
  </p>
10
  // Quit if accessed outside WP context.
11
  class_exists( 'Statify' ) || exit; ?>
12
 
13
+ <?php if ( current_user_can( 'manage_options' ) ) : ?>
14
+ <p class="meta-links settings-link">
15
+ <a href="<?php echo esc_attr( add_query_arg( array( 'page' => 'statify-settings' ), admin_url( '/options-general.php' ) ) ); ?>"
16
+ title="<?php esc_attr_e( 'Open full settings page', 'statify' ); ?>">
17
+ <span class="dashicons dashicons-admin-generic"></span>
18
+ <?php esc_html_e( 'All Settings', 'statify' ); ?></a>
19
+ </p>
20
+
21
+ <br>
22
+ <?php endif; ?>
23
+
24
+ <h3><?php esc_html_e( 'Widget Settings', 'statify' ); ?></h3>
25
  <fieldset>
26
+ <label for="statify_days_show">
27
+ <input name="statify[days_show]" id="statify_days_show" type="number" min="1"
28
+ value="<?php echo esc_attr( Statify::$_options['days_show'] ); ?>">
29
  <?php esc_html_e( 'days', 'statify' ); ?> -
30
+ <?php esc_html_e( 'Period of data display in Dashboard', 'statify' ); ?>
31
  </label>
32
  <label for="statify_limit">
33
  <input name="statify[limit]" id="statify_limit" type="number" min="1" max="100"
38
  <input type="checkbox" name="statify[today]" id="statify_today" value="1" <?php checked( Statify::$_options['today'], 1 ); ?> />
39
  <?php esc_html_e( 'Entries in top lists only for today', 'statify' ); ?>
40
  </label>
41
+ <label for="statify_show_totals">
42
+ <input type="checkbox" name="statify[show_totals]" id="statify_show_totals" value="1" <?php checked( Statify::$_options['show_totals'], 1 ); ?> />
43
+ <?php esc_html_e( 'Show totals', 'statify' ); ?>
 
 
 
 
 
44
  </label>
45
  </fieldset>
46
  <?php wp_nonce_field( 'statify-dashboard' ); ?>
47
 
48
  <p class="meta-links">
49
+ <a href="<?php echo esc_url( __( 'https://wordpress.org/plugins/statify/', 'statify' ) ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Documentation', 'statify' ); ?></a>
50
  &bull; <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=TD4AMD2D8EMZW" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Donate', 'statify' ); ?></a>
51
+ &bull; <a href="<?php echo esc_url( __( 'https://wordpress.org/support/plugin/statify', 'statify' ) ); ?>" target="_blank" rel="noopener noreferrer"><?php esc_html_e( 'Support', 'statify' ); ?></a>
52
  </p>
views/widget-front.php CHANGED
@@ -81,3 +81,34 @@ $stats = Statify_Dashboard::get_stats(); ?>
81
  </div>
82
  </div>
83
  <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  </div>
82
  </div>
83
  <?php } ?>
84
+
85
+
86
+
87
+ <?php if ( ! empty( $stats['visit_totals'] ) ) { ?>
88
+ <div class="table total">
89
+ <p class="sub">
90
+ <?php esc_html_e( 'Totals', 'statify' ); ?>
91
+ </p>
92
+ <div>
93
+ <table>
94
+ <tr>
95
+ <td class="b">
96
+ <?php echo (int) $stats['visit_totals']['today']; ?>
97
+ </td>
98
+ <td class="t">
99
+ <?php esc_html_e( 'today', 'statify' ); ?>
100
+ </td>
101
+ </tr>
102
+ <tr>
103
+ <td class="b">
104
+ <?php echo (int) $stats['visit_totals']['since_beginning']; ?>
105
+ </td>
106
+ <td class="t">
107
+ <?php esc_html_e( 'since', 'statify' ); ?>
108
+ <?php echo esc_html( date_i18n( get_option( 'date_format' ), strtotime( $stats['visits'][0]['date'] ) ) ); ?>
109
+ </td>
110
+ </tr>
111
+ </table>
112
+ </div>
113
+ </div>
114
+ <?php } ?>