@macallumharvey/first-test-wet 2.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/WetButton.d.ts +1 -1
- package/dist/first-test-wet.cjs.development.js +5 -0
- package/dist/first-test-wet.cjs.development.js.map +1 -1
- package/dist/first-test-wet.cjs.production.min.js +1 -1
- package/dist/first-test-wet.cjs.production.min.js.map +1 -1
- package/dist/first-test-wet.esm.js +5 -1
- package/dist/first-test-wet.esm.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/WetButton.tsx +1 -1
- package/src/WetModal.tsx +1 -0
- package/src/index.tsx +1 -0
- package/src/theme-wet-boew/assets/favicon-mobile.png +0 -0
- package/src/theme-wet-boew/assets/favicon.ico +0 -0
- package/src/theme-wet-boew/assets/logo.png +0 -0
- package/src/theme-wet-boew/assets/logo.svg +14 -0
- package/src/theme-wet-boew/css/ie8-theme.css +17370 -0
- package/src/theme-wet-boew/css/ie8-theme.min.css +193 -0
- package/src/{wet-boew-cdn-4.0.81.1/js/ie8-wet-boew.js → theme-wet-boew/css/ie8-wet-boew.css} +12 -10
- package/src/{wet-boew-cdn-4.0.81.1/js/ie8-wet-boew2.min.js → theme-wet-boew/css/ie8-wet-boew.min.css} +7 -7
- package/src/theme-wet-boew/css/theme.css +11357 -0
- package/src/theme-wet-boew/css/theme.min.css +6 -0
- package/src/{wet-boew-cdn-4.0.81.1/js/ie8-wet-boew2.js → theme-wet-boew/css/wet-boew.css} +12 -10
- package/src/{wet-boew-cdn-4.0.81.1/js/ie8-wet-boew.min.js → theme-wet-boew/css/wet-boew.min.css} +6 -7
- package/src/theme-wet-boew/payload.json +66 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/mediacontrols.html +32 -33
- package/src/wet-boew/assets/sprites_share.png +0 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/noscript.css +112 -112
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/noscript.min.css +5 -5
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/datalist.css +32 -32
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/datepicker.css +47 -47
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/details.css +28 -28
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/mathml.css +16 -16
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/meter.css +24 -24
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/progress.css +8 -8
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/slider.css +229 -229
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.svg +287 -287
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/additional-methods.js +1511 -1511
- package/src/wet-boew/js/deps/additional-methods.min.js +9 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/geomap-lib.js +3758 -3770
- package/src/wet-boew/js/deps/geomap-lib.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.dataTables.js +15345 -15733
- package/src/wet-boew/js/deps/jquery.dataTables.min.js +4 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.flot.canvas.js +345 -345
- package/src/wet-boew/js/deps/jquery.flot.canvas.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.flot.js +3168 -3168
- package/src/wet-boew/js/deps/jquery.flot.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.flot.orderBars.js +282 -282
- package/src/wet-boew/js/deps/jquery.flot.orderBars.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.flot.pie.js +820 -820
- package/src/wet-boew/js/deps/jquery.flot.pie.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.magnific-popup.js +2060 -2060
- package/src/wet-boew/js/deps/jquery.magnific-popup.min.js +4 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jquery.validate.js +1660 -1660
- package/src/wet-boew/js/deps/jquery.validate.min.js +9 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/json-patch.js +314 -314
- package/src/wet-boew/js/deps/json-patch.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/jsonpointer.js +349 -349
- package/src/wet-boew/js/deps/jsonpointer.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-apollo.js +53 -53
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-basic.js +49 -49
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-clj.js +64 -64
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-css.js +160 -160
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-dart.js +92 -92
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-erlang.js +94 -94
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-go.js +59 -59
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-hs.js +102 -102
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lasso.js +67 -67
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lisp.js +95 -95
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-llvm.js +63 -63
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-logtalk.js +50 -50
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lua.js +60 -60
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-matlab.js +183 -183
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-matlab.min.js +1 -1
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-ml.js +57 -57
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-mumps.js +140 -140
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-n.js +67 -67
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-pascal.js +49 -49
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-proto.js +37 -37
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-r.js +59 -59
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-rd.js +50 -50
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-rust.js +81 -81
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-scala.js +56 -56
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-sql.js +59 -59
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-swift.js +60 -60
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-tcl.js +63 -63
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-tex.js +49 -49
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-vb.js +67 -67
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-vhdl.js +51 -51
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-wiki.js +55 -55
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-xq.js +71 -71
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-yaml.js +45 -45
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/ol.js +1008 -1008
- package/src/wet-boew/js/deps/ol.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/prettify.js +1742 -1742
- package/src/wet-boew/js/deps/prettify.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/proj4.js +2 -2
- package/src/wet-boew/js/deps/proj4.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/run_prettify.js +1998 -1998
- package/src/wet-boew/js/deps/run_prettify.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/tableparser.js +2216 -2216
- package/src/wet-boew/js/deps/tableparser.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/unorm.js +452 -452
- package/src/wet-boew/js/deps/unorm.min.js +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/af.js +246 -254
- package/src/wet-boew/js/i18n/af.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/ar.js +284 -292
- package/src/wet-boew/js/i18n/ar.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/bg.js +284 -292
- package/src/wet-boew/js/i18n/bg.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/cs.js +285 -293
- package/src/wet-boew/js/i18n/cs.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/de.js +354 -362
- package/src/wet-boew/js/i18n/de.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/el.js +284 -292
- package/src/wet-boew/js/i18n/el.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/en.js +246 -254
- package/src/wet-boew/js/i18n/en.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/es.js +287 -295
- package/src/wet-boew/js/i18n/es.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/et.js +282 -290
- package/src/wet-boew/js/i18n/et.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/fr.js +313 -321
- package/src/wet-boew/js/i18n/fr.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/hi.js +246 -254
- package/src/wet-boew/js/i18n/hi.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/hu.js +284 -292
- package/src/wet-boew/js/i18n/hu.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/hy.js +246 -254
- package/src/wet-boew/js/i18n/hy.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/id.js +283 -291
- package/src/wet-boew/js/i18n/id.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/is.js +282 -290
- package/src/wet-boew/js/i18n/is.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/it.js +311 -319
- package/src/wet-boew/js/i18n/it.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/iu.js +246 -254
- package/src/wet-boew/js/i18n/iu.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/ja.js +285 -293
- package/src/wet-boew/js/i18n/ja.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/ko.js +284 -292
- package/src/wet-boew/js/i18n/ko.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/lt.js +284 -292
- package/src/wet-boew/js/i18n/lt.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/lv.js +284 -292
- package/src/wet-boew/js/i18n/lv.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/nl.js +318 -326
- package/src/wet-boew/js/i18n/nl.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/pl.js +287 -295
- package/src/wet-boew/js/i18n/pl.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/pt-BR.js +246 -254
- package/src/wet-boew/js/i18n/pt-BR.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/pt.js +270 -278
- package/src/wet-boew/js/i18n/pt.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/ru.js +284 -292
- package/src/wet-boew/js/i18n/ru.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/sk.js +282 -290
- package/src/wet-boew/js/i18n/sk.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/sq.js +246 -254
- package/src/wet-boew/js/i18n/sq.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/th.js +284 -292
- package/src/wet-boew/js/i18n/th.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/tr.js +286 -294
- package/src/wet-boew/js/i18n/tr.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/uk.js +284 -292
- package/src/wet-boew/js/i18n/uk.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/vi.js +284 -292
- package/src/wet-boew/js/i18n/vi.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/zh-Hans.js +246 -254
- package/src/wet-boew/js/i18n/zh-Hans.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/i18n/zh.js +285 -293
- package/src/wet-boew/js/i18n/zh.min.js +7 -0
- package/src/wet-boew/js/ie8-wet-boew.js +3992 -0
- package/src/wet-boew/js/ie8-wet-boew.min.js +7 -0
- package/src/wet-boew/js/ie8-wet-boew2.js +15294 -0
- package/src/wet-boew/js/ie8-wet-boew2.min.js +7 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/jquery/2.2.4/jquery.js +9814 -9814
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/jquery/2.2.4/jquery.min.js +4 -4
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/datalist.js +423 -419
- package/src/wet-boew/js/polyfills/datalist.min.js +8 -0
- package/src/wet-boew/js/polyfills/datalist.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/datalist_dynamic.js +50 -50
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/datalist_dynamic.min.js +7 -7
- package/src/wet-boew/js/polyfills/datalist_dynamic.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/datepicker.js +338 -338
- package/src/wet-boew/js/polyfills/datepicker.min.js +8 -0
- package/src/wet-boew/js/polyfills/datepicker.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/details.js +126 -126
- package/src/wet-boew/js/polyfills/details.min.js +8 -0
- package/src/wet-boew/js/polyfills/details.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/jawsariafixes.js +47 -47
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/jawsariafixes.min.js +15 -15
- package/src/wet-boew/js/polyfills/jawsariafixes.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/meter.js +140 -140
- package/src/wet-boew/js/polyfills/meter.min.js +8 -0
- package/src/wet-boew/js/polyfills/meter.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/mobile.js +783 -784
- package/src/wet-boew/js/polyfills/mobile.min.js +8 -0
- package/src/wet-boew/js/polyfills/mobile.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/progress.js +107 -107
- package/src/wet-boew/js/polyfills/progress.min.js +8 -0
- package/src/wet-boew/js/polyfills/progress.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/slider.js +1343 -1343
- package/src/wet-boew/js/polyfills/slider.min.js +9 -0
- package/src/wet-boew/js/polyfills/slider.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/slider_wrapper.js +73 -73
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/slider_wrapper.min.js +7 -7
- package/src/wet-boew/js/polyfills/slider_wrapper.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/svg.js +29 -29
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/svg.min.js +7 -7
- package/src/wet-boew/js/polyfills/svg.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/test.js +603 -603
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/polyfills/test.min.js +7 -7
- package/src/wet-boew/js/polyfills/test.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/wet-boew.js +17714 -20264
- package/src/wet-boew/js/wet-boew.min.js +9 -0
- package/src/wet-boew/js/wet-boew.min.js.map +1 -0
- package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/payload.json +1721 -1721
- package/src/wet-boew-cdn-4.0.81.1/Licence-fr.txt +0 -1
- package/src/wet-boew-cdn-4.0.81.1/License-en.txt +0 -1
- package/src/wet-boew-cdn-4.0.81.1/assets/sprites_share.png +0 -0
- package/src/wet-boew-cdn-4.0.81.1/js/deps/additional-methods.min.js +0 -9
- package/src/wet-boew-cdn-4.0.81.1/js/deps/geomap-lib.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.dataTables.min.js +0 -4
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.flot.canvas.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.flot.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.flot.orderBars.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.flot.pie.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.magnific-popup.min.js +0 -4
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jquery.validate.min.js +0 -9
- package/src/wet-boew-cdn-4.0.81.1/js/deps/json-patch.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/jsonpointer.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/ol.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/prettify.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/proj4.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/run_prettify.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/tableparser.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/deps/unorm.min.js +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/af.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/ar.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/bg.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/cs.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/de.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/el.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/en.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/es.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/et.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/fr.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/hi.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/hu.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/hy.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/id.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/is.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/it.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/iu.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/ja.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/ko.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/lt.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/lv.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/nl.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/pl.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/pt-BR.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/pt.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/ru.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/sk.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/sq.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/th.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/tr.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/uk.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/vi.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/zh-Hans.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/i18n/zh.min.js +0 -7
- package/src/wet-boew-cdn-4.0.81.1/js/ie8-wet-boew.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/ie8-wet-boew2.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datalist.min.js +0 -8
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datalist.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datalist_dynamic.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datepicker.min.js +0 -8
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/datepicker.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/details.min.js +0 -8
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/details.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/jawsariafixes.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/meter.min.js +0 -8
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/meter.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/mobile.min.js +0 -8
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/mobile.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/progress.min.js +0 -8
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/progress.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/slider.min.js +0 -9
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/slider.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/slider_wrapper.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/svg.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/polyfills/test.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/js/wet-boew.min.js +0 -9
- package/src/wet-boew-cdn-4.0.81.1/js/wet-boew.min.js.map +0 -1
- package/src/wet-boew-cdn-4.0.81.1/package.json +0 -15
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/cloud-popup-relative.png +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/fd-slider-sprite.png +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/loading.png +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/zoom-minus-mini.png +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/zoom-plus-mini.png +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/assets/zoom-world-mini.png +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/datalist.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/datepicker.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/details.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/mathml.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/meter.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/progress.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/css/polyfills/slider.min.css +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.eot +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.ttf +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/fonts/glyphicons-halflings-regular.woff2 +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/mml-chtml.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_AMS-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Bold.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Calligraphic-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Bold.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Fraktur-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Bold.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Italic.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Main-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-BoldItalic.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-Italic.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Math-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Bold.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Italic.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_SansSerif-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Script-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Size1-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Size2-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Size3-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Size4-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Typewriter-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Vector-Bold.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Vector-Regular.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/MathJax/output/chtml/fonts/woff-v2/MathJax_Zero.woff +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-apollo.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-basic.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-clj.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-css.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-dart.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-erlang.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-go.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-hs.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lasso.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lisp.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-llvm.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-logtalk.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-lua.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-ml.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-mumps.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-n.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-pascal.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-proto.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-r.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-rd.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-rust.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-scala.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-sql.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-swift.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-tcl.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-tex.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-vb.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-vhdl.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-wiki.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-xq.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/deps/lang-yaml.min.js +0 -0
- /package/src/{wet-boew-cdn-4.0.81.1 → wet-boew}/js/jquery/2.2.4/jquery.min.map +0 -0
@@ -1,820 +1,820 @@
|
|
1
|
-
/* Flot plugin for rendering pie charts.
|
2
|
-
|
3
|
-
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
4
|
-
Licensed under the MIT license.
|
5
|
-
|
6
|
-
The plugin assumes that each series has a single data value, and that each
|
7
|
-
value is a positive integer or zero. Negative numbers don't make sense for a
|
8
|
-
pie chart, and have unpredictable results. The values do NOT need to be
|
9
|
-
passed in as percentages; the plugin will calculate the total and per-slice
|
10
|
-
percentages internally.
|
11
|
-
|
12
|
-
* Created by Brian Medendorp
|
13
|
-
|
14
|
-
* Updated with contributions from btburnett3, Anthony Aragues and Xavi Ivars
|
15
|
-
|
16
|
-
The plugin supports these options:
|
17
|
-
|
18
|
-
series: {
|
19
|
-
pie: {
|
20
|
-
show: true/false
|
21
|
-
radius: 0-1 for percentage of fullsize, or a specified pixel length, or 'auto'
|
22
|
-
innerRadius: 0-1 for percentage of fullsize or a specified pixel length, for creating a donut effect
|
23
|
-
startAngle: 0-2 factor of PI used for starting angle (in radians) i.e 3/2 starts at the top, 0 and 2 have the same result
|
24
|
-
tilt: 0-1 for percentage to tilt the pie, where 1 is no tilt, and 0 is completely flat (nothing will show)
|
25
|
-
offset: {
|
26
|
-
top: integer value to move the pie up or down
|
27
|
-
left: integer value to move the pie left or right, or 'auto'
|
28
|
-
},
|
29
|
-
stroke: {
|
30
|
-
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#FFF')
|
31
|
-
width: integer pixel width of the stroke
|
32
|
-
},
|
33
|
-
label: {
|
34
|
-
show: true/false, or 'auto'
|
35
|
-
formatter: a user-defined function that modifies the text/style of the label text
|
36
|
-
radius: 0-1 for percentage of fullsize, or a specified pixel length
|
37
|
-
background: {
|
38
|
-
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#000')
|
39
|
-
opacity: 0-1
|
40
|
-
},
|
41
|
-
threshold: 0-1 for the percentage value at which to hide labels (if they're too small)
|
42
|
-
},
|
43
|
-
combine: {
|
44
|
-
threshold: 0-1 for the percentage value at which to combine slices (if they're too small)
|
45
|
-
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#CCC'), if null, the plugin will automatically use the color of the first slice to be combined
|
46
|
-
label: any text value of what the combined slice should be labeled
|
47
|
-
}
|
48
|
-
highlight: {
|
49
|
-
opacity: 0-1
|
50
|
-
}
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
More detail and specific examples can be found in the included HTML file.
|
55
|
-
|
56
|
-
*/
|
57
|
-
|
58
|
-
(function($) {
|
59
|
-
|
60
|
-
// Maximum redraw attempts when fitting labels within the plot
|
61
|
-
|
62
|
-
var REDRAW_ATTEMPTS = 10;
|
63
|
-
|
64
|
-
// Factor by which to shrink the pie when fitting labels within the plot
|
65
|
-
|
66
|
-
var REDRAW_SHRINK = 0.95;
|
67
|
-
|
68
|
-
function init(plot) {
|
69
|
-
|
70
|
-
var canvas = null,
|
71
|
-
target = null,
|
72
|
-
options = null,
|
73
|
-
maxRadius = null,
|
74
|
-
centerLeft = null,
|
75
|
-
centerTop = null,
|
76
|
-
processed = false,
|
77
|
-
ctx = null;
|
78
|
-
|
79
|
-
// interactive variables
|
80
|
-
|
81
|
-
var highlights = [];
|
82
|
-
|
83
|
-
// add hook to determine if pie plugin in enabled, and then perform necessary operations
|
84
|
-
|
85
|
-
plot.hooks.processOptions.push(function(plot, options) {
|
86
|
-
if (options.series.pie.show) {
|
87
|
-
|
88
|
-
options.grid.show = false;
|
89
|
-
|
90
|
-
// set labels.show
|
91
|
-
|
92
|
-
if (options.series.pie.label.show == "auto") {
|
93
|
-
if (options.legend.show) {
|
94
|
-
options.series.pie.label.show = false;
|
95
|
-
} else {
|
96
|
-
options.series.pie.label.show = true;
|
97
|
-
}
|
98
|
-
}
|
99
|
-
|
100
|
-
// set radius
|
101
|
-
|
102
|
-
if (options.series.pie.radius == "auto") {
|
103
|
-
if (options.series.pie.label.show) {
|
104
|
-
options.series.pie.radius = 3/4;
|
105
|
-
} else {
|
106
|
-
options.series.pie.radius = 1;
|
107
|
-
}
|
108
|
-
}
|
109
|
-
|
110
|
-
// ensure sane tilt
|
111
|
-
|
112
|
-
if (options.series.pie.tilt > 1) {
|
113
|
-
options.series.pie.tilt = 1;
|
114
|
-
} else if (options.series.pie.tilt < 0) {
|
115
|
-
options.series.pie.tilt = 0;
|
116
|
-
}
|
117
|
-
}
|
118
|
-
});
|
119
|
-
|
120
|
-
plot.hooks.bindEvents.push(function(plot, eventHolder) {
|
121
|
-
var options = plot.getOptions();
|
122
|
-
if (options.series.pie.show) {
|
123
|
-
if (options.grid.hoverable) {
|
124
|
-
eventHolder.unbind("mousemove").mousemove(onMouseMove);
|
125
|
-
}
|
126
|
-
if (options.grid.clickable) {
|
127
|
-
eventHolder.unbind("click").click(onClick);
|
128
|
-
}
|
129
|
-
}
|
130
|
-
});
|
131
|
-
|
132
|
-
plot.hooks.processDatapoints.push(function(plot, series, data, datapoints) {
|
133
|
-
var options = plot.getOptions();
|
134
|
-
if (options.series.pie.show) {
|
135
|
-
processDatapoints(plot, series, data, datapoints);
|
136
|
-
}
|
137
|
-
});
|
138
|
-
|
139
|
-
plot.hooks.drawOverlay.push(function(plot, octx) {
|
140
|
-
var options = plot.getOptions();
|
141
|
-
if (options.series.pie.show) {
|
142
|
-
drawOverlay(plot, octx);
|
143
|
-
}
|
144
|
-
});
|
145
|
-
|
146
|
-
plot.hooks.draw.push(function(plot, newCtx) {
|
147
|
-
var options = plot.getOptions();
|
148
|
-
if (options.series.pie.show) {
|
149
|
-
draw(plot, newCtx);
|
150
|
-
}
|
151
|
-
});
|
152
|
-
|
153
|
-
function processDatapoints(plot, series, datapoints) {
|
154
|
-
if (!processed) {
|
155
|
-
processed = true;
|
156
|
-
canvas = plot.getCanvas();
|
157
|
-
target = $(canvas).parent();
|
158
|
-
options = plot.getOptions();
|
159
|
-
plot.setData(combine(plot.getData()));
|
160
|
-
}
|
161
|
-
}
|
162
|
-
|
163
|
-
function combine(data) {
|
164
|
-
|
165
|
-
var total = 0,
|
166
|
-
combined = 0,
|
167
|
-
numCombined = 0,
|
168
|
-
color = options.series.pie.combine.color,
|
169
|
-
newdata = [];
|
170
|
-
|
171
|
-
// Fix up the raw data from Flot, ensuring the data is numeric
|
172
|
-
|
173
|
-
for (var i = 0; i < data.length; ++i) {
|
174
|
-
|
175
|
-
var value = data[i].data;
|
176
|
-
|
177
|
-
// If the data is an array, we'll assume that it's a standard
|
178
|
-
// Flot x-y pair, and are concerned only with the second value.
|
179
|
-
|
180
|
-
// Note how we use the original array, rather than creating a
|
181
|
-
// new one; this is more efficient and preserves any extra data
|
182
|
-
// that the user may have stored in higher indexes.
|
183
|
-
|
184
|
-
if ($.isArray(value) && value.length == 1) {
|
185
|
-
value = value[0];
|
186
|
-
}
|
187
|
-
|
188
|
-
if ($.isArray(value)) {
|
189
|
-
// Equivalent to $.isNumeric() but compatible with jQuery < 1.7
|
190
|
-
if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) {
|
191
|
-
value[1] = +value[1];
|
192
|
-
} else {
|
193
|
-
value[1] = 0;
|
194
|
-
}
|
195
|
-
} else if (!isNaN(parseFloat(value)) && isFinite(value)) {
|
196
|
-
value = [1, +value];
|
197
|
-
} else {
|
198
|
-
value = [1, 0];
|
199
|
-
}
|
200
|
-
|
201
|
-
data[i].data = [value];
|
202
|
-
}
|
203
|
-
|
204
|
-
// Sum up all the slices, so we can calculate percentages for each
|
205
|
-
|
206
|
-
for (var i = 0; i < data.length; ++i) {
|
207
|
-
total += data[i].data[0][1];
|
208
|
-
}
|
209
|
-
|
210
|
-
// Count the number of slices with percentages below the combine
|
211
|
-
// threshold; if it turns out to be just one, we won't combine.
|
212
|
-
|
213
|
-
for (var i = 0; i < data.length; ++i) {
|
214
|
-
var value = data[i].data[0][1];
|
215
|
-
if (value / total <= options.series.pie.combine.threshold) {
|
216
|
-
combined += value;
|
217
|
-
numCombined++;
|
218
|
-
if (!color) {
|
219
|
-
color = data[i].color;
|
220
|
-
}
|
221
|
-
}
|
222
|
-
}
|
223
|
-
|
224
|
-
for (var i = 0; i < data.length; ++i) {
|
225
|
-
var value = data[i].data[0][1];
|
226
|
-
if (numCombined < 2 || value / total > options.series.pie.combine.threshold) {
|
227
|
-
newdata.push(
|
228
|
-
$.extend(data[i], { /* extend to allow keeping all other original data values
|
229
|
-
and using them e.g. in labelFormatter. */
|
230
|
-
data: [[1, value]],
|
231
|
-
color: data[i].color,
|
232
|
-
label: data[i].label,
|
233
|
-
angle: value * Math.PI * 2 / total,
|
234
|
-
percent: value / (total / 100)
|
235
|
-
})
|
236
|
-
);
|
237
|
-
}
|
238
|
-
}
|
239
|
-
|
240
|
-
if (numCombined > 1) {
|
241
|
-
newdata.push({
|
242
|
-
data: [[1, combined]],
|
243
|
-
color: color,
|
244
|
-
label: options.series.pie.combine.label,
|
245
|
-
angle: combined * Math.PI * 2 / total,
|
246
|
-
percent: combined / (total / 100)
|
247
|
-
});
|
248
|
-
}
|
249
|
-
|
250
|
-
return newdata;
|
251
|
-
}
|
252
|
-
|
253
|
-
function draw(plot, newCtx) {
|
254
|
-
|
255
|
-
if (!target) {
|
256
|
-
return; // if no series were passed
|
257
|
-
}
|
258
|
-
|
259
|
-
var canvasWidth = plot.getPlaceholder().width(),
|
260
|
-
canvasHeight = plot.getPlaceholder().height(),
|
261
|
-
legendWidth = target.children().filter(".legend").children().width() || 0;
|
262
|
-
|
263
|
-
ctx = newCtx;
|
264
|
-
|
265
|
-
// WARNING: HACK! REWRITE THIS CODE AS SOON AS POSSIBLE!
|
266
|
-
|
267
|
-
// When combining smaller slices into an 'other' slice, we need to
|
268
|
-
// add a new series. Since Flot gives plugins no way to modify the
|
269
|
-
// list of series, the pie plugin uses a hack where the first call
|
270
|
-
// to processDatapoints results in a call to setData with the new
|
271
|
-
// list of series, then subsequent processDatapoints do nothing.
|
272
|
-
|
273
|
-
// The plugin-global 'processed' flag is used to control this hack;
|
274
|
-
// it starts out false, and is set to true after the first call to
|
275
|
-
// processDatapoints.
|
276
|
-
|
277
|
-
// Unfortunately this turns future setData calls into no-ops; they
|
278
|
-
// call processDatapoints, the flag is true, and nothing happens.
|
279
|
-
|
280
|
-
// To fix this we'll set the flag back to false here in draw, when
|
281
|
-
// all series have been processed, so the next sequence of calls to
|
282
|
-
// processDatapoints once again starts out with a slice-combine.
|
283
|
-
// This is really a hack; in 0.9 we need to give plugins a proper
|
284
|
-
// way to modify series before any processing begins.
|
285
|
-
|
286
|
-
processed = false;
|
287
|
-
|
288
|
-
// calculate maximum radius and center point
|
289
|
-
|
290
|
-
maxRadius = Math.min(canvasWidth, canvasHeight / options.series.pie.tilt) / 2;
|
291
|
-
centerTop = canvasHeight / 2 + options.series.pie.offset.top;
|
292
|
-
centerLeft = canvasWidth / 2;
|
293
|
-
|
294
|
-
if (options.series.pie.offset.left == "auto") {
|
295
|
-
if (options.legend.position.match("w")) {
|
296
|
-
centerLeft += legendWidth / 2;
|
297
|
-
} else {
|
298
|
-
centerLeft -= legendWidth / 2;
|
299
|
-
}
|
300
|
-
if (centerLeft < maxRadius) {
|
301
|
-
centerLeft = maxRadius;
|
302
|
-
} else if (centerLeft > canvasWidth - maxRadius) {
|
303
|
-
centerLeft = canvasWidth - maxRadius;
|
304
|
-
}
|
305
|
-
} else {
|
306
|
-
centerLeft += options.series.pie.offset.left;
|
307
|
-
}
|
308
|
-
|
309
|
-
var slices = plot.getData(),
|
310
|
-
attempts = 0;
|
311
|
-
|
312
|
-
// Keep shrinking the pie's radius until drawPie returns true,
|
313
|
-
// indicating that all the labels fit, or we try too many times.
|
314
|
-
|
315
|
-
do {
|
316
|
-
if (attempts > 0) {
|
317
|
-
maxRadius *= REDRAW_SHRINK;
|
318
|
-
}
|
319
|
-
attempts += 1;
|
320
|
-
clear();
|
321
|
-
if (options.series.pie.tilt <= 0.8) {
|
322
|
-
drawShadow();
|
323
|
-
}
|
324
|
-
} while (!drawPie() && attempts < REDRAW_ATTEMPTS)
|
325
|
-
|
326
|
-
if (attempts >= REDRAW_ATTEMPTS) {
|
327
|
-
clear();
|
328
|
-
target.prepend("<div class='error'>Could not draw pie with labels contained inside canvas</div>");
|
329
|
-
}
|
330
|
-
|
331
|
-
if (plot.setSeries && plot.insertLegend) {
|
332
|
-
plot.setSeries(slices);
|
333
|
-
plot.insertLegend();
|
334
|
-
}
|
335
|
-
|
336
|
-
// we're actually done at this point, just defining internal functions at this point
|
337
|
-
|
338
|
-
function clear() {
|
339
|
-
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
|
340
|
-
target.children().filter(".pieLabel, .pieLabelBackground").remove();
|
341
|
-
}
|
342
|
-
|
343
|
-
function drawShadow() {
|
344
|
-
|
345
|
-
var shadowLeft = options.series.pie.shadow.left;
|
346
|
-
var shadowTop = options.series.pie.shadow.top;
|
347
|
-
var edge = 10;
|
348
|
-
var alpha = options.series.pie.shadow.alpha;
|
349
|
-
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
350
|
-
|
351
|
-
if (radius >= canvasWidth / 2 - shadowLeft || radius * options.series.pie.tilt >= canvasHeight / 2 - shadowTop || radius <= edge) {
|
352
|
-
return; // shadow would be outside canvas, so don't draw it
|
353
|
-
}
|
354
|
-
|
355
|
-
ctx.save();
|
356
|
-
ctx.translate(shadowLeft,shadowTop);
|
357
|
-
ctx.globalAlpha = alpha;
|
358
|
-
ctx.fillStyle = "#000";
|
359
|
-
|
360
|
-
// center and rotate to starting position
|
361
|
-
|
362
|
-
ctx.translate(centerLeft,centerTop);
|
363
|
-
ctx.scale(1, options.series.pie.tilt);
|
364
|
-
|
365
|
-
//radius -= edge;
|
366
|
-
|
367
|
-
for (var i = 1; i <= edge; i++) {
|
368
|
-
ctx.beginPath();
|
369
|
-
ctx.arc(0, 0, radius, 0, Math.PI * 2, false);
|
370
|
-
ctx.fill();
|
371
|
-
radius -= i;
|
372
|
-
}
|
373
|
-
|
374
|
-
ctx.restore();
|
375
|
-
}
|
376
|
-
|
377
|
-
function drawPie() {
|
378
|
-
|
379
|
-
var startAngle = Math.PI * options.series.pie.startAngle;
|
380
|
-
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
381
|
-
|
382
|
-
// center and rotate to starting position
|
383
|
-
|
384
|
-
ctx.save();
|
385
|
-
ctx.translate(centerLeft,centerTop);
|
386
|
-
ctx.scale(1, options.series.pie.tilt);
|
387
|
-
//ctx.rotate(startAngle); // start at top; -- This doesn't work properly in Opera
|
388
|
-
|
389
|
-
// draw slices
|
390
|
-
|
391
|
-
ctx.save();
|
392
|
-
var currentAngle = startAngle;
|
393
|
-
for (var i = 0; i < slices.length; ++i) {
|
394
|
-
slices[i].startAngle = currentAngle;
|
395
|
-
drawSlice(slices[i].angle, slices[i].color, true);
|
396
|
-
}
|
397
|
-
ctx.restore();
|
398
|
-
|
399
|
-
// draw slice outlines
|
400
|
-
|
401
|
-
if (options.series.pie.stroke.width > 0) {
|
402
|
-
ctx.save();
|
403
|
-
ctx.lineWidth = options.series.pie.stroke.width;
|
404
|
-
currentAngle = startAngle;
|
405
|
-
for (var i = 0; i < slices.length; ++i) {
|
406
|
-
drawSlice(slices[i].angle, options.series.pie.stroke.color, false);
|
407
|
-
}
|
408
|
-
ctx.restore();
|
409
|
-
}
|
410
|
-
|
411
|
-
// draw donut hole
|
412
|
-
|
413
|
-
drawDonutHole(ctx);
|
414
|
-
|
415
|
-
ctx.restore();
|
416
|
-
|
417
|
-
// Draw the labels, returning true if they fit within the plot
|
418
|
-
|
419
|
-
if (options.series.pie.label.show) {
|
420
|
-
return drawLabels();
|
421
|
-
} else return true;
|
422
|
-
|
423
|
-
function drawSlice(angle, color, fill) {
|
424
|
-
|
425
|
-
if (angle <= 0 || isNaN(angle)) {
|
426
|
-
return;
|
427
|
-
}
|
428
|
-
|
429
|
-
if (fill) {
|
430
|
-
ctx.fillStyle = color;
|
431
|
-
} else {
|
432
|
-
ctx.strokeStyle = color;
|
433
|
-
ctx.lineJoin = "round";
|
434
|
-
}
|
435
|
-
|
436
|
-
ctx.beginPath();
|
437
|
-
if (Math.abs(angle - Math.PI * 2) > 0.000000001) {
|
438
|
-
ctx.moveTo(0, 0); // Center of the pie
|
439
|
-
}
|
440
|
-
|
441
|
-
//ctx.arc(0, 0, radius, 0, angle, false); // This doesn't work properly in Opera
|
442
|
-
ctx.arc(0, 0, radius,currentAngle, currentAngle + angle / 2, false);
|
443
|
-
ctx.arc(0, 0, radius,currentAngle + angle / 2, currentAngle + angle, false);
|
444
|
-
ctx.closePath();
|
445
|
-
//ctx.rotate(angle); // This doesn't work properly in Opera
|
446
|
-
currentAngle += angle;
|
447
|
-
|
448
|
-
if (fill) {
|
449
|
-
ctx.fill();
|
450
|
-
} else {
|
451
|
-
ctx.stroke();
|
452
|
-
}
|
453
|
-
}
|
454
|
-
|
455
|
-
function drawLabels() {
|
456
|
-
|
457
|
-
var currentAngle = startAngle;
|
458
|
-
var radius = options.series.pie.label.radius > 1 ? options.series.pie.label.radius : maxRadius * options.series.pie.label.radius;
|
459
|
-
|
460
|
-
for (var i = 0; i < slices.length; ++i) {
|
461
|
-
if (slices[i].percent >= options.series.pie.label.threshold * 100) {
|
462
|
-
if (!drawLabel(slices[i], currentAngle, i)) {
|
463
|
-
return false;
|
464
|
-
}
|
465
|
-
}
|
466
|
-
currentAngle += slices[i].angle;
|
467
|
-
}
|
468
|
-
|
469
|
-
return true;
|
470
|
-
|
471
|
-
function drawLabel(slice, startAngle, index) {
|
472
|
-
|
473
|
-
if (slice.data[0][1] == 0) {
|
474
|
-
return true;
|
475
|
-
}
|
476
|
-
|
477
|
-
// format label text
|
478
|
-
|
479
|
-
var lf = options.legend.labelFormatter, text, plf = options.series.pie.label.formatter;
|
480
|
-
|
481
|
-
if (lf) {
|
482
|
-
text = lf(slice.label, slice);
|
483
|
-
} else {
|
484
|
-
text = slice.label;
|
485
|
-
}
|
486
|
-
|
487
|
-
if (plf) {
|
488
|
-
text = plf(text, slice);
|
489
|
-
}
|
490
|
-
|
491
|
-
var halfAngle = ((startAngle + slice.angle) + startAngle) / 2;
|
492
|
-
var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);
|
493
|
-
var y = centerTop + Math.round(Math.sin(halfAngle) * radius) * options.series.pie.tilt;
|
494
|
-
|
495
|
-
var html = "<span class='pieLabel' id='pieLabel" + index + "' style='position:absolute;top:" + y + "px;left:" + x + "px;'>" + text + "</span>";
|
496
|
-
target.append(html);
|
497
|
-
|
498
|
-
var label = target.children("#pieLabel" + index);
|
499
|
-
var labelTop = (y - label.height() / 2);
|
500
|
-
var labelLeft = (x - label.width() / 2);
|
501
|
-
|
502
|
-
label.css("top", labelTop);
|
503
|
-
label.css("left", labelLeft);
|
504
|
-
|
505
|
-
// check to make sure that the label is not outside the canvas
|
506
|
-
|
507
|
-
if (0 - labelTop > 0 || 0 - labelLeft > 0 || canvasHeight - (labelTop + label.height()) < 0 || canvasWidth - (labelLeft + label.width()) < 0) {
|
508
|
-
return false;
|
509
|
-
}
|
510
|
-
|
511
|
-
if (options.series.pie.label.background.opacity != 0) {
|
512
|
-
|
513
|
-
// put in the transparent background separately to avoid blended labels and label boxes
|
514
|
-
|
515
|
-
var c = options.series.pie.label.background.color;
|
516
|
-
|
517
|
-
if (c == null) {
|
518
|
-
c = slice.color;
|
519
|
-
}
|
520
|
-
|
521
|
-
var pos = "top:" + labelTop + "px;left:" + labelLeft + "px;";
|
522
|
-
$("<div class='pieLabelBackground' style='position:absolute;width:" + label.width() + "px;height:" + label.height() + "px;" + pos + "background-color:" + c + ";'></div>")
|
523
|
-
.css("opacity", options.series.pie.label.background.opacity)
|
524
|
-
.insertBefore(label);
|
525
|
-
}
|
526
|
-
|
527
|
-
return true;
|
528
|
-
} // end individual label function
|
529
|
-
} // end drawLabels function
|
530
|
-
} // end drawPie function
|
531
|
-
} // end draw function
|
532
|
-
|
533
|
-
// Placed here because it needs to be accessed from multiple locations
|
534
|
-
|
535
|
-
function drawDonutHole(layer) {
|
536
|
-
if (options.series.pie.innerRadius > 0) {
|
537
|
-
|
538
|
-
// subtract the center
|
539
|
-
|
540
|
-
layer.save();
|
541
|
-
var innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;
|
542
|
-
layer.globalCompositeOperation = "destination-out"; // this does not work with excanvas, but it will fall back to using the stroke color
|
543
|
-
layer.beginPath();
|
544
|
-
layer.fillStyle = options.series.pie.stroke.color;
|
545
|
-
layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
|
546
|
-
layer.fill();
|
547
|
-
layer.closePath();
|
548
|
-
layer.restore();
|
549
|
-
|
550
|
-
// add inner stroke
|
551
|
-
|
552
|
-
layer.save();
|
553
|
-
layer.beginPath();
|
554
|
-
layer.strokeStyle = options.series.pie.stroke.color;
|
555
|
-
layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
|
556
|
-
layer.stroke();
|
557
|
-
layer.closePath();
|
558
|
-
layer.restore();
|
559
|
-
|
560
|
-
// TODO: add extra shadow inside hole (with a mask) if the pie is tilted.
|
561
|
-
}
|
562
|
-
}
|
563
|
-
|
564
|
-
//-- Additional Interactive related functions --
|
565
|
-
|
566
|
-
function isPointInPoly(poly, pt) {
|
567
|
-
for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
|
568
|
-
((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || (poly[j][1] <= pt[1] && pt[1]< poly[i][1]))
|
569
|
-
&& (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0])
|
570
|
-
&& (c = !c);
|
571
|
-
return c;
|
572
|
-
}
|
573
|
-
|
574
|
-
function findNearbySlice(mouseX, mouseY) {
|
575
|
-
|
576
|
-
var slices = plot.getData(),
|
577
|
-
options = plot.getOptions(),
|
578
|
-
radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius,
|
579
|
-
x, y;
|
580
|
-
|
581
|
-
for (var i = 0; i < slices.length; ++i) {
|
582
|
-
|
583
|
-
var s = slices[i];
|
584
|
-
|
585
|
-
if (s.pie.show) {
|
586
|
-
|
587
|
-
ctx.save();
|
588
|
-
ctx.beginPath();
|
589
|
-
ctx.moveTo(0, 0); // Center of the pie
|
590
|
-
//ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.
|
591
|
-
ctx.arc(0, 0, radius, s.startAngle, s.startAngle + s.angle / 2, false);
|
592
|
-
ctx.arc(0, 0, radius, s.startAngle + s.angle / 2, s.startAngle + s.angle, false);
|
593
|
-
ctx.closePath();
|
594
|
-
x = mouseX - centerLeft;
|
595
|
-
y = mouseY - centerTop;
|
596
|
-
|
597
|
-
if (ctx.isPointInPath) {
|
598
|
-
if (ctx.isPointInPath(mouseX - centerLeft, mouseY - centerTop)) {
|
599
|
-
ctx.restore();
|
600
|
-
return {
|
601
|
-
datapoint: [s.percent, s.data],
|
602
|
-
dataIndex: 0,
|
603
|
-
series: s,
|
604
|
-
seriesIndex: i
|
605
|
-
};
|
606
|
-
}
|
607
|
-
} else {
|
608
|
-
|
609
|
-
// excanvas for IE doesn;t support isPointInPath, this is a workaround.
|
610
|
-
|
611
|
-
var p1X = radius * Math.cos(s.startAngle),
|
612
|
-
p1Y = radius * Math.sin(s.startAngle),
|
613
|
-
p2X = radius * Math.cos(s.startAngle + s.angle / 4),
|
614
|
-
p2Y = radius * Math.sin(s.startAngle + s.angle / 4),
|
615
|
-
p3X = radius * Math.cos(s.startAngle + s.angle / 2),
|
616
|
-
p3Y = radius * Math.sin(s.startAngle + s.angle / 2),
|
617
|
-
p4X = radius * Math.cos(s.startAngle + s.angle / 1.5),
|
618
|
-
p4Y = radius * Math.sin(s.startAngle + s.angle / 1.5),
|
619
|
-
p5X = radius * Math.cos(s.startAngle + s.angle),
|
620
|
-
p5Y = radius * Math.sin(s.startAngle + s.angle),
|
621
|
-
arrPoly = [[0, 0], [p1X, p1Y], [p2X, p2Y], [p3X, p3Y], [p4X, p4Y], [p5X, p5Y]],
|
622
|
-
arrPoint = [x, y];
|
623
|
-
|
624
|
-
// TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?
|
625
|
-
|
626
|
-
if (isPointInPoly(arrPoly, arrPoint)) {
|
627
|
-
ctx.restore();
|
628
|
-
return {
|
629
|
-
datapoint: [s.percent, s.data],
|
630
|
-
dataIndex: 0,
|
631
|
-
series: s,
|
632
|
-
seriesIndex: i
|
633
|
-
};
|
634
|
-
}
|
635
|
-
}
|
636
|
-
|
637
|
-
ctx.restore();
|
638
|
-
}
|
639
|
-
}
|
640
|
-
|
641
|
-
return null;
|
642
|
-
}
|
643
|
-
|
644
|
-
function onMouseMove(e) {
|
645
|
-
triggerClickHoverEvent("plothover", e);
|
646
|
-
}
|
647
|
-
|
648
|
-
function onClick(e) {
|
649
|
-
triggerClickHoverEvent("plotclick", e);
|
650
|
-
}
|
651
|
-
|
652
|
-
// trigger click or hover event (they send the same parameters so we share their code)
|
653
|
-
|
654
|
-
function triggerClickHoverEvent(eventname, e) {
|
655
|
-
|
656
|
-
var offset = plot.offset();
|
657
|
-
var canvasX = parseInt(e.pageX - offset.left);
|
658
|
-
var canvasY = parseInt(e.pageY - offset.top);
|
659
|
-
var item = findNearbySlice(canvasX, canvasY);
|
660
|
-
|
661
|
-
if (options.grid.autoHighlight) {
|
662
|
-
|
663
|
-
// clear auto-highlights
|
664
|
-
|
665
|
-
for (var i = 0; i < highlights.length; ++i) {
|
666
|
-
var h = highlights[i];
|
667
|
-
if (h.auto == eventname && !(item && h.series == item.series)) {
|
668
|
-
unhighlight(h.series);
|
669
|
-
}
|
670
|
-
}
|
671
|
-
}
|
672
|
-
|
673
|
-
// highlight the slice
|
674
|
-
|
675
|
-
if (item) {
|
676
|
-
highlight(item.series, eventname);
|
677
|
-
}
|
678
|
-
|
679
|
-
// trigger any hover bind events
|
680
|
-
|
681
|
-
var pos = { pageX: e.pageX, pageY: e.pageY };
|
682
|
-
target.trigger(eventname, [pos, item]);
|
683
|
-
}
|
684
|
-
|
685
|
-
function highlight(s, auto) {
|
686
|
-
//if (typeof s == "number") {
|
687
|
-
// s = series[s];
|
688
|
-
//}
|
689
|
-
|
690
|
-
var i = indexOfHighlight(s);
|
691
|
-
|
692
|
-
if (i == -1) {
|
693
|
-
highlights.push({ series: s, auto: auto });
|
694
|
-
plot.triggerRedrawOverlay();
|
695
|
-
} else if (!auto) {
|
696
|
-
highlights[i].auto = false;
|
697
|
-
}
|
698
|
-
}
|
699
|
-
|
700
|
-
function unhighlight(s) {
|
701
|
-
if (s == null) {
|
702
|
-
highlights = [];
|
703
|
-
plot.triggerRedrawOverlay();
|
704
|
-
}
|
705
|
-
|
706
|
-
//if (typeof s == "number") {
|
707
|
-
// s = series[s];
|
708
|
-
//}
|
709
|
-
|
710
|
-
var i = indexOfHighlight(s);
|
711
|
-
|
712
|
-
if (i != -1) {
|
713
|
-
highlights.splice(i, 1);
|
714
|
-
plot.triggerRedrawOverlay();
|
715
|
-
}
|
716
|
-
}
|
717
|
-
|
718
|
-
function indexOfHighlight(s) {
|
719
|
-
for (var i = 0; i < highlights.length; ++i) {
|
720
|
-
var h = highlights[i];
|
721
|
-
if (h.series == s)
|
722
|
-
return i;
|
723
|
-
}
|
724
|
-
return -1;
|
725
|
-
}
|
726
|
-
|
727
|
-
function drawOverlay(plot, octx) {
|
728
|
-
|
729
|
-
var options = plot.getOptions();
|
730
|
-
|
731
|
-
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
732
|
-
|
733
|
-
octx.save();
|
734
|
-
octx.translate(centerLeft, centerTop);
|
735
|
-
octx.scale(1, options.series.pie.tilt);
|
736
|
-
|
737
|
-
for (var i = 0; i < highlights.length; ++i) {
|
738
|
-
drawHighlight(highlights[i].series);
|
739
|
-
}
|
740
|
-
|
741
|
-
drawDonutHole(octx);
|
742
|
-
|
743
|
-
octx.restore();
|
744
|
-
|
745
|
-
function drawHighlight(series) {
|
746
|
-
|
747
|
-
if (series.angle <= 0 || isNaN(series.angle)) {
|
748
|
-
return;
|
749
|
-
}
|
750
|
-
|
751
|
-
//octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();
|
752
|
-
octx.fillStyle = "rgba(255, 255, 255, " + options.series.pie.highlight.opacity + ")"; // this is temporary until we have access to parseColor
|
753
|
-
octx.beginPath();
|
754
|
-
if (Math.abs(series.angle - Math.PI * 2) > 0.000000001) {
|
755
|
-
octx.moveTo(0, 0); // Center of the pie
|
756
|
-
}
|
757
|
-
octx.arc(0, 0, radius, series.startAngle, series.startAngle + series.angle / 2, false);
|
758
|
-
octx.arc(0, 0, radius, series.startAngle + series.angle / 2, series.startAngle + series.angle, false);
|
759
|
-
octx.closePath();
|
760
|
-
octx.fill();
|
761
|
-
}
|
762
|
-
}
|
763
|
-
} // end init (plugin body)
|
764
|
-
|
765
|
-
// define pie specific options and their default values
|
766
|
-
|
767
|
-
var options = {
|
768
|
-
series: {
|
769
|
-
pie: {
|
770
|
-
show: false,
|
771
|
-
radius: "auto", // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)
|
772
|
-
innerRadius: 0, /* for donut */
|
773
|
-
startAngle: 3/2,
|
774
|
-
tilt: 1,
|
775
|
-
shadow: {
|
776
|
-
left: 5, // shadow left offset
|
777
|
-
top: 15, // shadow top offset
|
778
|
-
alpha: 0.02 // shadow alpha
|
779
|
-
},
|
780
|
-
offset: {
|
781
|
-
top: 0,
|
782
|
-
left: "auto"
|
783
|
-
},
|
784
|
-
stroke: {
|
785
|
-
color: "#fff",
|
786
|
-
width: 1
|
787
|
-
},
|
788
|
-
label: {
|
789
|
-
show: "auto",
|
790
|
-
formatter: function(label, slice) {
|
791
|
-
return "<div style='font-size:x-small;text-align:center;padding:2px;color:" + slice.color + ";'>" + label + "<br/>" + Math.round(slice.percent) + "%</div>";
|
792
|
-
}, // formatter function
|
793
|
-
radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)
|
794
|
-
background: {
|
795
|
-
color: null,
|
796
|
-
opacity: 0
|
797
|
-
},
|
798
|
-
threshold: 0 // percentage at which to hide the label (i.e. the slice is too narrow)
|
799
|
-
},
|
800
|
-
combine: {
|
801
|
-
threshold: -1, // percentage at which to combine little slices into one larger slice
|
802
|
-
color: null, // color to give the new slice (auto-generated if null)
|
803
|
-
label: "Other" // label to give the new slice
|
804
|
-
},
|
805
|
-
highlight: {
|
806
|
-
//color: "#fff", // will add this functionality once parseColor is available
|
807
|
-
opacity: 0.5
|
808
|
-
}
|
809
|
-
}
|
810
|
-
}
|
811
|
-
};
|
812
|
-
|
813
|
-
$.plot.plugins.push({
|
814
|
-
init: init,
|
815
|
-
options: options,
|
816
|
-
name: "pie",
|
817
|
-
version: "1.1"
|
818
|
-
});
|
819
|
-
|
820
|
-
})(jQuery);
|
1
|
+
/* Flot plugin for rendering pie charts.
|
2
|
+
|
3
|
+
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
4
|
+
Licensed under the MIT license.
|
5
|
+
|
6
|
+
The plugin assumes that each series has a single data value, and that each
|
7
|
+
value is a positive integer or zero. Negative numbers don't make sense for a
|
8
|
+
pie chart, and have unpredictable results. The values do NOT need to be
|
9
|
+
passed in as percentages; the plugin will calculate the total and per-slice
|
10
|
+
percentages internally.
|
11
|
+
|
12
|
+
* Created by Brian Medendorp
|
13
|
+
|
14
|
+
* Updated with contributions from btburnett3, Anthony Aragues and Xavi Ivars
|
15
|
+
|
16
|
+
The plugin supports these options:
|
17
|
+
|
18
|
+
series: {
|
19
|
+
pie: {
|
20
|
+
show: true/false
|
21
|
+
radius: 0-1 for percentage of fullsize, or a specified pixel length, or 'auto'
|
22
|
+
innerRadius: 0-1 for percentage of fullsize or a specified pixel length, for creating a donut effect
|
23
|
+
startAngle: 0-2 factor of PI used for starting angle (in radians) i.e 3/2 starts at the top, 0 and 2 have the same result
|
24
|
+
tilt: 0-1 for percentage to tilt the pie, where 1 is no tilt, and 0 is completely flat (nothing will show)
|
25
|
+
offset: {
|
26
|
+
top: integer value to move the pie up or down
|
27
|
+
left: integer value to move the pie left or right, or 'auto'
|
28
|
+
},
|
29
|
+
stroke: {
|
30
|
+
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#FFF')
|
31
|
+
width: integer pixel width of the stroke
|
32
|
+
},
|
33
|
+
label: {
|
34
|
+
show: true/false, or 'auto'
|
35
|
+
formatter: a user-defined function that modifies the text/style of the label text
|
36
|
+
radius: 0-1 for percentage of fullsize, or a specified pixel length
|
37
|
+
background: {
|
38
|
+
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#000')
|
39
|
+
opacity: 0-1
|
40
|
+
},
|
41
|
+
threshold: 0-1 for the percentage value at which to hide labels (if they're too small)
|
42
|
+
},
|
43
|
+
combine: {
|
44
|
+
threshold: 0-1 for the percentage value at which to combine slices (if they're too small)
|
45
|
+
color: any hexidecimal color value (other formats may or may not work, so best to stick with something like '#CCC'), if null, the plugin will automatically use the color of the first slice to be combined
|
46
|
+
label: any text value of what the combined slice should be labeled
|
47
|
+
}
|
48
|
+
highlight: {
|
49
|
+
opacity: 0-1
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
|
54
|
+
More detail and specific examples can be found in the included HTML file.
|
55
|
+
|
56
|
+
*/
|
57
|
+
|
58
|
+
(function($) {
|
59
|
+
|
60
|
+
// Maximum redraw attempts when fitting labels within the plot
|
61
|
+
|
62
|
+
var REDRAW_ATTEMPTS = 10;
|
63
|
+
|
64
|
+
// Factor by which to shrink the pie when fitting labels within the plot
|
65
|
+
|
66
|
+
var REDRAW_SHRINK = 0.95;
|
67
|
+
|
68
|
+
function init(plot) {
|
69
|
+
|
70
|
+
var canvas = null,
|
71
|
+
target = null,
|
72
|
+
options = null,
|
73
|
+
maxRadius = null,
|
74
|
+
centerLeft = null,
|
75
|
+
centerTop = null,
|
76
|
+
processed = false,
|
77
|
+
ctx = null;
|
78
|
+
|
79
|
+
// interactive variables
|
80
|
+
|
81
|
+
var highlights = [];
|
82
|
+
|
83
|
+
// add hook to determine if pie plugin in enabled, and then perform necessary operations
|
84
|
+
|
85
|
+
plot.hooks.processOptions.push(function(plot, options) {
|
86
|
+
if (options.series.pie.show) {
|
87
|
+
|
88
|
+
options.grid.show = false;
|
89
|
+
|
90
|
+
// set labels.show
|
91
|
+
|
92
|
+
if (options.series.pie.label.show == "auto") {
|
93
|
+
if (options.legend.show) {
|
94
|
+
options.series.pie.label.show = false;
|
95
|
+
} else {
|
96
|
+
options.series.pie.label.show = true;
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
// set radius
|
101
|
+
|
102
|
+
if (options.series.pie.radius == "auto") {
|
103
|
+
if (options.series.pie.label.show) {
|
104
|
+
options.series.pie.radius = 3/4;
|
105
|
+
} else {
|
106
|
+
options.series.pie.radius = 1;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
// ensure sane tilt
|
111
|
+
|
112
|
+
if (options.series.pie.tilt > 1) {
|
113
|
+
options.series.pie.tilt = 1;
|
114
|
+
} else if (options.series.pie.tilt < 0) {
|
115
|
+
options.series.pie.tilt = 0;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
});
|
119
|
+
|
120
|
+
plot.hooks.bindEvents.push(function(plot, eventHolder) {
|
121
|
+
var options = plot.getOptions();
|
122
|
+
if (options.series.pie.show) {
|
123
|
+
if (options.grid.hoverable) {
|
124
|
+
eventHolder.unbind("mousemove").mousemove(onMouseMove);
|
125
|
+
}
|
126
|
+
if (options.grid.clickable) {
|
127
|
+
eventHolder.unbind("click").click(onClick);
|
128
|
+
}
|
129
|
+
}
|
130
|
+
});
|
131
|
+
|
132
|
+
plot.hooks.processDatapoints.push(function(plot, series, data, datapoints) {
|
133
|
+
var options = plot.getOptions();
|
134
|
+
if (options.series.pie.show) {
|
135
|
+
processDatapoints(plot, series, data, datapoints);
|
136
|
+
}
|
137
|
+
});
|
138
|
+
|
139
|
+
plot.hooks.drawOverlay.push(function(plot, octx) {
|
140
|
+
var options = plot.getOptions();
|
141
|
+
if (options.series.pie.show) {
|
142
|
+
drawOverlay(plot, octx);
|
143
|
+
}
|
144
|
+
});
|
145
|
+
|
146
|
+
plot.hooks.draw.push(function(plot, newCtx) {
|
147
|
+
var options = plot.getOptions();
|
148
|
+
if (options.series.pie.show) {
|
149
|
+
draw(plot, newCtx);
|
150
|
+
}
|
151
|
+
});
|
152
|
+
|
153
|
+
function processDatapoints(plot, series, datapoints) {
|
154
|
+
if (!processed) {
|
155
|
+
processed = true;
|
156
|
+
canvas = plot.getCanvas();
|
157
|
+
target = $(canvas).parent();
|
158
|
+
options = plot.getOptions();
|
159
|
+
plot.setData(combine(plot.getData()));
|
160
|
+
}
|
161
|
+
}
|
162
|
+
|
163
|
+
function combine(data) {
|
164
|
+
|
165
|
+
var total = 0,
|
166
|
+
combined = 0,
|
167
|
+
numCombined = 0,
|
168
|
+
color = options.series.pie.combine.color,
|
169
|
+
newdata = [];
|
170
|
+
|
171
|
+
// Fix up the raw data from Flot, ensuring the data is numeric
|
172
|
+
|
173
|
+
for (var i = 0; i < data.length; ++i) {
|
174
|
+
|
175
|
+
var value = data[i].data;
|
176
|
+
|
177
|
+
// If the data is an array, we'll assume that it's a standard
|
178
|
+
// Flot x-y pair, and are concerned only with the second value.
|
179
|
+
|
180
|
+
// Note how we use the original array, rather than creating a
|
181
|
+
// new one; this is more efficient and preserves any extra data
|
182
|
+
// that the user may have stored in higher indexes.
|
183
|
+
|
184
|
+
if ($.isArray(value) && value.length == 1) {
|
185
|
+
value = value[0];
|
186
|
+
}
|
187
|
+
|
188
|
+
if ($.isArray(value)) {
|
189
|
+
// Equivalent to $.isNumeric() but compatible with jQuery < 1.7
|
190
|
+
if (!isNaN(parseFloat(value[1])) && isFinite(value[1])) {
|
191
|
+
value[1] = +value[1];
|
192
|
+
} else {
|
193
|
+
value[1] = 0;
|
194
|
+
}
|
195
|
+
} else if (!isNaN(parseFloat(value)) && isFinite(value)) {
|
196
|
+
value = [1, +value];
|
197
|
+
} else {
|
198
|
+
value = [1, 0];
|
199
|
+
}
|
200
|
+
|
201
|
+
data[i].data = [value];
|
202
|
+
}
|
203
|
+
|
204
|
+
// Sum up all the slices, so we can calculate percentages for each
|
205
|
+
|
206
|
+
for (var i = 0; i < data.length; ++i) {
|
207
|
+
total += data[i].data[0][1];
|
208
|
+
}
|
209
|
+
|
210
|
+
// Count the number of slices with percentages below the combine
|
211
|
+
// threshold; if it turns out to be just one, we won't combine.
|
212
|
+
|
213
|
+
for (var i = 0; i < data.length; ++i) {
|
214
|
+
var value = data[i].data[0][1];
|
215
|
+
if (value / total <= options.series.pie.combine.threshold) {
|
216
|
+
combined += value;
|
217
|
+
numCombined++;
|
218
|
+
if (!color) {
|
219
|
+
color = data[i].color;
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
|
+
|
224
|
+
for (var i = 0; i < data.length; ++i) {
|
225
|
+
var value = data[i].data[0][1];
|
226
|
+
if (numCombined < 2 || value / total > options.series.pie.combine.threshold) {
|
227
|
+
newdata.push(
|
228
|
+
$.extend(data[i], { /* extend to allow keeping all other original data values
|
229
|
+
and using them e.g. in labelFormatter. */
|
230
|
+
data: [[1, value]],
|
231
|
+
color: data[i].color,
|
232
|
+
label: data[i].label,
|
233
|
+
angle: value * Math.PI * 2 / total,
|
234
|
+
percent: value / (total / 100)
|
235
|
+
})
|
236
|
+
);
|
237
|
+
}
|
238
|
+
}
|
239
|
+
|
240
|
+
if (numCombined > 1) {
|
241
|
+
newdata.push({
|
242
|
+
data: [[1, combined]],
|
243
|
+
color: color,
|
244
|
+
label: options.series.pie.combine.label,
|
245
|
+
angle: combined * Math.PI * 2 / total,
|
246
|
+
percent: combined / (total / 100)
|
247
|
+
});
|
248
|
+
}
|
249
|
+
|
250
|
+
return newdata;
|
251
|
+
}
|
252
|
+
|
253
|
+
function draw(plot, newCtx) {
|
254
|
+
|
255
|
+
if (!target) {
|
256
|
+
return; // if no series were passed
|
257
|
+
}
|
258
|
+
|
259
|
+
var canvasWidth = plot.getPlaceholder().width(),
|
260
|
+
canvasHeight = plot.getPlaceholder().height(),
|
261
|
+
legendWidth = target.children().filter(".legend").children().width() || 0;
|
262
|
+
|
263
|
+
ctx = newCtx;
|
264
|
+
|
265
|
+
// WARNING: HACK! REWRITE THIS CODE AS SOON AS POSSIBLE!
|
266
|
+
|
267
|
+
// When combining smaller slices into an 'other' slice, we need to
|
268
|
+
// add a new series. Since Flot gives plugins no way to modify the
|
269
|
+
// list of series, the pie plugin uses a hack where the first call
|
270
|
+
// to processDatapoints results in a call to setData with the new
|
271
|
+
// list of series, then subsequent processDatapoints do nothing.
|
272
|
+
|
273
|
+
// The plugin-global 'processed' flag is used to control this hack;
|
274
|
+
// it starts out false, and is set to true after the first call to
|
275
|
+
// processDatapoints.
|
276
|
+
|
277
|
+
// Unfortunately this turns future setData calls into no-ops; they
|
278
|
+
// call processDatapoints, the flag is true, and nothing happens.
|
279
|
+
|
280
|
+
// To fix this we'll set the flag back to false here in draw, when
|
281
|
+
// all series have been processed, so the next sequence of calls to
|
282
|
+
// processDatapoints once again starts out with a slice-combine.
|
283
|
+
// This is really a hack; in 0.9 we need to give plugins a proper
|
284
|
+
// way to modify series before any processing begins.
|
285
|
+
|
286
|
+
processed = false;
|
287
|
+
|
288
|
+
// calculate maximum radius and center point
|
289
|
+
|
290
|
+
maxRadius = Math.min(canvasWidth, canvasHeight / options.series.pie.tilt) / 2;
|
291
|
+
centerTop = canvasHeight / 2 + options.series.pie.offset.top;
|
292
|
+
centerLeft = canvasWidth / 2;
|
293
|
+
|
294
|
+
if (options.series.pie.offset.left == "auto") {
|
295
|
+
if (options.legend.position.match("w")) {
|
296
|
+
centerLeft += legendWidth / 2;
|
297
|
+
} else {
|
298
|
+
centerLeft -= legendWidth / 2;
|
299
|
+
}
|
300
|
+
if (centerLeft < maxRadius) {
|
301
|
+
centerLeft = maxRadius;
|
302
|
+
} else if (centerLeft > canvasWidth - maxRadius) {
|
303
|
+
centerLeft = canvasWidth - maxRadius;
|
304
|
+
}
|
305
|
+
} else {
|
306
|
+
centerLeft += options.series.pie.offset.left;
|
307
|
+
}
|
308
|
+
|
309
|
+
var slices = plot.getData(),
|
310
|
+
attempts = 0;
|
311
|
+
|
312
|
+
// Keep shrinking the pie's radius until drawPie returns true,
|
313
|
+
// indicating that all the labels fit, or we try too many times.
|
314
|
+
|
315
|
+
do {
|
316
|
+
if (attempts > 0) {
|
317
|
+
maxRadius *= REDRAW_SHRINK;
|
318
|
+
}
|
319
|
+
attempts += 1;
|
320
|
+
clear();
|
321
|
+
if (options.series.pie.tilt <= 0.8) {
|
322
|
+
drawShadow();
|
323
|
+
}
|
324
|
+
} while (!drawPie() && attempts < REDRAW_ATTEMPTS)
|
325
|
+
|
326
|
+
if (attempts >= REDRAW_ATTEMPTS) {
|
327
|
+
clear();
|
328
|
+
target.prepend("<div class='error'>Could not draw pie with labels contained inside canvas</div>");
|
329
|
+
}
|
330
|
+
|
331
|
+
if (plot.setSeries && plot.insertLegend) {
|
332
|
+
plot.setSeries(slices);
|
333
|
+
plot.insertLegend();
|
334
|
+
}
|
335
|
+
|
336
|
+
// we're actually done at this point, just defining internal functions at this point
|
337
|
+
|
338
|
+
function clear() {
|
339
|
+
ctx.clearRect(0, 0, canvasWidth, canvasHeight);
|
340
|
+
target.children().filter(".pieLabel, .pieLabelBackground").remove();
|
341
|
+
}
|
342
|
+
|
343
|
+
function drawShadow() {
|
344
|
+
|
345
|
+
var shadowLeft = options.series.pie.shadow.left;
|
346
|
+
var shadowTop = options.series.pie.shadow.top;
|
347
|
+
var edge = 10;
|
348
|
+
var alpha = options.series.pie.shadow.alpha;
|
349
|
+
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
350
|
+
|
351
|
+
if (radius >= canvasWidth / 2 - shadowLeft || radius * options.series.pie.tilt >= canvasHeight / 2 - shadowTop || radius <= edge) {
|
352
|
+
return; // shadow would be outside canvas, so don't draw it
|
353
|
+
}
|
354
|
+
|
355
|
+
ctx.save();
|
356
|
+
ctx.translate(shadowLeft,shadowTop);
|
357
|
+
ctx.globalAlpha = alpha;
|
358
|
+
ctx.fillStyle = "#000";
|
359
|
+
|
360
|
+
// center and rotate to starting position
|
361
|
+
|
362
|
+
ctx.translate(centerLeft,centerTop);
|
363
|
+
ctx.scale(1, options.series.pie.tilt);
|
364
|
+
|
365
|
+
//radius -= edge;
|
366
|
+
|
367
|
+
for (var i = 1; i <= edge; i++) {
|
368
|
+
ctx.beginPath();
|
369
|
+
ctx.arc(0, 0, radius, 0, Math.PI * 2, false);
|
370
|
+
ctx.fill();
|
371
|
+
radius -= i;
|
372
|
+
}
|
373
|
+
|
374
|
+
ctx.restore();
|
375
|
+
}
|
376
|
+
|
377
|
+
function drawPie() {
|
378
|
+
|
379
|
+
var startAngle = Math.PI * options.series.pie.startAngle;
|
380
|
+
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
381
|
+
|
382
|
+
// center and rotate to starting position
|
383
|
+
|
384
|
+
ctx.save();
|
385
|
+
ctx.translate(centerLeft,centerTop);
|
386
|
+
ctx.scale(1, options.series.pie.tilt);
|
387
|
+
//ctx.rotate(startAngle); // start at top; -- This doesn't work properly in Opera
|
388
|
+
|
389
|
+
// draw slices
|
390
|
+
|
391
|
+
ctx.save();
|
392
|
+
var currentAngle = startAngle;
|
393
|
+
for (var i = 0; i < slices.length; ++i) {
|
394
|
+
slices[i].startAngle = currentAngle;
|
395
|
+
drawSlice(slices[i].angle, slices[i].color, true);
|
396
|
+
}
|
397
|
+
ctx.restore();
|
398
|
+
|
399
|
+
// draw slice outlines
|
400
|
+
|
401
|
+
if (options.series.pie.stroke.width > 0) {
|
402
|
+
ctx.save();
|
403
|
+
ctx.lineWidth = options.series.pie.stroke.width;
|
404
|
+
currentAngle = startAngle;
|
405
|
+
for (var i = 0; i < slices.length; ++i) {
|
406
|
+
drawSlice(slices[i].angle, options.series.pie.stroke.color, false);
|
407
|
+
}
|
408
|
+
ctx.restore();
|
409
|
+
}
|
410
|
+
|
411
|
+
// draw donut hole
|
412
|
+
|
413
|
+
drawDonutHole(ctx);
|
414
|
+
|
415
|
+
ctx.restore();
|
416
|
+
|
417
|
+
// Draw the labels, returning true if they fit within the plot
|
418
|
+
|
419
|
+
if (options.series.pie.label.show) {
|
420
|
+
return drawLabels();
|
421
|
+
} else return true;
|
422
|
+
|
423
|
+
function drawSlice(angle, color, fill) {
|
424
|
+
|
425
|
+
if (angle <= 0 || isNaN(angle)) {
|
426
|
+
return;
|
427
|
+
}
|
428
|
+
|
429
|
+
if (fill) {
|
430
|
+
ctx.fillStyle = color;
|
431
|
+
} else {
|
432
|
+
ctx.strokeStyle = color;
|
433
|
+
ctx.lineJoin = "round";
|
434
|
+
}
|
435
|
+
|
436
|
+
ctx.beginPath();
|
437
|
+
if (Math.abs(angle - Math.PI * 2) > 0.000000001) {
|
438
|
+
ctx.moveTo(0, 0); // Center of the pie
|
439
|
+
}
|
440
|
+
|
441
|
+
//ctx.arc(0, 0, radius, 0, angle, false); // This doesn't work properly in Opera
|
442
|
+
ctx.arc(0, 0, radius,currentAngle, currentAngle + angle / 2, false);
|
443
|
+
ctx.arc(0, 0, radius,currentAngle + angle / 2, currentAngle + angle, false);
|
444
|
+
ctx.closePath();
|
445
|
+
//ctx.rotate(angle); // This doesn't work properly in Opera
|
446
|
+
currentAngle += angle;
|
447
|
+
|
448
|
+
if (fill) {
|
449
|
+
ctx.fill();
|
450
|
+
} else {
|
451
|
+
ctx.stroke();
|
452
|
+
}
|
453
|
+
}
|
454
|
+
|
455
|
+
function drawLabels() {
|
456
|
+
|
457
|
+
var currentAngle = startAngle;
|
458
|
+
var radius = options.series.pie.label.radius > 1 ? options.series.pie.label.radius : maxRadius * options.series.pie.label.radius;
|
459
|
+
|
460
|
+
for (var i = 0; i < slices.length; ++i) {
|
461
|
+
if (slices[i].percent >= options.series.pie.label.threshold * 100) {
|
462
|
+
if (!drawLabel(slices[i], currentAngle, i)) {
|
463
|
+
return false;
|
464
|
+
}
|
465
|
+
}
|
466
|
+
currentAngle += slices[i].angle;
|
467
|
+
}
|
468
|
+
|
469
|
+
return true;
|
470
|
+
|
471
|
+
function drawLabel(slice, startAngle, index) {
|
472
|
+
|
473
|
+
if (slice.data[0][1] == 0) {
|
474
|
+
return true;
|
475
|
+
}
|
476
|
+
|
477
|
+
// format label text
|
478
|
+
|
479
|
+
var lf = options.legend.labelFormatter, text, plf = options.series.pie.label.formatter;
|
480
|
+
|
481
|
+
if (lf) {
|
482
|
+
text = lf(slice.label, slice);
|
483
|
+
} else {
|
484
|
+
text = slice.label;
|
485
|
+
}
|
486
|
+
|
487
|
+
if (plf) {
|
488
|
+
text = plf(text, slice);
|
489
|
+
}
|
490
|
+
|
491
|
+
var halfAngle = ((startAngle + slice.angle) + startAngle) / 2;
|
492
|
+
var x = centerLeft + Math.round(Math.cos(halfAngle) * radius);
|
493
|
+
var y = centerTop + Math.round(Math.sin(halfAngle) * radius) * options.series.pie.tilt;
|
494
|
+
|
495
|
+
var html = "<span class='pieLabel' id='pieLabel" + index + "' style='position:absolute;top:" + y + "px;left:" + x + "px;'>" + text + "</span>";
|
496
|
+
target.append(html);
|
497
|
+
|
498
|
+
var label = target.children("#pieLabel" + index);
|
499
|
+
var labelTop = (y - label.height() / 2);
|
500
|
+
var labelLeft = (x - label.width() / 2);
|
501
|
+
|
502
|
+
label.css("top", labelTop);
|
503
|
+
label.css("left", labelLeft);
|
504
|
+
|
505
|
+
// check to make sure that the label is not outside the canvas
|
506
|
+
|
507
|
+
if (0 - labelTop > 0 || 0 - labelLeft > 0 || canvasHeight - (labelTop + label.height()) < 0 || canvasWidth - (labelLeft + label.width()) < 0) {
|
508
|
+
return false;
|
509
|
+
}
|
510
|
+
|
511
|
+
if (options.series.pie.label.background.opacity != 0) {
|
512
|
+
|
513
|
+
// put in the transparent background separately to avoid blended labels and label boxes
|
514
|
+
|
515
|
+
var c = options.series.pie.label.background.color;
|
516
|
+
|
517
|
+
if (c == null) {
|
518
|
+
c = slice.color;
|
519
|
+
}
|
520
|
+
|
521
|
+
var pos = "top:" + labelTop + "px;left:" + labelLeft + "px;";
|
522
|
+
$("<div class='pieLabelBackground' style='position:absolute;width:" + label.width() + "px;height:" + label.height() + "px;" + pos + "background-color:" + c + ";'></div>")
|
523
|
+
.css("opacity", options.series.pie.label.background.opacity)
|
524
|
+
.insertBefore(label);
|
525
|
+
}
|
526
|
+
|
527
|
+
return true;
|
528
|
+
} // end individual label function
|
529
|
+
} // end drawLabels function
|
530
|
+
} // end drawPie function
|
531
|
+
} // end draw function
|
532
|
+
|
533
|
+
// Placed here because it needs to be accessed from multiple locations
|
534
|
+
|
535
|
+
function drawDonutHole(layer) {
|
536
|
+
if (options.series.pie.innerRadius > 0) {
|
537
|
+
|
538
|
+
// subtract the center
|
539
|
+
|
540
|
+
layer.save();
|
541
|
+
var innerRadius = options.series.pie.innerRadius > 1 ? options.series.pie.innerRadius : maxRadius * options.series.pie.innerRadius;
|
542
|
+
layer.globalCompositeOperation = "destination-out"; // this does not work with excanvas, but it will fall back to using the stroke color
|
543
|
+
layer.beginPath();
|
544
|
+
layer.fillStyle = options.series.pie.stroke.color;
|
545
|
+
layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
|
546
|
+
layer.fill();
|
547
|
+
layer.closePath();
|
548
|
+
layer.restore();
|
549
|
+
|
550
|
+
// add inner stroke
|
551
|
+
|
552
|
+
layer.save();
|
553
|
+
layer.beginPath();
|
554
|
+
layer.strokeStyle = options.series.pie.stroke.color;
|
555
|
+
layer.arc(0, 0, innerRadius, 0, Math.PI * 2, false);
|
556
|
+
layer.stroke();
|
557
|
+
layer.closePath();
|
558
|
+
layer.restore();
|
559
|
+
|
560
|
+
// TODO: add extra shadow inside hole (with a mask) if the pie is tilted.
|
561
|
+
}
|
562
|
+
}
|
563
|
+
|
564
|
+
//-- Additional Interactive related functions --
|
565
|
+
|
566
|
+
function isPointInPoly(poly, pt) {
|
567
|
+
for(var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
|
568
|
+
((poly[i][1] <= pt[1] && pt[1] < poly[j][1]) || (poly[j][1] <= pt[1] && pt[1]< poly[i][1]))
|
569
|
+
&& (pt[0] < (poly[j][0] - poly[i][0]) * (pt[1] - poly[i][1]) / (poly[j][1] - poly[i][1]) + poly[i][0])
|
570
|
+
&& (c = !c);
|
571
|
+
return c;
|
572
|
+
}
|
573
|
+
|
574
|
+
function findNearbySlice(mouseX, mouseY) {
|
575
|
+
|
576
|
+
var slices = plot.getData(),
|
577
|
+
options = plot.getOptions(),
|
578
|
+
radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius,
|
579
|
+
x, y;
|
580
|
+
|
581
|
+
for (var i = 0; i < slices.length; ++i) {
|
582
|
+
|
583
|
+
var s = slices[i];
|
584
|
+
|
585
|
+
if (s.pie.show) {
|
586
|
+
|
587
|
+
ctx.save();
|
588
|
+
ctx.beginPath();
|
589
|
+
ctx.moveTo(0, 0); // Center of the pie
|
590
|
+
//ctx.scale(1, options.series.pie.tilt); // this actually seems to break everything when here.
|
591
|
+
ctx.arc(0, 0, radius, s.startAngle, s.startAngle + s.angle / 2, false);
|
592
|
+
ctx.arc(0, 0, radius, s.startAngle + s.angle / 2, s.startAngle + s.angle, false);
|
593
|
+
ctx.closePath();
|
594
|
+
x = mouseX - centerLeft;
|
595
|
+
y = mouseY - centerTop;
|
596
|
+
|
597
|
+
if (ctx.isPointInPath) {
|
598
|
+
if (ctx.isPointInPath(mouseX - centerLeft, mouseY - centerTop)) {
|
599
|
+
ctx.restore();
|
600
|
+
return {
|
601
|
+
datapoint: [s.percent, s.data],
|
602
|
+
dataIndex: 0,
|
603
|
+
series: s,
|
604
|
+
seriesIndex: i
|
605
|
+
};
|
606
|
+
}
|
607
|
+
} else {
|
608
|
+
|
609
|
+
// excanvas for IE doesn;t support isPointInPath, this is a workaround.
|
610
|
+
|
611
|
+
var p1X = radius * Math.cos(s.startAngle),
|
612
|
+
p1Y = radius * Math.sin(s.startAngle),
|
613
|
+
p2X = radius * Math.cos(s.startAngle + s.angle / 4),
|
614
|
+
p2Y = radius * Math.sin(s.startAngle + s.angle / 4),
|
615
|
+
p3X = radius * Math.cos(s.startAngle + s.angle / 2),
|
616
|
+
p3Y = radius * Math.sin(s.startAngle + s.angle / 2),
|
617
|
+
p4X = radius * Math.cos(s.startAngle + s.angle / 1.5),
|
618
|
+
p4Y = radius * Math.sin(s.startAngle + s.angle / 1.5),
|
619
|
+
p5X = radius * Math.cos(s.startAngle + s.angle),
|
620
|
+
p5Y = radius * Math.sin(s.startAngle + s.angle),
|
621
|
+
arrPoly = [[0, 0], [p1X, p1Y], [p2X, p2Y], [p3X, p3Y], [p4X, p4Y], [p5X, p5Y]],
|
622
|
+
arrPoint = [x, y];
|
623
|
+
|
624
|
+
// TODO: perhaps do some mathmatical trickery here with the Y-coordinate to compensate for pie tilt?
|
625
|
+
|
626
|
+
if (isPointInPoly(arrPoly, arrPoint)) {
|
627
|
+
ctx.restore();
|
628
|
+
return {
|
629
|
+
datapoint: [s.percent, s.data],
|
630
|
+
dataIndex: 0,
|
631
|
+
series: s,
|
632
|
+
seriesIndex: i
|
633
|
+
};
|
634
|
+
}
|
635
|
+
}
|
636
|
+
|
637
|
+
ctx.restore();
|
638
|
+
}
|
639
|
+
}
|
640
|
+
|
641
|
+
return null;
|
642
|
+
}
|
643
|
+
|
644
|
+
function onMouseMove(e) {
|
645
|
+
triggerClickHoverEvent("plothover", e);
|
646
|
+
}
|
647
|
+
|
648
|
+
function onClick(e) {
|
649
|
+
triggerClickHoverEvent("plotclick", e);
|
650
|
+
}
|
651
|
+
|
652
|
+
// trigger click or hover event (they send the same parameters so we share their code)
|
653
|
+
|
654
|
+
function triggerClickHoverEvent(eventname, e) {
|
655
|
+
|
656
|
+
var offset = plot.offset();
|
657
|
+
var canvasX = parseInt(e.pageX - offset.left);
|
658
|
+
var canvasY = parseInt(e.pageY - offset.top);
|
659
|
+
var item = findNearbySlice(canvasX, canvasY);
|
660
|
+
|
661
|
+
if (options.grid.autoHighlight) {
|
662
|
+
|
663
|
+
// clear auto-highlights
|
664
|
+
|
665
|
+
for (var i = 0; i < highlights.length; ++i) {
|
666
|
+
var h = highlights[i];
|
667
|
+
if (h.auto == eventname && !(item && h.series == item.series)) {
|
668
|
+
unhighlight(h.series);
|
669
|
+
}
|
670
|
+
}
|
671
|
+
}
|
672
|
+
|
673
|
+
// highlight the slice
|
674
|
+
|
675
|
+
if (item) {
|
676
|
+
highlight(item.series, eventname);
|
677
|
+
}
|
678
|
+
|
679
|
+
// trigger any hover bind events
|
680
|
+
|
681
|
+
var pos = { pageX: e.pageX, pageY: e.pageY };
|
682
|
+
target.trigger(eventname, [pos, item]);
|
683
|
+
}
|
684
|
+
|
685
|
+
function highlight(s, auto) {
|
686
|
+
//if (typeof s == "number") {
|
687
|
+
// s = series[s];
|
688
|
+
//}
|
689
|
+
|
690
|
+
var i = indexOfHighlight(s);
|
691
|
+
|
692
|
+
if (i == -1) {
|
693
|
+
highlights.push({ series: s, auto: auto });
|
694
|
+
plot.triggerRedrawOverlay();
|
695
|
+
} else if (!auto) {
|
696
|
+
highlights[i].auto = false;
|
697
|
+
}
|
698
|
+
}
|
699
|
+
|
700
|
+
function unhighlight(s) {
|
701
|
+
if (s == null) {
|
702
|
+
highlights = [];
|
703
|
+
plot.triggerRedrawOverlay();
|
704
|
+
}
|
705
|
+
|
706
|
+
//if (typeof s == "number") {
|
707
|
+
// s = series[s];
|
708
|
+
//}
|
709
|
+
|
710
|
+
var i = indexOfHighlight(s);
|
711
|
+
|
712
|
+
if (i != -1) {
|
713
|
+
highlights.splice(i, 1);
|
714
|
+
plot.triggerRedrawOverlay();
|
715
|
+
}
|
716
|
+
}
|
717
|
+
|
718
|
+
function indexOfHighlight(s) {
|
719
|
+
for (var i = 0; i < highlights.length; ++i) {
|
720
|
+
var h = highlights[i];
|
721
|
+
if (h.series == s)
|
722
|
+
return i;
|
723
|
+
}
|
724
|
+
return -1;
|
725
|
+
}
|
726
|
+
|
727
|
+
function drawOverlay(plot, octx) {
|
728
|
+
|
729
|
+
var options = plot.getOptions();
|
730
|
+
|
731
|
+
var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
|
732
|
+
|
733
|
+
octx.save();
|
734
|
+
octx.translate(centerLeft, centerTop);
|
735
|
+
octx.scale(1, options.series.pie.tilt);
|
736
|
+
|
737
|
+
for (var i = 0; i < highlights.length; ++i) {
|
738
|
+
drawHighlight(highlights[i].series);
|
739
|
+
}
|
740
|
+
|
741
|
+
drawDonutHole(octx);
|
742
|
+
|
743
|
+
octx.restore();
|
744
|
+
|
745
|
+
function drawHighlight(series) {
|
746
|
+
|
747
|
+
if (series.angle <= 0 || isNaN(series.angle)) {
|
748
|
+
return;
|
749
|
+
}
|
750
|
+
|
751
|
+
//octx.fillStyle = parseColor(options.series.pie.highlight.color).scale(null, null, null, options.series.pie.highlight.opacity).toString();
|
752
|
+
octx.fillStyle = "rgba(255, 255, 255, " + options.series.pie.highlight.opacity + ")"; // this is temporary until we have access to parseColor
|
753
|
+
octx.beginPath();
|
754
|
+
if (Math.abs(series.angle - Math.PI * 2) > 0.000000001) {
|
755
|
+
octx.moveTo(0, 0); // Center of the pie
|
756
|
+
}
|
757
|
+
octx.arc(0, 0, radius, series.startAngle, series.startAngle + series.angle / 2, false);
|
758
|
+
octx.arc(0, 0, radius, series.startAngle + series.angle / 2, series.startAngle + series.angle, false);
|
759
|
+
octx.closePath();
|
760
|
+
octx.fill();
|
761
|
+
}
|
762
|
+
}
|
763
|
+
} // end init (plugin body)
|
764
|
+
|
765
|
+
// define pie specific options and their default values
|
766
|
+
|
767
|
+
var options = {
|
768
|
+
series: {
|
769
|
+
pie: {
|
770
|
+
show: false,
|
771
|
+
radius: "auto", // actual radius of the visible pie (based on full calculated radius if <=1, or hard pixel value)
|
772
|
+
innerRadius: 0, /* for donut */
|
773
|
+
startAngle: 3/2,
|
774
|
+
tilt: 1,
|
775
|
+
shadow: {
|
776
|
+
left: 5, // shadow left offset
|
777
|
+
top: 15, // shadow top offset
|
778
|
+
alpha: 0.02 // shadow alpha
|
779
|
+
},
|
780
|
+
offset: {
|
781
|
+
top: 0,
|
782
|
+
left: "auto"
|
783
|
+
},
|
784
|
+
stroke: {
|
785
|
+
color: "#fff",
|
786
|
+
width: 1
|
787
|
+
},
|
788
|
+
label: {
|
789
|
+
show: "auto",
|
790
|
+
formatter: function(label, slice) {
|
791
|
+
return "<div style='font-size:x-small;text-align:center;padding:2px;color:" + slice.color + ";'>" + label + "<br/>" + Math.round(slice.percent) + "%</div>";
|
792
|
+
}, // formatter function
|
793
|
+
radius: 1, // radius at which to place the labels (based on full calculated radius if <=1, or hard pixel value)
|
794
|
+
background: {
|
795
|
+
color: null,
|
796
|
+
opacity: 0
|
797
|
+
},
|
798
|
+
threshold: 0 // percentage at which to hide the label (i.e. the slice is too narrow)
|
799
|
+
},
|
800
|
+
combine: {
|
801
|
+
threshold: -1, // percentage at which to combine little slices into one larger slice
|
802
|
+
color: null, // color to give the new slice (auto-generated if null)
|
803
|
+
label: "Other" // label to give the new slice
|
804
|
+
},
|
805
|
+
highlight: {
|
806
|
+
//color: "#fff", // will add this functionality once parseColor is available
|
807
|
+
opacity: 0.5
|
808
|
+
}
|
809
|
+
}
|
810
|
+
}
|
811
|
+
};
|
812
|
+
|
813
|
+
$.plot.plugins.push({
|
814
|
+
init: init,
|
815
|
+
options: options,
|
816
|
+
name: "pie",
|
817
|
+
version: "1.1"
|
818
|
+
});
|
819
|
+
|
820
|
+
})(jQuery);
|