rails_marketplace 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +37 -0
- data/app/assets/javascripts/rails_marketplace/application.js +46 -0
- data/app/assets/javascripts/rails_marketplace/catalog.coffee +3 -0
- data/app/assets/javascripts/rails_marketplace/flash.js +6 -0
- data/app/assets/javascripts/rails_marketplace/footermanifest.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/autocomplete/countries.js +267 -0
- data/app/assets/javascripts/rails_marketplace/js/autocomplete/jquery.autocomplete.js +986 -0
- data/app/assets/javascripts/rails_marketplace/js/bootstrap.min.js +7 -0
- data/app/assets/javascripts/rails_marketplace/js/calendar/fullcalendar.min.js +9 -0
- data/app/assets/javascripts/rails_marketplace/js/chartjs/chart.min.js +14 -0
- data/app/assets/javascripts/rails_marketplace/js/colorpicker/bootstrap-colorpicker.min.js +1087 -0
- data/app/assets/javascripts/rails_marketplace/js/colorpicker/docs.js +17 -0
- data/app/assets/javascripts/rails_marketplace/js/cropping/cropper.min.js +10 -0
- data/app/assets/javascripts/rails_marketplace/js/cropping/main.js +321 -0
- data/app/assets/javascripts/rails_marketplace/js/cropping/main2.js +160 -0
- data/app/assets/javascripts/rails_marketplace/js/custom.js +380 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.bootstrap.min.css +1 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.bootstrap.min.js +6 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.html5.min.js +22 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/buttons.print.min.js +4 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.bootstrap.js +8 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.buttons.min.js +36 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.fixedHeader.min.js +17 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.keyTable.min.js +18 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.responsive.min.js +25 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/dataTables.scroller.min.js +26 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/fixedHeader.bootstrap.min.css +1 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/jquery.dataTables.min.css +333 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/jquery.dataTables.min.js +166 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/json/scroller-demo.json +2502 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/jszip.min.js +14 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/pdfmake.min.js +22 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/responsive.bootstrap.min.css +1 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/responsive.bootstrap.min.js +7 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/scroller.bootstrap.min.css +1 -0
- data/app/assets/javascripts/rails_marketplace/js/datatables/vfs_fonts.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/datepicker/daterangepicker.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/dropzone/dropzone.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/easypie/jquery.easypiechart.min.js +9 -0
- data/app/assets/javascripts/rails_marketplace/js/echart/echarts-all.js +35 -0
- data/app/assets/javascripts/rails_marketplace/js/echart/green.js +212 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/bootstrap-wysiwyg.js +200 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-apollo.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-basic.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-clj.js +18 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-css.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-dart.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-erlang.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-go.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-hs.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-lisp.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-llvm.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-lua.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-matlab.js +6 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-ml.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-mumps.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-n.js +4 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-pascal.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-proto.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-r.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-rd.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-scala.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-sql.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-tcl.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-tex.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-vb.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-vhdl.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-wiki.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-xq.js +3 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/lang-yaml.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/prettify.js +30 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/google-code-prettify/run_prettify.js +34 -0
- data/app/assets/javascripts/rails_marketplace/js/editor/external/jquery.hotkeys.js +100 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/curvedLines.js +483 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/date.js +104 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.orderBars.js +201 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.pie.js +820 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.resize.js +57 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.spline.js +212 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.stack.js +188 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.time.min.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/flot/jquery.flot.tooltip.min.js +12 -0
- data/app/assets/javascripts/rails_marketplace/js/gauge/gauge.min.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/gauge/gauge_demo.js +21 -0
- data/app/assets/javascripts/rails_marketplace/js/icheck/icheck.min.js +11 -0
- data/app/assets/javascripts/rails_marketplace/js/input_mask/jquery.inputmask.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/ion_range/ion.rangeSlider.min.js +66 -0
- data/app/assets/javascripts/rails_marketplace/js/jquery.min.js +5 -0
- data/app/assets/javascripts/rails_marketplace/js/knob/jquery.knob.min.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/maps/gdp-data.js +185 -0
- data/app/assets/javascripts/rails_marketplace/js/maps/jquery-jvectormap-2.0.3.min.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/maps/jquery-jvectormap-us-aea-en.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/maps/jquery-jvectormap-world-mill-en.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/maps/us-unemployment.json +1 -0
- data/app/assets/javascripts/rails_marketplace/js/moment/moment.min.js +7 -0
- data/app/assets/javascripts/rails_marketplace/js/moris/example.js +127 -0
- data/app/assets/javascripts/rails_marketplace/js/moris/morris.min.js +7 -0
- data/app/assets/javascripts/rails_marketplace/js/moris/raphael-min.js +11 -0
- data/app/assets/javascripts/rails_marketplace/js/notify/pnotify.buttons.js +132 -0
- data/app/assets/javascripts/rails_marketplace/js/notify/pnotify.core.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/notify/pnotify.nonblock.js +151 -0
- data/app/assets/javascripts/rails_marketplace/js/nprogress.js +476 -0
- data/app/assets/javascripts/rails_marketplace/js/pace/pace.min.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/parsley/parsley.min.js +9 -0
- data/app/assets/javascripts/rails_marketplace/js/progressbar/bootstrap-progressbar.min.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/select/select2.full.js +2 -0
- data/app/assets/javascripts/rails_marketplace/js/sidebar/classie.js +80 -0
- data/app/assets/javascripts/rails_marketplace/js/sidebar/component.css +569 -0
- data/app/assets/javascripts/rails_marketplace/js/sidebar/modernizr.custom.js +4 -0
- data/app/assets/javascripts/rails_marketplace/js/sidebar/sidebarEffects.js +63 -0
- data/app/assets/javascripts/rails_marketplace/js/skycons/skycons.min.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/sparkline/jquery.sparkline.min.js +5 -0
- data/app/assets/javascripts/rails_marketplace/js/switchery/switchery.min.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/tags/jquery.tagsinput.min.js +1 -0
- data/app/assets/javascripts/rails_marketplace/js/textarea/autosize.min.js +6 -0
- data/app/assets/javascripts/rails_marketplace/js/validator/validator.js +411 -0
- data/app/assets/javascripts/rails_marketplace/js/wizard/jquery.smartWizard.js +489 -0
- data/app/assets/javascripts/rails_marketplace/less/custom.css +6355 -0
- data/app/assets/javascripts/rails_marketplace/marketplace.js +17 -0
- data/app/assets/javascripts/rails_marketplace/welcome.coffee +3 -0
- data/app/assets/stylesheets/rails_marketplace/application.scss +31 -0
- data/app/assets/stylesheets/rails_marketplace/catalog.scss +132 -0
- data/app/assets/stylesheets/rails_marketplace/css/animate.min.css +11 -0
- data/app/assets/stylesheets/rails_marketplace/css/bootstrap.min.css +6 -0
- data/app/assets/stylesheets/rails_marketplace/css/calendar/fullcalendar.css +1116 -0
- data/app/assets/stylesheets/rails_marketplace/css/calendar/fullcalendar.min.css +5 -0
- data/app/assets/stylesheets/rails_marketplace/css/calendar/fullcalendar.print.css +208 -0
- data/app/assets/stylesheets/rails_marketplace/css/colorpicker/bootstrap-colorpicker.min.css +9 -0
- data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/alpha-horizontal.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/alpha.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/hue-horizontal.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/hue.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/colorpicker/img/bootstrap-colorpicker/saturation.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/custom.css +5347 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/demo_page.css +103 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/demo_table.css +258 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/demo_table_jui.css +501 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/jquery.dataTables.css +221 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/css/jquery.dataTables_themeroller.css +244 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/Sorting icons.psd +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/back_disabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/back_enabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/back_enabled_hover.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/favicon.ico +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/forward_disabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/forward_enabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/forward_enabled_hover.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_asc.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_asc_disabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_both.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_desc.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/images/sort_desc_disabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/datatables/tools/css/dataTables.tableTools.css +336 -0
- data/app/assets/stylesheets/rails_marketplace/css/editor/external/google-code-prettify/prettify.css +1 -0
- data/app/assets/stylesheets/rails_marketplace/css/editor/index.css +42 -0
- data/app/assets/stylesheets/rails_marketplace/css/floatexamples.css +22 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/_all.css +530 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/aero.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/aero.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/aero@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/blue.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/blue.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/blue@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/flat.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/flat.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/flat@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/green.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/green.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/green@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/grey.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/grey.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/grey@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/orange.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/orange.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/orange@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/pink.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/pink.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/pink@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/purple.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/purple.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/purple@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/red.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/red.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/red@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/yellow.css +53 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/yellow.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/icheck/flat/yellow@2x.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/css/ion.rangeSlider.css +146 -0
- data/app/assets/stylesheets/rails_marketplace/css/ion.rangeSlider.skinFlat.css +106 -0
- data/app/assets/stylesheets/rails_marketplace/css/maps/jquery-jvectormap-2.0.3.css +135 -0
- data/app/assets/stylesheets/rails_marketplace/css/normalize.css +421 -0
- data/app/assets/stylesheets/rails_marketplace/css/nprogress.css +74 -0
- data/app/assets/stylesheets/rails_marketplace/css/progressbar/bootstrap-progressbar-3.3.0.css +161 -0
- data/app/assets/stylesheets/rails_marketplace/css/select/select2.min.css +404 -0
- data/app/assets/stylesheets/rails_marketplace/css/switchery/switchery.min.css +1 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/css/font-awesome.css +2086 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/css/font-awesome.min.css +4 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/FontAwesome.otf +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.svg +655 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.woff +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/fonts/fontawesome-webfont.woff2 +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.svg +288 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/animated.less +34 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/bordered-pulled.less +25 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/core.less +12 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/fixed-width.less +6 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/font-awesome.less +17 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/icons.less +697 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/larger.less +13 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/list.less +19 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/mixins.less +26 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/path.less +15 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/rotated-flipped.less +20 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/spinning.less +29 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/stacked.less +20 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/less/variables.less +708 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_animated.scss +34 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_bordered-pulled.scss +25 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_core.scss +12 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_fixed-width.scss +6 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_icons.scss +697 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_larger.scss +13 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_list.scss +19 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_mixins.scss +26 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_path.scss +15 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_rotated-flipped.scss +20 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_spinning.scss +29 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_stacked.scss +20 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/_variables.scss +708 -0
- data/app/assets/stylesheets/rails_marketplace/fonts/scss/font-awesome.scss +17 -0
- data/app/assets/stylesheets/rails_marketplace/images/1.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/4.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/american-express.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/back_disabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/back_enabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/back_enabled_hover.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/alpha-horizontal.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/alpha.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/hue-horizontal.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/hue.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/bootstrap-colorpicker/saturation.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/data.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/favicon.ico +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/forward_disabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/forward_enabled.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/forward_enabled_hover.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/icons.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/img.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/loading.gif +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/mastercard.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/paypal2.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/picture-2.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/picture.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/picture2.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/prod1.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/prod2.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/prod3.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/prod4.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/prod5.jpg +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/sprite-skin-flat.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/sprite-skin-modern.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/sprite-skin-nice.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/sprite-skin-simple.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/user.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/images/visa.png +0 -0
- data/app/assets/stylesheets/rails_marketplace/marketplace.scss +20 -0
- data/app/assets/stylesheets/rails_marketplace/pace.css +76 -0
- data/app/assets/stylesheets/rails_marketplace/welcome.scss +3 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/rails_marketplace/admin_controller.rb +151 -0
- data/app/controllers/rails_marketplace/application_controller.rb +4 -0
- data/app/controllers/rails_marketplace/catalog_controller.rb +172 -0
- data/app/controllers/rails_marketplace/seller_controller.rb +181 -0
- data/app/helpers/rails_marketplace/admin_helper.rb +16 -0
- data/app/helpers/rails_marketplace/application_helper.rb +4 -0
- data/app/helpers/rails_marketplace/catalog_helper.rb +4 -0
- data/app/helpers/rails_marketplace/plainpage_helper.rb +4 -0
- data/app/helpers/rails_marketplace/seller_helper.rb +16 -0
- data/app/models/rails_marketplace/admin.rb +10 -0
- data/app/models/rails_marketplace/admin_setting.rb +13 -0
- data/app/models/rails_marketplace/cart.rb +49 -0
- data/app/models/rails_marketplace/cart_product.rb +7 -0
- data/app/models/rails_marketplace/category.rb +22 -0
- data/app/models/rails_marketplace/category_product.rb +6 -0
- data/app/models/rails_marketplace/customer.rb +6 -0
- data/app/models/rails_marketplace/order.rb +22 -0
- data/app/models/rails_marketplace/order_product.rb +7 -0
- data/app/models/rails_marketplace/product.rb +34 -0
- data/app/models/rails_marketplace/seller.rb +13 -0
- data/app/models/rails_marketplace/seller_setting.rb +5 -0
- data/app/views/layouts/rails_marketplace/application.html.erb +37 -0
- data/app/views/layouts/rails_marketplace/seller_central.html.erb +58 -0
- data/app/views/layouts/rails_marketplace/super_admin.html.erb +58 -0
- data/app/views/rails_marketplace/admin/add_category.html.erb +63 -0
- data/app/views/rails_marketplace/admin/categories.html.erb +50 -0
- data/app/views/rails_marketplace/admin/category_products.html.erb +54 -0
- data/app/views/rails_marketplace/admin/dashboard.html.erb +50 -0
- data/app/views/rails_marketplace/admin/edit_category.html.erb +63 -0
- data/app/views/rails_marketplace/admin/login_form.html.erb +20 -0
- data/app/views/rails_marketplace/admin/products.html.erb +54 -0
- data/app/views/rails_marketplace/admin/seller_products.html.erb +54 -0
- data/app/views/rails_marketplace/admin/sellers.html.erb +48 -0
- data/app/views/rails_marketplace/admin/settings_form.html.erb +39 -0
- data/app/views/rails_marketplace/admin/signup_form.html.erb +25 -0
- data/app/views/rails_marketplace/catalog/cart.html.erb +80 -0
- data/app/views/rails_marketplace/catalog/category_products.html.erb +52 -0
- data/app/views/rails_marketplace/catalog/checkout.html.erb +207 -0
- data/app/views/rails_marketplace/catalog/checkout_success.html.erb +15 -0
- data/app/views/rails_marketplace/catalog/index.html.erb +1 -0
- data/app/views/rails_marketplace/catalog/product_detail.html.erb +88 -0
- data/app/views/rails_marketplace/partials/_admin_sidenav.html.erb +80 -0
- data/app/views/rails_marketplace/partials/_admin_topnav.html.erb +111 -0
- data/app/views/rails_marketplace/partials/_footer.html.erb +19 -0
- data/app/views/rails_marketplace/partials/_menu.html.erb +42 -0
- data/app/views/rails_marketplace/partials/_sidenav.html.erb +77 -0
- data/app/views/rails_marketplace/partials/_topnav.html.erb +105 -0
- data/app/views/rails_marketplace/seller/add_bulk_products.html.erb +0 -0
- data/app/views/rails_marketplace/seller/add_product.html.erb +67 -0
- data/app/views/rails_marketplace/seller/dashboard.html.erb +50 -0
- data/app/views/rails_marketplace/seller/edit_product.html.erb +69 -0
- data/app/views/rails_marketplace/seller/login_form.html.erb +36 -0
- data/app/views/rails_marketplace/seller/order_details.html.erb +69 -0
- data/app/views/rails_marketplace/seller/orders.html.erb +68 -0
- data/app/views/rails_marketplace/seller/products.html.erb +55 -0
- data/app/views/rails_marketplace/seller/settings_general.html.erb +64 -0
- data/app/views/rails_marketplace/seller/settings_payment.html.erb +34 -0
- data/app/views/rails_marketplace/seller/settings_shipping.html.erb +34 -0
- data/app/views/rails_marketplace/seller/settings_tax.html.erb +34 -0
- data/app/views/rails_marketplace/seller/signup_form.html.erb +28 -0
- data/app/views/rails_marketplace/seller/step_two.html.erb +17 -0
- data/app/views/rails_marketplace/shared/_admin_error_messages.html.erb +12 -0
- data/app/views/rails_marketplace/shared/_product_error_messages.html.erb +12 -0
- data/app/views/rails_marketplace/shared/_seller_error_messages.html.erb +12 -0
- data/config/routes.rb +58 -0
- data/db/migrate/20161013194852_create_sellers.rb +13 -0
- data/db/migrate/20161013195006_create_customers.rb +13 -0
- data/db/migrate/20161013195758_create_orders.rb +8 -0
- data/db/migrate/20161014013032_create_category_products.rb +10 -0
- data/db/migrate/20161014013058_create_order_products.rb +13 -0
- data/db/migrate/20161017185755_create_admins.rb +12 -0
- data/db/migrate/20161017232347_create_products.rb +14 -0
- data/db/migrate/20161019012043_add_reference_product_seller.rb +5 -0
- data/db/migrate/20161019013502_change_data_type_images_files.rb +6 -0
- data/db/migrate/20161019022020_add_reference_order_customers.rb +5 -0
- data/db/migrate/20161109191644_create_categories.rb +15 -0
- data/db/migrate/20161110021043_create_friendly_id_slugs.rb +15 -0
- data/db/migrate/20161110021131_add_slug_to_category.rb +6 -0
- data/db/migrate/20161110024118_add_slug_to_product.rb +6 -0
- data/db/migrate/20161111001446_create_carts.rb +8 -0
- data/db/migrate/20161111004451_create_cart_products.rb +12 -0
- data/db/migrate/20161115013956_add_currency_format_to_price.rb +6 -0
- data/db/migrate/20161115015227_monetize_product.rb +5 -0
- data/db/migrate/20161115032905_add_stripe_key_to_admin.rb +6 -0
- data/db/migrate/20161124015608_add_order_fields.rb +16 -0
- data/db/migrate/20161207193917_add_seller_to_orders.rb +6 -0
- data/db/migrate/20161208012601_add_price_to_cart_products.rb +6 -0
- data/db/migrate/20161208013402_add_money_to_cart_products.rb +6 -0
- data/db/migrate/20170217183953_create_seller_settings.rb +29 -0
- data/db/migrate/20170218003202_create_admin_settings.rb +24 -0
- data/db/migrate/20170224230449_create_stripe_managed_accounts.rb +9 -0
- data/db/migrate/20170224233736_add_stripe_to_admin_settings.rb +9 -0
- data/db/migrate/20170224235259_add_id_to_settings.rb +6 -0
- data/db/migrate/20170225002939_delete_stripe_accounts.rb +8 -0
- data/db/migrate/20170225003252_add_stripe_account_id_to_seller_settings.rb +5 -0
- data/lib/rails_marketplace.rb +4 -0
- data/lib/rails_marketplace/engine.rb +9 -0
- data/lib/rails_marketplace/version.rb +3 -0
- data/lib/tasks/rails_marketplace_tasks.rake +4 -0
- data/spec/controllers/rails_marketplace/catalog_controller_spec.rb +75 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +32 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/schema.rb +194 -0
- data/spec/dummy/log/development.log +889 -0
- data/spec/dummy/log/test.log +1229 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/helpers/rails_marketplace/catalog_helper_spec.rb +17 -0
- data/spec/routing/rails_marketplace/catalog_routing_spec.rb +44 -0
- data/spec/spec_helper.rb +44 -0
- data/spec/views/rails_marketplace/catalog/edit.html.erb_spec.rb +15 -0
- data/spec/views/rails_marketplace/catalog/index.html.erb_spec.rb +15 -0
- data/spec/views/rails_marketplace/catalog/new.html.erb_spec.rb +15 -0
- data/spec/views/rails_marketplace/catalog/show.html.erb_spec.rb +12 -0
- metadata +595 -0
@@ -0,0 +1,104 @@
|
|
1
|
+
/**
|
2
|
+
* Version: 1.0 Alpha-1
|
3
|
+
* Build Date: 13-Nov-2007
|
4
|
+
* Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
|
5
|
+
* License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/.
|
6
|
+
* Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
|
7
|
+
*/
|
8
|
+
Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};
|
9
|
+
Date.getMonthNumberFromName=function(name){var n=Date.CultureInfo.monthNames,m=Date.CultureInfo.abbreviatedMonthNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
|
10
|
+
return-1;};Date.getDayNumberFromName=function(name){var n=Date.CultureInfo.dayNames,m=Date.CultureInfo.abbreviatedDayNames,o=Date.CultureInfo.shortestDayNames,s=name.toLowerCase();for(var i=0;i<n.length;i++){if(n[i].toLowerCase()==s||m[i].toLowerCase()==s){return i;}}
|
11
|
+
return-1;};Date.isLeapYear=function(year){return(((year%4===0)&&(year%100!==0))||(year%400===0));};Date.getDaysInMonth=function(year,month){return[31,(Date.isLeapYear(year)?29:28),31,30,31,30,31,31,30,31,30,31][month];};Date.getTimezoneOffset=function(s,dst){return(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST[s.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[s.toUpperCase()];};Date.getTimezoneAbbreviation=function(offset,dst){var n=(dst||false)?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,p;for(p in n){if(n[p]===offset){return p;}}
|
12
|
+
return null;};Date.prototype.clone=function(){return new Date(this.getTime());};Date.prototype.compareTo=function(date){if(isNaN(this)){throw new Error(this);}
|
13
|
+
if(date instanceof Date&&!isNaN(date)){return(this>date)?1:(this<date)?-1:0;}else{throw new TypeError(date);}};Date.prototype.equals=function(date){return(this.compareTo(date)===0);};Date.prototype.between=function(start,end){var t=this.getTime();return t>=start.getTime()&&t<=end.getTime();};Date.prototype.addMilliseconds=function(value){this.setMilliseconds(this.getMilliseconds()+value);return this;};Date.prototype.addSeconds=function(value){return this.addMilliseconds(value*1000);};Date.prototype.addMinutes=function(value){return this.addMilliseconds(value*60000);};Date.prototype.addHours=function(value){return this.addMilliseconds(value*3600000);};Date.prototype.addDays=function(value){return this.addMilliseconds(value*86400000);};Date.prototype.addWeeks=function(value){return this.addMilliseconds(value*604800000);};Date.prototype.addMonths=function(value){var n=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+value);this.setDate(Math.min(n,this.getDaysInMonth()));return this;};Date.prototype.addYears=function(value){return this.addMonths(value*12);};Date.prototype.add=function(config){if(typeof config=="number"){this._orient=config;return this;}
|
14
|
+
var x=config;if(x.millisecond||x.milliseconds){this.addMilliseconds(x.millisecond||x.milliseconds);}
|
15
|
+
if(x.second||x.seconds){this.addSeconds(x.second||x.seconds);}
|
16
|
+
if(x.minute||x.minutes){this.addMinutes(x.minute||x.minutes);}
|
17
|
+
if(x.hour||x.hours){this.addHours(x.hour||x.hours);}
|
18
|
+
if(x.month||x.months){this.addMonths(x.month||x.months);}
|
19
|
+
if(x.year||x.years){this.addYears(x.year||x.years);}
|
20
|
+
if(x.day||x.days){this.addDays(x.day||x.days);}
|
21
|
+
return this;};Date._validate=function(value,min,max,name){if(typeof value!="number"){throw new TypeError(value+" is not a Number.");}else if(value<min||value>max){throw new RangeError(value+" is not a valid value for "+name+".");}
|
22
|
+
return true;};Date.validateMillisecond=function(n){return Date._validate(n,0,999,"milliseconds");};Date.validateSecond=function(n){return Date._validate(n,0,59,"seconds");};Date.validateMinute=function(n){return Date._validate(n,0,59,"minutes");};Date.validateHour=function(n){return Date._validate(n,0,23,"hours");};Date.validateDay=function(n,year,month){return Date._validate(n,1,Date.getDaysInMonth(year,month),"days");};Date.validateMonth=function(n){return Date._validate(n,0,11,"months");};Date.validateYear=function(n){return Date._validate(n,1,9999,"seconds");};Date.prototype.set=function(config){var x=config;if(!x.millisecond&&x.millisecond!==0){x.millisecond=-1;}
|
23
|
+
if(!x.second&&x.second!==0){x.second=-1;}
|
24
|
+
if(!x.minute&&x.minute!==0){x.minute=-1;}
|
25
|
+
if(!x.hour&&x.hour!==0){x.hour=-1;}
|
26
|
+
if(!x.day&&x.day!==0){x.day=-1;}
|
27
|
+
if(!x.month&&x.month!==0){x.month=-1;}
|
28
|
+
if(!x.year&&x.year!==0){x.year=-1;}
|
29
|
+
if(x.millisecond!=-1&&Date.validateMillisecond(x.millisecond)){this.addMilliseconds(x.millisecond-this.getMilliseconds());}
|
30
|
+
if(x.second!=-1&&Date.validateSecond(x.second)){this.addSeconds(x.second-this.getSeconds());}
|
31
|
+
if(x.minute!=-1&&Date.validateMinute(x.minute)){this.addMinutes(x.minute-this.getMinutes());}
|
32
|
+
if(x.hour!=-1&&Date.validateHour(x.hour)){this.addHours(x.hour-this.getHours());}
|
33
|
+
if(x.month!==-1&&Date.validateMonth(x.month)){this.addMonths(x.month-this.getMonth());}
|
34
|
+
if(x.year!=-1&&Date.validateYear(x.year)){this.addYears(x.year-this.getFullYear());}
|
35
|
+
if(x.day!=-1&&Date.validateDay(x.day,this.getFullYear(),this.getMonth())){this.addDays(x.day-this.getDate());}
|
36
|
+
if(x.timezone){this.setTimezone(x.timezone);}
|
37
|
+
if(x.timezoneOffset){this.setTimezoneOffset(x.timezoneOffset);}
|
38
|
+
return this;};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this;};Date.prototype.isLeapYear=function(){var y=this.getFullYear();return(((y%4===0)&&(y%100!==0))||(y%400===0));};Date.prototype.isWeekday=function(){return!(this.is().sat()||this.is().sun());};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth());};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1});};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()});};Date.prototype.moveToDayOfWeek=function(day,orient){var diff=(day-this.getDay()+7*(orient||+1))%7;return this.addDays((diff===0)?diff+=7*(orient||+1):diff);};Date.prototype.moveToMonth=function(month,orient){var diff=(month-this.getMonth()+12*(orient||+1))%12;return this.addMonths((diff===0)?diff+=12*(orient||+1):diff);};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000);};Date.prototype.getWeekOfYear=function(firstDayOfWeek){var y=this.getFullYear(),m=this.getMonth(),d=this.getDate();var dow=firstDayOfWeek||Date.CultureInfo.firstDayOfWeek;var offset=7+1-new Date(y,0,1).getDay();if(offset==8){offset=1;}
|
39
|
+
var daynum=((Date.UTC(y,m,d,0,0,0)-Date.UTC(y,0,1,0,0,0))/86400000)+1;var w=Math.floor((daynum-offset+7)/7);if(w===dow){y--;var prevOffset=7+1-new Date(y,0,1).getDay();if(prevOffset==2||prevOffset==8){w=53;}else{w=52;}}
|
40
|
+
return w;};Date.prototype.isDST=function(){console.log('isDST');return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D";};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST());};Date.prototype.setTimezoneOffset=function(s){var here=this.getTimezoneOffset(),there=Number(s)*-6/10;this.addMinutes(there-here);return this;};Date.prototype.setTimezone=function(s){return this.setTimezoneOffset(Date.getTimezoneOffset(s));};Date.prototype.getUTCOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-10000).toString();return r[0]+r.substr(2);}else{r=(n+10000).toString();return"+"+r.substr(1);}};Date.prototype.getDayName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()];};Date.prototype.getMonthName=function(abbrev){return abbrev?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()];};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(format){var self=this;var p=function p(s){return(s.toString().length==1)?"0"+s:s;};return format?format.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(format){switch(format){case"hh":return p(self.getHours()<13?self.getHours():(self.getHours()-12));case"h":return self.getHours()<13?self.getHours():(self.getHours()-12);case"HH":return p(self.getHours());case"H":return self.getHours();case"mm":return p(self.getMinutes());case"m":return self.getMinutes();case"ss":return p(self.getSeconds());case"s":return self.getSeconds();case"yyyy":return self.getFullYear();case"yy":return self.getFullYear().toString().substring(2,4);case"dddd":return self.getDayName();case"ddd":return self.getDayName(true);case"dd":return p(self.getDate());case"d":return self.getDate().toString();case"MMMM":return self.getMonthName();case"MMM":return self.getMonthName(true);case"MM":return p((self.getMonth()+1));case"M":return self.getMonth()+1;case"t":return self.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return self.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return"";}}):this._toString();};
|
41
|
+
Date.now=function(){return new Date();};Date.today=function(){return Date.now().clearTime();};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this;};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this;};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this;};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var c={};c[this._dateElement]=this;return Date.now().add(c);};Number.prototype.ago=function(){var c={};c[this._dateElement]=this*-1;return Date.now().add(c);};(function(){var $D=Date.prototype,$N=Number.prototype;var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),de;var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;}
|
42
|
+
return this.moveToDayOfWeek(n,this._orient);};};for(var i=0;i<dx.length;i++){$D[dx[i]]=$D[dx[i].substring(0,3)]=df(i);}
|
43
|
+
var mf=function(n){return function(){if(this._is){this._is=false;return this.getMonth()===n;}
|
44
|
+
return this.moveToMonth(n,this._orient);};};for(var j=0;j<mx.length;j++){$D[mx[j]]=$D[mx[j].substring(0,3)]=mf(j);}
|
45
|
+
var ef=function(j){return function(){if(j.substring(j.length-1)!="s"){j+="s";}
|
46
|
+
return this["add"+j](this._orient);};};var nf=function(n){return function(){this._dateElement=n;return this;};};for(var k=0;k<px.length;k++){de=px[k].toLowerCase();$D[de]=$D[de+"s"]=ef(px[k]);$N[de]=$N[de+"s"]=nf(de);}}());Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ");};Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern);};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern);};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern);};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern);};Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};
|
47
|
+
(function(){Date.Parsing={Exception:function(s){this.message="Parse error at '"+s.substring(0,10)+" ...'";}};var $P=Date.Parsing;var _=$P.Operators={rtoken:function(r){return function(s){var mx=s.match(r);if(mx){return([mx[0],s.substring(mx[0].length)]);}else{throw new $P.Exception(s);}};},token:function(s){return function(s){return _.rtoken(new RegExp("^\s*"+s+"\s*"))(s);};},stoken:function(s){return _.rtoken(new RegExp("^"+s));},until:function(p){return function(s){var qx=[],rx=null;while(s.length){try{rx=p.call(this,s);}catch(e){qx.push(rx[0]);s=rx[1];continue;}
|
48
|
+
break;}
|
49
|
+
return[qx,s];};},many:function(p){return function(s){var rx=[],r=null;while(s.length){try{r=p.call(this,s);}catch(e){return[rx,s];}
|
50
|
+
rx.push(r[0]);s=r[1];}
|
51
|
+
return[rx,s];};},optional:function(p){return function(s){var r=null;try{r=p.call(this,s);}catch(e){return[null,s];}
|
52
|
+
return[r[0],r[1]];};},not:function(p){return function(s){try{p.call(this,s);}catch(e){return[null,s];}
|
53
|
+
throw new $P.Exception(s);};},ignore:function(p){return p?function(s){var r=null;r=p.call(this,s);return[null,r[1]];}:null;},product:function(){var px=arguments[0],qx=Array.prototype.slice.call(arguments,1),rx=[];for(var i=0;i<px.length;i++){rx.push(_.each(px[i],qx));}
|
54
|
+
return rx;},cache:function(rule){var cache={},r=null;return function(s){try{r=cache[s]=(cache[s]||rule.call(this,s));}catch(e){r=cache[s]=e;}
|
55
|
+
if(r instanceof $P.Exception){throw r;}else{return r;}};},any:function(){var px=arguments;return function(s){var r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
|
56
|
+
try{r=(px[i].call(this,s));}catch(e){r=null;}
|
57
|
+
if(r){return r;}}
|
58
|
+
throw new $P.Exception(s);};},each:function(){var px=arguments;return function(s){var rx=[],r=null;for(var i=0;i<px.length;i++){if(px[i]==null){continue;}
|
59
|
+
try{r=(px[i].call(this,s));}catch(e){throw new $P.Exception(s);}
|
60
|
+
rx.push(r[0]);s=r[1];}
|
61
|
+
return[rx,s];};},all:function(){var px=arguments,_=_;return _.each(_.optional(px));},sequence:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;if(px.length==1){return px[0];}
|
62
|
+
return function(s){var r=null,q=null;var rx=[];for(var i=0;i<px.length;i++){try{r=px[i].call(this,s);}catch(e){break;}
|
63
|
+
rx.push(r[0]);try{q=d.call(this,r[1]);}catch(ex){q=null;break;}
|
64
|
+
s=q[1];}
|
65
|
+
if(!r){throw new $P.Exception(s);}
|
66
|
+
if(q){throw new $P.Exception(q[1]);}
|
67
|
+
if(c){try{r=c.call(this,r[1]);}catch(ey){throw new $P.Exception(r[1]);}}
|
68
|
+
return[rx,(r?r[1]:s)];};},between:function(d1,p,d2){d2=d2||d1;var _fn=_.each(_.ignore(d1),p,_.ignore(d2));return function(s){var rx=_fn.call(this,s);return[[rx[0][0],r[0][2]],rx[1]];};},list:function(p,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return(p instanceof Array?_.each(_.product(p.slice(0,-1),_.ignore(d)),p.slice(-1),_.ignore(c)):_.each(_.many(_.each(p,_.ignore(d))),px,_.ignore(c)));},set:function(px,d,c){d=d||_.rtoken(/^\s*/);c=c||null;return function(s){var r=null,p=null,q=null,rx=null,best=[[],s],last=false;for(var i=0;i<px.length;i++){q=null;p=null;r=null;last=(px.length==1);try{r=px[i].call(this,s);}catch(e){continue;}
|
69
|
+
rx=[[r[0]],r[1]];if(r[1].length>0&&!last){try{q=d.call(this,r[1]);}catch(ex){last=true;}}else{last=true;}
|
70
|
+
if(!last&&q[1].length===0){last=true;}
|
71
|
+
if(!last){var qx=[];for(var j=0;j<px.length;j++){if(i!=j){qx.push(px[j]);}}
|
72
|
+
p=_.set(qx,d).call(this,q[1]);if(p[0].length>0){rx[0]=rx[0].concat(p[0]);rx[1]=p[1];}}
|
73
|
+
if(rx[1].length<best[1].length){best=rx;}
|
74
|
+
if(best[1].length===0){break;}}
|
75
|
+
if(best[0].length===0){return best;}
|
76
|
+
if(c){try{q=c.call(this,best[1]);}catch(ey){throw new $P.Exception(best[1]);}
|
77
|
+
best[1]=q[1];}
|
78
|
+
return best;};},forward:function(gr,fname){return function(s){return gr[fname].call(this,s);};},replace:function(rule,repl){return function(s){var r=rule.call(this,s);return[repl,r[1]];};},process:function(rule,fn){return function(s){var r=rule.call(this,s);return[fn.call(this,r[0]),r[1]];};},min:function(min,rule){return function(s){var rx=rule.call(this,s);if(rx[0].length<min){throw new $P.Exception(s);}
|
79
|
+
return rx;};}};var _generator=function(op){return function(){var args=null,rx=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments);}else if(arguments[0]instanceof Array){args=arguments[0];}
|
80
|
+
if(args){for(var i=0,px=args.shift();i<px.length;i++){args.unshift(px[i]);rx.push(op.apply(null,args));args.shift();return rx;}}else{return op.apply(null,arguments);}};};var gx="optional not ignore cache".split(/\s/);for(var i=0;i<gx.length;i++){_[gx[i]]=_generator(_[gx[i]]);}
|
81
|
+
var _vector=function(op){return function(){if(arguments[0]instanceof Array){return op.apply(null,arguments[0]);}else{return op.apply(null,arguments);}};};var vx="each any all".split(/\s/);for(var j=0;j<vx.length;j++){_[vx[j]]=_vector(_[vx[j]]);}}());(function(){var flattenAndCompact=function(ax){var rx=[];for(var i=0;i<ax.length;i++){if(ax[i]instanceof Array){rx=rx.concat(flattenAndCompact(ax[i]));}else{if(ax[i]){rx.push(ax[i]);}}}
|
82
|
+
return rx;};Date.Grammar={};Date.Translator={hour:function(s){return function(){this.hour=Number(s);};},minute:function(s){return function(){this.minute=Number(s);};},second:function(s){return function(){this.second=Number(s);};},meridian:function(s){return function(){this.meridian=s.slice(0,1).toLowerCase();};},timezone:function(s){return function(){var n=s.replace(/[^\d\+\-]/g,"");if(n.length){this.timezoneOffset=Number(n);}else{this.timezone=s.toLowerCase();}};},day:function(x){var s=x[0];return function(){this.day=Number(s.match(/\d+/)[0]);};},month:function(s){return function(){this.month=((s.length==3)?Date.getMonthNumberFromName(s):(Number(s)-1));};},year:function(s){return function(){var n=Number(s);this.year=((s.length>2)?n:(n+(((n+2000)<Date.CultureInfo.twoDigitYearMax)?2000:1900)));};},rday:function(s){return function(){switch(s){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break;}};},finishExact:function(x){x=(x instanceof Array)?x:[x];var now=new Date();this.year=now.getFullYear();this.month=now.getMonth();this.day=1;this.hour=0;this.minute=0;this.second=0;for(var i=0;i<x.length;i++){if(x[i]){x[i].call(this);}}
|
83
|
+
this.hour=(this.meridian=="p"&&this.hour<13)?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.");}
|
84
|
+
var r=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){r.set({timezone:this.timezone});}else if(this.timezoneOffset){r.set({timezoneOffset:this.timezoneOffset});}
|
85
|
+
return r;},finish:function(x){x=(x instanceof Array)?flattenAndCompact(x):[x];if(x.length===0){return null;}
|
86
|
+
for(var i=0;i<x.length;i++){if(typeof x[i]=="function"){x[i].call(this);}}
|
87
|
+
if(this.now){return new Date();}
|
88
|
+
var today=Date.today();var method=null;var expression=!!(this.days!=null||this.orient||this.operator);if(expression){var gap,mod,orient;orient=((this.orient=="past"||this.operator=="subtract")?-1:1);if(this.weekday){this.unit="day";gap=(Date.getDayNumberFromName(this.weekday)-today.getDay());mod=7;this.days=gap?((gap+(orient*mod))%mod):(orient*mod);}
|
89
|
+
if(this.month){this.unit="month";gap=(this.month-today.getMonth());mod=12;this.months=gap?((gap+(orient*mod))%mod):(orient*mod);this.month=null;}
|
90
|
+
if(!this.unit){this.unit="day";}
|
91
|
+
if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1;}
|
92
|
+
if(this.unit=="week"){this.unit="day";this.value=this.value*7;}
|
93
|
+
this[this.unit+"s"]=this.value*orient;}
|
94
|
+
return today.add(this);}else{if(this.meridian&&this.hour){this.hour=(this.hour<13&&this.meridian=="p")?this.hour+12:this.hour;}
|
95
|
+
if(this.weekday&&!this.day){this.day=(today.addDays((Date.getDayNumberFromName(this.weekday)-today.getDay()))).getDate();}
|
96
|
+
if(this.month&&!this.day){this.day=1;}
|
97
|
+
return today.set(this);}}};var _=Date.Parsing.Operators,g=Date.Grammar,t=Date.Translator,_fn;g.datePartDelimiter=_.rtoken(/^([\s\-\.\,\/\x27]+)/);g.timePartDelimiter=_.stoken(":");g.whiteSpace=_.rtoken(/^\s*/);g.generalDelimiter=_.rtoken(/^(([\s\,]|at|on)+)/);var _C={};g.ctoken=function(keys){var fn=_C[keys];if(!fn){var c=Date.CultureInfo.regexPatterns;var kx=keys.split(/\s+/),px=[];for(var i=0;i<kx.length;i++){px.push(_.replace(_.rtoken(c[kx[i]]),kx[i]));}
|
98
|
+
fn=_C[keys]=_.any.apply(null,px);}
|
99
|
+
return fn;};g.ctoken2=function(key){return _.rtoken(Date.CultureInfo.regexPatterns[key]);};g.h=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),t.hour));g.hh=_.cache(_.process(_.rtoken(/^(0[0-9]|1[0-2])/),t.hour));g.H=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),t.hour));g.HH=_.cache(_.process(_.rtoken(/^([0-1][0-9]|2[0-3])/),t.hour));g.m=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.minute));g.mm=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.minute));g.s=_.cache(_.process(_.rtoken(/^([0-5][0-9]|[0-9])/),t.second));g.ss=_.cache(_.process(_.rtoken(/^[0-5][0-9]/),t.second));g.hms=_.cache(_.sequence([g.H,g.mm,g.ss],g.timePartDelimiter));g.t=_.cache(_.process(g.ctoken2("shortMeridian"),t.meridian));g.tt=_.cache(_.process(g.ctoken2("longMeridian"),t.meridian));g.z=_.cache(_.process(_.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),t.timezone));g.zz=_.cache(_.process(_.rtoken(/^(\+|\-)\s*\d\d\d\d/),t.timezone));g.zzz=_.cache(_.process(g.ctoken2("timezone"),t.timezone));g.timeSuffix=_.each(_.ignore(g.whiteSpace),_.set([g.tt,g.zzz]));g.time=_.each(_.optional(_.ignore(_.stoken("T"))),g.hms,g.timeSuffix);g.d=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1]|\d)/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.dd=_.cache(_.process(_.each(_.rtoken(/^([0-2]\d|3[0-1])/),_.optional(g.ctoken2("ordinalSuffix"))),t.day));g.ddd=g.dddd=_.cache(_.process(g.ctoken("sun mon tue wed thu fri sat"),function(s){return function(){this.weekday=s;};}));g.M=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d|\d)/),t.month));g.MM=_.cache(_.process(_.rtoken(/^(1[0-2]|0\d)/),t.month));g.MMM=g.MMMM=_.cache(_.process(g.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),t.month));g.y=_.cache(_.process(_.rtoken(/^(\d\d?)/),t.year));g.yy=_.cache(_.process(_.rtoken(/^(\d\d)/),t.year));g.yyy=_.cache(_.process(_.rtoken(/^(\d\d?\d?\d?)/),t.year));g.yyyy=_.cache(_.process(_.rtoken(/^(\d\d\d\d)/),t.year));_fn=function(){return _.each(_.any.apply(null,arguments),_.not(g.ctoken2("timeContext")));};g.day=_fn(g.d,g.dd);g.month=_fn(g.M,g.MMM);g.year=_fn(g.yyyy,g.yy);g.orientation=_.process(g.ctoken("past future"),function(s){return function(){this.orient=s;};});g.operator=_.process(g.ctoken("add subtract"),function(s){return function(){this.operator=s;};});g.rday=_.process(g.ctoken("yesterday tomorrow today now"),t.rday);g.unit=_.process(g.ctoken("minute hour day week month year"),function(s){return function(){this.unit=s;};});g.value=_.process(_.rtoken(/^\d\d?(st|nd|rd|th)?/),function(s){return function(){this.value=s.replace(/\D/g,"");};});g.expression=_.set([g.rday,g.operator,g.value,g.unit,g.orientation,g.ddd,g.MMM]);_fn=function(){return _.set(arguments,g.datePartDelimiter);};g.mdy=_fn(g.ddd,g.month,g.day,g.year);g.ymd=_fn(g.ddd,g.year,g.month,g.day);g.dmy=_fn(g.ddd,g.day,g.month,g.year);g.date=function(s){return((g[Date.CultureInfo.dateElementOrder]||g.mdy).call(this,s));};g.format=_.process(_.many(_.any(_.process(_.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(fmt){if(g[fmt]){return g[fmt];}else{throw Date.Parsing.Exception(fmt);}}),_.process(_.rtoken(/^[^dMyhHmstz]+/),function(s){return _.ignore(_.stoken(s));}))),function(rules){return _.process(_.each.apply(null,rules),t.finishExact);});var _F={};var _get=function(f){return _F[f]=(_F[f]||g.format(f)[0]);};g.formats=function(fx){if(fx instanceof Array){var rx=[];for(var i=0;i<fx.length;i++){rx.push(_get(fx[i]));}
|
100
|
+
return _.any.apply(null,rx);}else{return _get(fx);}};g._formats=g.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","d"]);g._start=_.process(_.set([g.date,g.time,g.expression],g.generalDelimiter,g.whiteSpace),t.finish);g.start=function(s){try{var r=g._formats.call({},s);if(r[1].length===0){return r;}}catch(e){}
|
101
|
+
return g._start.call({},s);};}());Date._parse=Date.parse;Date.parse=function(s){var r=null;if(!s){return null;}
|
102
|
+
try{r=Date.Grammar.start.call({},s);}catch(e){return null;}
|
103
|
+
return((r[1].length===0)?r[0]:null);};Date.getParseFunction=function(fx){var fn=Date.Grammar.formats(fx);return function(s){var r=null;try{r=fn.call({},s);}catch(e){return null;}
|
104
|
+
return((r[1].length===0)?r[0]:null);};};Date.parseExact=function(s,fx){return Date.getParseFunction(fx)(s);};
|
@@ -0,0 +1,2 @@
|
|
1
|
+
!function(t){t.color={},t.color.make=function(i,e,o,n){var a={};return a.r=i||0,a.g=e||0,a.b=o||0,a.a=null!=n?n:1,a.add=function(t,i){for(var e=0;e<t.length;++e)a[t.charAt(e)]+=i;return a.normalize()},a.scale=function(t,i){for(var e=0;e<t.length;++e)a[t.charAt(e)]*=i;return a.normalize()},a.toString=function(){return a.a>=1?"rgb("+[a.r,a.g,a.b].join(",")+")":"rgba("+[a.r,a.g,a.b,a.a].join(",")+")"},a.normalize=function(){function t(t,i,e){return t>i?t:i>e?e:i}return a.r=t(0,parseInt(a.r),255),a.g=t(0,parseInt(a.g),255),a.b=t(0,parseInt(a.b),255),a.a=t(0,a.a,1),a},a.clone=function(){return t.color.make(a.r,a.b,a.g,a.a)},a.normalize()},t.color.extract=function(i,e){var o;do{if(o=i.css(e).toLowerCase(),""!=o&&"transparent"!=o)break;i=i.parent()}while(i.length&&!t.nodeName(i.get(0),"body"));return"rgba(0, 0, 0, 0)"==o&&(o="transparent"),t.color.parse(o)},t.color.parse=function(e){var o,n=t.color.make;if(o=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(e))return n(parseInt(o[1],10),parseInt(o[2],10),parseInt(o[3],10));if(o=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(e))return n(parseInt(o[1],10),parseInt(o[2],10),parseInt(o[3],10),parseFloat(o[4]));if(o=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(e))return n(2.55*parseFloat(o[1]),2.55*parseFloat(o[2]),2.55*parseFloat(o[3]));if(o=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(e))return n(2.55*parseFloat(o[1]),2.55*parseFloat(o[2]),2.55*parseFloat(o[3]),parseFloat(o[4]));if(o=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(e))return n(parseInt(o[1],16),parseInt(o[2],16),parseInt(o[3],16));if(o=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(e))return n(parseInt(o[1]+o[1],16),parseInt(o[2]+o[2],16),parseInt(o[3]+o[3],16));var a=t.trim(e).toLowerCase();return"transparent"==a?n(255,255,255,0):(o=i[a]||[0,0,0],n(o[0],o[1],o[2]))};var i={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}}(jQuery),function(t){function i(i,e){var o=e.children("."+i)[0];if(null==o&&(o=document.createElement("canvas"),o.className=i,t(o).css({direction:"ltr",position:"absolute",left:0,top:0}).appendTo(e),!o.getContext)){if(!window.G_vmlCanvasManager)throw new Error("Canvas is not available. If you're using IE with a fall-back such as Excanvas, then there's either a mistake in your conditional include, or the page has no DOCTYPE and is rendering in Quirks Mode.");o=window.G_vmlCanvasManager.initElement(o)}this.element=o;var n=this.context=o.getContext("2d"),a=window.devicePixelRatio||1,r=n.webkitBackingStorePixelRatio||n.mozBackingStorePixelRatio||n.msBackingStorePixelRatio||n.oBackingStorePixelRatio||n.backingStorePixelRatio||1;this.pixelRatio=a/r,this.resize(e.width(),e.height()),this.textContainer=null,this.text={},this._textCache={}}function e(e,n,a,r){function l(t,i){i=[xi].concat(i);for(var e=0;e<t.length;++e)t[e].apply(this,i)}function s(){for(var e={Canvas:i},o=0;o<r.length;++o){var n=r[o];n.init(xi,e),n.options&&t.extend(!0,ni,n.options)}}function c(i){t.extend(!0,ni,i),i&&i.colors&&(ni.colors=i.colors),null==ni.xaxis.color&&(ni.xaxis.color=t.color.parse(ni.grid.color).scale("a",.22).toString()),null==ni.yaxis.color&&(ni.yaxis.color=t.color.parse(ni.grid.color).scale("a",.22).toString()),null==ni.xaxis.tickColor&&(ni.xaxis.tickColor=ni.grid.tickColor||ni.xaxis.color),null==ni.yaxis.tickColor&&(ni.yaxis.tickColor=ni.grid.tickColor||ni.yaxis.color),null==ni.grid.borderColor&&(ni.grid.borderColor=ni.grid.color),null==ni.grid.tickColor&&(ni.grid.tickColor=t.color.parse(ni.grid.color).scale("a",.22).toString());var o,n,a,r=e.css("font-size"),s=r?+r.replace("px",""):13,c={style:e.css("font-style"),size:Math.round(.8*s),variant:e.css("font-variant"),weight:e.css("font-weight"),family:e.css("font-family")};for(a=ni.xaxes.length||1,o=0;a>o;++o)n=ni.xaxes[o],n&&!n.tickColor&&(n.tickColor=n.color),n=t.extend(!0,{},ni.xaxis,n),ni.xaxes[o]=n,n.font&&(n.font=t.extend({},c,n.font),n.font.color||(n.font.color=n.color),n.font.lineHeight||(n.font.lineHeight=Math.round(1.15*n.font.size)));for(a=ni.yaxes.length||1,o=0;a>o;++o)n=ni.yaxes[o],n&&!n.tickColor&&(n.tickColor=n.color),n=t.extend(!0,{},ni.yaxis,n),ni.yaxes[o]=n,n.font&&(n.font=t.extend({},c,n.font),n.font.color||(n.font.color=n.color),n.font.lineHeight||(n.font.lineHeight=Math.round(1.15*n.font.size)));for(ni.xaxis.noTicks&&null==ni.xaxis.ticks&&(ni.xaxis.ticks=ni.xaxis.noTicks),ni.yaxis.noTicks&&null==ni.yaxis.ticks&&(ni.yaxis.ticks=ni.yaxis.noTicks),ni.x2axis&&(ni.xaxes[1]=t.extend(!0,{},ni.xaxis,ni.x2axis),ni.xaxes[1].position="top",null==ni.x2axis.min&&(ni.xaxes[1].min=null),null==ni.x2axis.max&&(ni.xaxes[1].max=null)),ni.y2axis&&(ni.yaxes[1]=t.extend(!0,{},ni.yaxis,ni.y2axis),ni.yaxes[1].position="right",null==ni.y2axis.min&&(ni.yaxes[1].min=null),null==ni.y2axis.max&&(ni.yaxes[1].max=null)),ni.grid.coloredAreas&&(ni.grid.markings=ni.grid.coloredAreas),ni.grid.coloredAreasColor&&(ni.grid.markingsColor=ni.grid.coloredAreasColor),ni.lines&&t.extend(!0,ni.series.lines,ni.lines),ni.points&&t.extend(!0,ni.series.points,ni.points),ni.bars&&t.extend(!0,ni.series.bars,ni.bars),null!=ni.shadowSize&&(ni.series.shadowSize=ni.shadowSize),null!=ni.highlightColor&&(ni.series.highlightColor=ni.highlightColor),o=0;o<ni.xaxes.length;++o)x(hi,o+1).options=ni.xaxes[o];for(o=0;o<ni.yaxes.length;++o)x(fi,o+1).options=ni.yaxes[o];for(var h in mi)ni.hooks[h]&&ni.hooks[h].length&&(mi[h]=mi[h].concat(ni.hooks[h]));l(mi.processOptions,[ni])}function h(t){oi=f(t),g(),b()}function f(i){for(var e=[],o=0;o<i.length;++o){var n=t.extend(!0,{},ni.series);null!=i[o].data?(n.data=i[o].data,delete i[o].data,t.extend(!0,n,i[o]),i[o].data=n.data):n.data=i[o],e.push(n)}return e}function u(t,i){var e=t[i+"axis"];return"object"==typeof e&&(e=e.n),"number"!=typeof e&&(e=1),e}function d(){return t.grep(hi.concat(fi),function(t){return t})}function p(t){var i,e,o={};for(i=0;i<hi.length;++i)e=hi[i],e&&e.used&&(o["x"+e.n]=e.c2p(t.left));for(i=0;i<fi.length;++i)e=fi[i],e&&e.used&&(o["y"+e.n]=e.c2p(t.top));return void 0!==o.x1&&(o.x=o.x1),void 0!==o.y1&&(o.y=o.y1),o}function m(t){var i,e,o,n={};for(i=0;i<hi.length;++i)if(e=hi[i],e&&e.used&&(o="x"+e.n,null==t[o]&&1==e.n&&(o="x"),null!=t[o])){n.left=e.p2c(t[o]);break}for(i=0;i<fi.length;++i)if(e=fi[i],e&&e.used&&(o="y"+e.n,null==t[o]&&1==e.n&&(o="y"),null!=t[o])){n.top=e.p2c(t[o]);break}return n}function x(i,e){return i[e-1]||(i[e-1]={n:e,direction:i==hi?"x":"y",options:t.extend(!0,{},i==hi?ni.xaxis:ni.yaxis)}),i[e-1]}function g(){var i,e=oi.length,o=-1;for(i=0;i<oi.length;++i){var n=oi[i].color;null!=n&&(e--,"number"==typeof n&&n>o&&(o=n))}o>=e&&(e=o+1);var a,r=[],l=ni.colors,s=l.length,c=0;for(i=0;e>i;i++)a=t.color.parse(l[i%s]||"#666"),i%s==0&&i&&(c=c>=0?.5>c?-c-.2:0:-c),r[i]=a.scale("rgb",1+c);var h,f=0;for(i=0;i<oi.length;++i){if(h=oi[i],null==h.color?(h.color=r[f].toString(),++f):"number"==typeof h.color&&(h.color=r[h.color].toString()),null==h.lines.show){var d,p=!0;for(d in h)if(h[d]&&h[d].show){p=!1;break}p&&(h.lines.show=!0)}null==h.lines.zero&&(h.lines.zero=!!h.lines.fill),h.xaxis=x(hi,u(h,"x")),h.yaxis=x(fi,u(h,"y"))}}function b(){function i(t,i,e){i<t.datamin&&i!=-b&&(t.datamin=i),e>t.datamax&&e!=b&&(t.datamax=e)}var e,o,n,a,r,s,c,h,f,u,p,m,x=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,b=Number.MAX_VALUE;for(t.each(d(),function(t,i){i.datamin=x,i.datamax=g,i.used=!1}),e=0;e<oi.length;++e)r=oi[e],r.datapoints={points:[]},l(mi.processRawData,[r,r.data,r.datapoints]);for(e=0;e<oi.length;++e){if(r=oi[e],p=r.data,m=r.datapoints.format,!m){if(m=[],m.push({x:!0,number:!0,required:!0}),m.push({y:!0,number:!0,required:!0}),r.bars.show||r.lines.show&&r.lines.fill){var v=!!(r.bars.show&&r.bars.zero||r.lines.show&&r.lines.zero);m.push({y:!0,number:!0,required:!1,defaultValue:0,autoscale:v}),r.bars.horizontal&&(delete m[m.length-1].y,m[m.length-1].x=!0)}r.datapoints.format=m}if(null==r.datapoints.pointsize){r.datapoints.pointsize=m.length,c=r.datapoints.pointsize,s=r.datapoints.points;var k=r.lines.show&&r.lines.steps;for(r.xaxis.used=r.yaxis.used=!0,o=n=0;o<p.length;++o,n+=c){u=p[o];var y=null==u;if(!y)for(a=0;c>a;++a)h=u[a],f=m[a],f&&(f.number&&null!=h&&(h=+h,isNaN(h)?h=null:1/0==h?h=b:h==-1/0&&(h=-b)),null==h&&(f.required&&(y=!0),null!=f.defaultValue&&(h=f.defaultValue))),s[n+a]=h;if(y)for(a=0;c>a;++a)h=s[n+a],null!=h&&(f=m[a],f.autoscale!==!1&&(f.x&&i(r.xaxis,h,h),f.y&&i(r.yaxis,h,h))),s[n+a]=null;else if(k&&n>0&&null!=s[n-c]&&s[n-c]!=s[n]&&s[n-c+1]!=s[n+1]){for(a=0;c>a;++a)s[n+c+a]=s[n+a];s[n+1]=s[n-c+1],n+=c}}}}for(e=0;e<oi.length;++e)r=oi[e],l(mi.processDatapoints,[r,r.datapoints]);for(e=0;e<oi.length;++e){r=oi[e],s=r.datapoints.points,c=r.datapoints.pointsize,m=r.datapoints.format;var w=x,M=x,T=g,C=g;for(o=0;o<s.length;o+=c)if(null!=s[o])for(a=0;c>a;++a)h=s[o+a],f=m[a],f&&f.autoscale!==!1&&h!=b&&h!=-b&&(f.x&&(w>h&&(w=h),h>T&&(T=h)),f.y&&(M>h&&(M=h),h>C&&(C=h)));if(r.bars.show){var S;switch(r.bars.align){case"left":S=0;break;case"right":S=-r.bars.barWidth;break;default:S=-r.bars.barWidth/2}r.bars.horizontal?(M+=S,C+=S+r.bars.barWidth):(w+=S,T+=S+r.bars.barWidth)}i(r.xaxis,w,T),i(r.yaxis,M,C)}t.each(d(),function(t,i){i.datamin==x&&(i.datamin=null),i.datamax==g&&(i.datamax=null)})}function v(){e.css("padding",0).children().filter(function(){return!t(this).hasClass("flot-overlay")&&!t(this).hasClass("flot-base")}).remove(),"static"==e.css("position")&&e.css("position","relative"),ai=new i("flot-base",e),ri=new i("flot-overlay",e),si=ai.context,ci=ri.context,li=t(ri.element).unbind();var o=e.data("plot");o&&(o.shutdown(),ri.clear()),e.data("plot",xi)}function k(){ni.grid.hoverable&&(li.mousemove(X),li.bind("mouseleave",Y)),ni.grid.clickable&&li.click(q),l(mi.bindEvents,[li])}function y(){bi&&clearTimeout(bi),li.unbind("mousemove",X),li.unbind("mouseleave",Y),li.unbind("click",q),l(mi.shutdown,[li])}function w(t){function i(t){return t}var e,o,n=t.options.transform||i,a=t.options.inverseTransform;"x"==t.direction?(e=t.scale=di/Math.abs(n(t.max)-n(t.min)),o=Math.min(n(t.max),n(t.min))):(e=t.scale=pi/Math.abs(n(t.max)-n(t.min)),e=-e,o=Math.max(n(t.max),n(t.min))),t.p2c=n==i?function(t){return(t-o)*e}:function(t){return(n(t)-o)*e},t.c2p=a?function(t){return a(o+t/e)}:function(t){return o+t/e}}function M(t){for(var i=t.options,e=t.ticks||[],o=i.labelWidth||0,n=i.labelHeight||0,a=o||("x"==t.direction?Math.floor(ai.width/(e.length||1)):null),r=t.direction+"Axis "+t.direction+t.n+"Axis",l="flot-"+t.direction+"-axis flot-"+t.direction+t.n+"-axis "+r,s=i.font||"flot-tick-label tickLabel",c=0;c<e.length;++c){var h=e[c];if(h.label){var f=ai.getTextInfo(l,h.label,s,null,a);o=Math.max(o,f.width),n=Math.max(n,f.height)}}t.labelWidth=i.labelWidth||o,t.labelHeight=i.labelHeight||n}function T(i){var e=i.labelWidth,o=i.labelHeight,n=i.options.position,a="x"===i.direction,r=i.options.tickLength,l=ni.grid.axisMargin,s=ni.grid.labelMargin,c=!0,h=!0,f=!0,u=!1;t.each(a?hi:fi,function(t,e){e&&(e.show||e.reserveSpace)&&(e===i?u=!0:e.options.position===n&&(u?h=!1:c=!1),u||(f=!1))}),h&&(l=0),null==r&&(r=f?"full":5),isNaN(+r)||(s+=+r),a?(o+=s,"bottom"==n?(ui.bottom+=o+l,i.box={top:ai.height-ui.bottom,height:o}):(i.box={top:ui.top+l,height:o},ui.top+=o+l)):(e+=s,"left"==n?(i.box={left:ui.left+l,width:e},ui.left+=e+l):(ui.right+=e+l,i.box={left:ai.width-ui.right,width:e})),i.position=n,i.tickLength=r,i.box.padding=s,i.innermost=c}function C(t){"x"==t.direction?(t.box.left=ui.left-t.labelWidth/2,t.box.width=ai.width-ui.left-ui.right+t.labelWidth):(t.box.top=ui.top-t.labelHeight/2,t.box.height=ai.height-ui.bottom-ui.top+t.labelHeight)}function S(){var i,e=ni.grid.minBorderMargin;if(null==e)for(e=0,i=0;i<oi.length;++i)e=Math.max(e,2*(oi[i].points.radius+oi[i].points.lineWidth/2));var o={left:e,right:e,top:e,bottom:e};t.each(d(),function(t,i){i.reserveSpace&&i.ticks&&i.ticks.length&&("x"===i.direction?(o.left=Math.max(o.left,i.labelWidth/2),o.right=Math.max(o.right,i.labelWidth/2)):(o.bottom=Math.max(o.bottom,i.labelHeight/2),o.top=Math.max(o.top,i.labelHeight/2)))}),ui.left=Math.ceil(Math.max(o.left,ui.left)),ui.right=Math.ceil(Math.max(o.right,ui.right)),ui.top=Math.ceil(Math.max(o.top,ui.top)),ui.bottom=Math.ceil(Math.max(o.bottom,ui.bottom))}function W(){var i,e=d(),o=ni.grid.show;for(var n in ui){var a=ni.grid.margin||0;ui[n]="number"==typeof a?a:a[n]||0}l(mi.processOffset,[ui]);for(var n in ui)ui[n]+="object"==typeof ni.grid.borderWidth?o?ni.grid.borderWidth[n]:0:o?ni.grid.borderWidth:0;if(t.each(e,function(t,i){var e=i.options;i.show=null==e.show?i.used:e.show,i.reserveSpace=null==e.reserveSpace?i.show:e.reserveSpace,z(i)}),o){var r=t.grep(e,function(t){return t.show||t.reserveSpace});for(t.each(r,function(t,i){I(i),A(i),F(i,i.ticks),M(i)}),i=r.length-1;i>=0;--i)T(r[i]);S(),t.each(r,function(t,i){C(i)})}di=ai.width-ui.left-ui.right,pi=ai.height-ui.bottom-ui.top,t.each(e,function(t,i){w(i)}),o&&O(),_()}function z(t){var i=t.options,e=+(null!=i.min?i.min:t.datamin),o=+(null!=i.max?i.max:t.datamax),n=o-e;if(0==n){var a=0==o?1:.01;null==i.min&&(e-=a),(null==i.max||null!=i.min)&&(o+=a)}else{var r=i.autoscaleMargin;null!=r&&(null==i.min&&(e-=n*r,0>e&&null!=t.datamin&&t.datamin>=0&&(e=0)),null==i.max&&(o+=n*r,o>0&&null!=t.datamax&&t.datamax<=0&&(o=0)))}t.min=e,t.max=o}function I(i){var e,n=i.options;e="number"==typeof n.ticks&&n.ticks>0?n.ticks:.3*Math.sqrt("x"==i.direction?ai.width:ai.height);var a=(i.max-i.min)/e,r=-Math.floor(Math.log(a)/Math.LN10),l=n.tickDecimals;null!=l&&r>l&&(r=l);var s,c=Math.pow(10,-r),h=a/c;if(1.5>h?s=1:3>h?(s=2,h>2.25&&(null==l||l>=r+1)&&(s=2.5,++r)):s=7.5>h?5:10,s*=c,null!=n.minTickSize&&s<n.minTickSize&&(s=n.minTickSize),i.delta=a,i.tickDecimals=Math.max(0,null!=l?l:r),i.tickSize=n.tickSize||s,"time"==n.mode&&!i.tickGenerator)throw new Error("Time mode requires the flot.time plugin.");if(i.tickGenerator||(i.tickGenerator=function(t){var i,e=[],n=o(t.min,t.tickSize),a=0,r=Number.NaN;do i=r,r=n+a*t.tickSize,e.push(r),++a;while(r<t.max&&r!=i);return e},i.tickFormatter=function(t,i){var e=i.tickDecimals?Math.pow(10,i.tickDecimals):1,o=""+Math.round(t*e)/e;if(null!=i.tickDecimals){var n=o.indexOf("."),a=-1==n?0:o.length-n-1;if(a<i.tickDecimals)return(a?o:o+".")+(""+e).substr(1,i.tickDecimals-a)}return o}),t.isFunction(n.tickFormatter)&&(i.tickFormatter=function(t,i){return""+n.tickFormatter(t,i)}),null!=n.alignTicksWithAxis){var f=("x"==i.direction?hi:fi)[n.alignTicksWithAxis-1];if(f&&f.used&&f!=i){var u=i.tickGenerator(i);if(u.length>0&&(null==n.min&&(i.min=Math.min(i.min,u[0])),null==n.max&&u.length>1&&(i.max=Math.max(i.max,u[u.length-1]))),i.tickGenerator=function(t){var i,e,o=[];for(e=0;e<f.ticks.length;++e)i=(f.ticks[e].v-f.min)/(f.max-f.min),i=t.min+i*(t.max-t.min),o.push(i);return o},!i.mode&&null==n.tickDecimals){var d=Math.max(0,-Math.floor(Math.log(i.delta)/Math.LN10)+1),p=i.tickGenerator(i);p.length>1&&/\..*0$/.test((p[1]-p[0]).toFixed(d))||(i.tickDecimals=d)}}}}function A(i){var e=i.options.ticks,o=[];null==e||"number"==typeof e&&e>0?o=i.tickGenerator(i):e&&(o=t.isFunction(e)?e(i):e);var n,a;for(i.ticks=[],n=0;n<o.length;++n){var r=null,l=o[n];"object"==typeof l?(a=+l[0],l.length>1&&(r=l[1])):a=+l,null==r&&(r=i.tickFormatter(a,i)),isNaN(a)||i.ticks.push({v:a,label:r})}}function F(t,i){t.options.autoscaleMargin&&i.length>0&&(null==t.options.min&&(t.min=Math.min(t.min,i[0].v)),null==t.options.max&&i.length>1&&(t.max=Math.max(t.max,i[i.length-1].v)))}function P(){ai.clear(),l(mi.drawBackground,[si]);var t=ni.grid;t.show&&t.backgroundColor&&D(),t.show&&!t.aboveData&&L();for(var i=0;i<oi.length;++i)l(mi.drawSeries,[si,oi[i]]),R(oi[i]);l(mi.draw,[si]),t.show&&t.aboveData&&L(),ai.render(),U()}function N(t,i){for(var e,o,n,a,r=d(),l=0;l<r.length;++l)if(e=r[l],e.direction==i&&(a=i+e.n+"axis",t[a]||1!=e.n||(a=i+"axis"),t[a])){o=t[a].from,n=t[a].to;break}if(t[a]||(e="x"==i?hi[0]:fi[0],o=t[i+"1"],n=t[i+"2"]),null!=o&&null!=n&&o>n){var s=o;o=n,n=s}return{from:o,to:n,axis:e}}function D(){si.save(),si.translate(ui.left,ui.top),si.fillStyle=ei(ni.grid.backgroundColor,pi,0,"rgba(255, 255, 255, 0)"),si.fillRect(0,0,di,pi),si.restore()}function L(){var i,e,o,n;si.save(),si.translate(ui.left,ui.top);var a=ni.grid.markings;if(a)for(t.isFunction(a)&&(e=xi.getAxes(),e.xmin=e.xaxis.min,e.xmax=e.xaxis.max,e.ymin=e.yaxis.min,e.ymax=e.yaxis.max,a=a(e)),i=0;i<a.length;++i){var r=a[i],l=N(r,"x"),s=N(r,"y");if(null==l.from&&(l.from=l.axis.min),null==l.to&&(l.to=l.axis.max),null==s.from&&(s.from=s.axis.min),null==s.to&&(s.to=s.axis.max),!(l.to<l.axis.min||l.from>l.axis.max||s.to<s.axis.min||s.from>s.axis.max)){l.from=Math.max(l.from,l.axis.min),l.to=Math.min(l.to,l.axis.max),s.from=Math.max(s.from,s.axis.min),s.to=Math.min(s.to,s.axis.max);var c=l.from===l.to,h=s.from===s.to;if(!c||!h)if(l.from=Math.floor(l.axis.p2c(l.from)),l.to=Math.floor(l.axis.p2c(l.to)),s.from=Math.floor(s.axis.p2c(s.from)),s.to=Math.floor(s.axis.p2c(s.to)),c||h){var f=r.lineWidth||ni.grid.markingsLineWidth,u=f%2?.5:0;si.beginPath(),si.strokeStyle=r.color||ni.grid.markingsColor,si.lineWidth=f,c?(si.moveTo(l.to+u,s.from),si.lineTo(l.to+u,s.to)):(si.moveTo(l.from,s.to+u),si.lineTo(l.to,s.to+u)),si.stroke()}else si.fillStyle=r.color||ni.grid.markingsColor,si.fillRect(l.from,s.to,l.to-l.from,s.from-s.to)}}e=d(),o=ni.grid.borderWidth;for(var p=0;p<e.length;++p){var m,x,g,b,v=e[p],k=v.box,y=v.tickLength;if(v.show&&0!=v.ticks.length){for(si.lineWidth=1,"x"==v.direction?(m=0,x="full"==y?"top"==v.position?0:pi:k.top-ui.top+("top"==v.position?k.height:0)):(x=0,m="full"==y?"left"==v.position?0:di:k.left-ui.left+("left"==v.position?k.width:0)),v.innermost||(si.strokeStyle=v.options.color,si.beginPath(),g=b=0,"x"==v.direction?g=di+1:b=pi+1,1==si.lineWidth&&("x"==v.direction?x=Math.floor(x)+.5:m=Math.floor(m)+.5),si.moveTo(m,x),si.lineTo(m+g,x+b),si.stroke()),si.strokeStyle=v.options.tickColor,si.beginPath(),i=0;i<v.ticks.length;++i){var w=v.ticks[i].v;g=b=0,isNaN(w)||w<v.min||w>v.max||"full"==y&&("object"==typeof o&&o[v.position]>0||o>0)&&(w==v.min||w==v.max)||("x"==v.direction?(m=v.p2c(w),b="full"==y?-pi:y,"top"==v.position&&(b=-b)):(x=v.p2c(w),g="full"==y?-di:y,"left"==v.position&&(g=-g)),1==si.lineWidth&&("x"==v.direction?m=Math.floor(m)+.5:x=Math.floor(x)+.5),si.moveTo(m,x),si.lineTo(m+g,x+b))}si.stroke()}}o&&(n=ni.grid.borderColor,"object"==typeof o||"object"==typeof n?("object"!=typeof o&&(o={top:o,right:o,bottom:o,left:o}),"object"!=typeof n&&(n={top:n,right:n,bottom:n,left:n}),o.top>0&&(si.strokeStyle=n.top,si.lineWidth=o.top,si.beginPath(),si.moveTo(0-o.left,0-o.top/2),si.lineTo(di,0-o.top/2),si.stroke()),o.right>0&&(si.strokeStyle=n.right,si.lineWidth=o.right,si.beginPath(),si.moveTo(di+o.right/2,0-o.top),si.lineTo(di+o.right/2,pi),si.stroke()),o.bottom>0&&(si.strokeStyle=n.bottom,si.lineWidth=o.bottom,si.beginPath(),si.moveTo(di+o.right,pi+o.bottom/2),si.lineTo(0,pi+o.bottom/2),si.stroke()),o.left>0&&(si.strokeStyle=n.left,si.lineWidth=o.left,si.beginPath(),si.moveTo(0-o.left/2,pi+o.bottom),si.lineTo(0-o.left/2,0),si.stroke())):(si.lineWidth=o,si.strokeStyle=ni.grid.borderColor,si.strokeRect(-o/2,-o/2,di+o,pi+o))),si.restore()}function O(){t.each(d(),function(t,i){var e,o,n,a,r,l=i.box,s=i.direction+"Axis "+i.direction+i.n+"Axis",c="flot-"+i.direction+"-axis flot-"+i.direction+i.n+"-axis "+s,h=i.options.font||"flot-tick-label tickLabel";if(ai.removeText(c),i.show&&0!=i.ticks.length)for(var f=0;f<i.ticks.length;++f)e=i.ticks[f],!e.label||e.v<i.min||e.v>i.max||("x"==i.direction?(a="center",o=ui.left+i.p2c(e.v),"bottom"==i.position?n=l.top+l.padding:(n=l.top+l.height-l.padding,r="bottom")):(r="middle",n=ui.top+i.p2c(e.v),"left"==i.position?(o=l.left+l.width-l.padding,a="right"):o=l.left+l.padding),ai.addText(c,o,n,e.label,h,null,null,a,r))})}function R(t){t.lines.show&&H(t),t.bars.show&&B(t),t.points.show&&j(t)}function H(t){function i(t,i,e,o,n){var a=t.points,r=t.pointsize,l=null,s=null;si.beginPath();for(var c=r;c<a.length;c+=r){var h=a[c-r],f=a[c-r+1],u=a[c],d=a[c+1];if(null!=h&&null!=u){if(d>=f&&f<n.min){if(d<n.min)continue;h=(n.min-f)/(d-f)*(u-h)+h,f=n.min}else if(f>=d&&d<n.min){if(f<n.min)continue;u=(n.min-f)/(d-f)*(u-h)+h,d=n.min}if(f>=d&&f>n.max){if(d>n.max)continue;h=(n.max-f)/(d-f)*(u-h)+h,f=n.max}else if(d>=f&&d>n.max){if(f>n.max)continue;u=(n.max-f)/(d-f)*(u-h)+h,d=n.max}if(u>=h&&h<o.min){if(u<o.min)continue;f=(o.min-h)/(u-h)*(d-f)+f,h=o.min}else if(h>=u&&u<o.min){if(h<o.min)continue;d=(o.min-h)/(u-h)*(d-f)+f,u=o.min}if(h>=u&&h>o.max){if(u>o.max)continue;f=(o.max-h)/(u-h)*(d-f)+f,h=o.max}else if(u>=h&&u>o.max){if(h>o.max)continue;d=(o.max-h)/(u-h)*(d-f)+f,u=o.max}(h!=l||f!=s)&&si.moveTo(o.p2c(h)+i,n.p2c(f)+e),l=u,s=d,si.lineTo(o.p2c(u)+i,n.p2c(d)+e)}}si.stroke()}function e(t,i,e){for(var o=t.points,n=t.pointsize,a=Math.min(Math.max(0,e.min),e.max),r=0,l=!1,s=1,c=0,h=0;;){if(n>0&&r>o.length+n)break;r+=n;var f=o[r-n],u=o[r-n+s],d=o[r],p=o[r+s];if(l){if(n>0&&null!=f&&null==d){h=r,n=-n,s=2;continue}if(0>n&&r==c+n){si.fill(),l=!1,n=-n,s=1,r=c=h+n;continue}}if(null!=f&&null!=d){if(d>=f&&f<i.min){if(d<i.min)continue;u=(i.min-f)/(d-f)*(p-u)+u,f=i.min}else if(f>=d&&d<i.min){if(f<i.min)continue;p=(i.min-f)/(d-f)*(p-u)+u,d=i.min}if(f>=d&&f>i.max){if(d>i.max)continue;u=(i.max-f)/(d-f)*(p-u)+u,f=i.max}else if(d>=f&&d>i.max){if(f>i.max)continue;p=(i.max-f)/(d-f)*(p-u)+u,d=i.max}if(l||(si.beginPath(),si.moveTo(i.p2c(f),e.p2c(a)),l=!0),u>=e.max&&p>=e.max)si.lineTo(i.p2c(f),e.p2c(e.max)),si.lineTo(i.p2c(d),e.p2c(e.max));else if(u<=e.min&&p<=e.min)si.lineTo(i.p2c(f),e.p2c(e.min)),si.lineTo(i.p2c(d),e.p2c(e.min));else{var m=f,x=d;p>=u&&u<e.min&&p>=e.min?(f=(e.min-u)/(p-u)*(d-f)+f,u=e.min):u>=p&&p<e.min&&u>=e.min&&(d=(e.min-u)/(p-u)*(d-f)+f,p=e.min),u>=p&&u>e.max&&p<=e.max?(f=(e.max-u)/(p-u)*(d-f)+f,u=e.max):p>=u&&p>e.max&&u<=e.max&&(d=(e.max-u)/(p-u)*(d-f)+f,p=e.max),f!=m&&si.lineTo(i.p2c(m),e.p2c(u)),si.lineTo(i.p2c(f),e.p2c(u)),si.lineTo(i.p2c(d),e.p2c(p)),d!=x&&(si.lineTo(i.p2c(d),e.p2c(p)),si.lineTo(i.p2c(x),e.p2c(p)))}}}}si.save(),si.translate(ui.left,ui.top),si.lineJoin="round";var o=t.lines.lineWidth,n=t.shadowSize;if(o>0&&n>0){si.lineWidth=n,si.strokeStyle="rgba(0,0,0,0.1)";var a=Math.PI/18;i(t.datapoints,Math.sin(a)*(o/2+n/2),Math.cos(a)*(o/2+n/2),t.xaxis,t.yaxis),si.lineWidth=n/2,i(t.datapoints,Math.sin(a)*(o/2+n/4),Math.cos(a)*(o/2+n/4),t.xaxis,t.yaxis)}si.lineWidth=o,si.strokeStyle=t.color;var r=G(t.lines,t.color,0,pi);r&&(si.fillStyle=r,e(t.datapoints,t.xaxis,t.yaxis)),o>0&&i(t.datapoints,0,0,t.xaxis,t.yaxis),si.restore()}function j(t){function i(t,i,e,o,n,a,r,l){for(var s=t.points,c=t.pointsize,h=0;h<s.length;h+=c){var f=s[h],u=s[h+1];null==f||f<a.min||f>a.max||u<r.min||u>r.max||(si.beginPath(),f=a.p2c(f),u=r.p2c(u)+o,"circle"==l?si.arc(f,u,i,0,n?Math.PI:2*Math.PI,!1):l(si,f,u,i,n),si.closePath(),e&&(si.fillStyle=e,si.fill()),si.stroke())}}si.save(),si.translate(ui.left,ui.top);var e=t.points.lineWidth,o=t.shadowSize,n=t.points.radius,a=t.points.symbol;if(0==e&&(e=1e-4),e>0&&o>0){var r=o/2;si.lineWidth=r,si.strokeStyle="rgba(0,0,0,0.1)",i(t.datapoints,n,null,r+r/2,!0,t.xaxis,t.yaxis,a),si.strokeStyle="rgba(0,0,0,0.2)",i(t.datapoints,n,null,r/2,!0,t.xaxis,t.yaxis,a)}si.lineWidth=e,si.strokeStyle=t.color,i(t.datapoints,n,G(t.points,t.color),0,!1,t.xaxis,t.yaxis,a),si.restore()}function E(t,i,e,o,n,a,r,l,s,c,h){var f,u,d,p,m,x,g,b,v;c?(b=x=g=!0,m=!1,f=e,u=t,p=i+o,d=i+n,f>u&&(v=u,u=f,f=v,m=!0,x=!1)):(m=x=g=!0,b=!1,f=t+o,u=t+n,d=e,p=i,d>p&&(v=p,p=d,d=v,b=!0,g=!1)),u<r.min||f>r.max||p<l.min||d>l.max||(f<r.min&&(f=r.min,m=!1),u>r.max&&(u=r.max,x=!1),d<l.min&&(d=l.min,b=!1),p>l.max&&(p=l.max,g=!1),f=r.p2c(f),d=l.p2c(d),u=r.p2c(u),p=l.p2c(p),a&&(s.fillStyle=a(d,p),s.fillRect(f,p,u-f,d-p)),h>0&&(m||x||g||b)&&(s.beginPath(),s.moveTo(f,d),m?s.lineTo(f,p):s.moveTo(f,p),g?s.lineTo(u,p):s.moveTo(u,p),x?s.lineTo(u,d):s.moveTo(u,d),b?s.lineTo(f,d):s.moveTo(f,d),s.stroke()))}function B(t){function i(i,e,o,n,a,r){for(var l=i.points,s=i.pointsize,c=0;c<l.length;c+=s)null!=l[c]&&E(l[c],l[c+1],l[c+2],e,o,n,a,r,si,t.bars.horizontal,t.bars.lineWidth)}si.save(),si.translate(ui.left,ui.top),si.lineWidth=t.bars.lineWidth,si.strokeStyle=t.color;var e;switch(t.bars.align){case"left":e=0;break;case"right":e=-t.bars.barWidth;break;default:e=-t.bars.barWidth/2}var o=t.bars.fill?function(i,e){return G(t.bars,t.color,i,e)}:null;i(t.datapoints,e,e+t.bars.barWidth,o,t.xaxis,t.yaxis),si.restore()}function G(i,e,o,n){var a=i.fill;if(!a)return null;if(i.fillColor)return ei(i.fillColor,o,n,e);var r=t.color.parse(e);return r.a="number"==typeof a?a:.4,r.normalize(),r.toString()}function _(){if(null!=ni.legend.container?t(ni.legend.container).html(""):e.find(".legend").remove(),ni.legend.show){for(var i,o,n=[],a=[],r=!1,l=ni.legend.labelFormatter,s=0;s<oi.length;++s)i=oi[s],i.label&&(o=l?l(i.label,i):i.label,o&&a.push({label:o,color:i.color}));if(ni.legend.sorted)if(t.isFunction(ni.legend.sorted))a.sort(ni.legend.sorted);else if("reverse"==ni.legend.sorted)a.reverse();else{var c="descending"!=ni.legend.sorted;a.sort(function(t,i){return t.label==i.label?0:t.label<i.label!=c?1:-1})}for(var s=0;s<a.length;++s){var h=a[s];s%ni.legend.noColumns==0&&(r&&n.push("</tr>"),n.push("<tr>"),r=!0),n.push('<td class="legendColorBox"><div style="border:1px solid '+ni.legend.labelBoxBorderColor+';padding:1px"><div style="width:4px;height:0;border:5px solid '+h.color+';overflow:hidden"></div></div></td><td class="legendLabel">'+h.label+"</td>")}if(r&&n.push("</tr>"),0!=n.length){var f='<table style="font-size:smaller;color:'+ni.grid.color+'">'+n.join("")+"</table>";if(null!=ni.legend.container)t(ni.legend.container).html(f);else{var u="",d=ni.legend.position,p=ni.legend.margin;null==p[0]&&(p=[p,p]),"n"==d.charAt(0)?u+="top:17px;":"s"==d.charAt(0)&&(u+="bottom:"+(p[1]+ui.bottom)+"px;"),"e"==d.charAt(1)?u+="right:"+(p[0]+ui.right)+"px;":"w"==d.charAt(1)&&(u+="left:"+(p[0]+ui.left)+"px;");var m=t('<div class="legend">'+f.replace('style="','style="position:absolute;'+u+";")+"</div>").appendTo(e);if(0!=ni.legend.backgroundOpacity){var x=ni.legend.backgroundColor;null==x&&(x=ni.grid.backgroundColor,x=x&&"string"==typeof x?t.color.parse(x):t.color.extract(m,"background-color"),x.a=1,x=x.toString());var g=m.children();t('<div style="position:absolute;width:'+g.width()+"px;height:"+g.height()+"px;"+u+"background-color:"+x+';"> </div>').prependTo(m).css("opacity",ni.legend.backgroundOpacity)}}}}}function V(t,i,e){var o,n,a,r=ni.grid.mouseActiveRadius,l=r*r+1,s=null;for(o=oi.length-1;o>=0;--o)if(e(oi[o])){var c=oi[o],h=c.xaxis,f=c.yaxis,u=c.datapoints.points,d=h.c2p(t),p=f.c2p(i),m=r/h.scale,x=r/f.scale;if(a=c.datapoints.pointsize,h.options.inverseTransform&&(m=Number.MAX_VALUE),f.options.inverseTransform&&(x=Number.MAX_VALUE),c.lines.show||c.points.show)for(n=0;n<u.length;n+=a){var g=u[n],b=u[n+1];if(null!=g&&!(g-d>m||-m>g-d||b-p>x||-x>b-p)){var v=Math.abs(h.p2c(g)-t),k=Math.abs(f.p2c(b)-i),y=v*v+k*k;l>y&&(l=y,s=[o,n/a])}}if(c.bars.show&&!s){var w,M;switch(c.bars.align){case"left":w=0;break;case"right":w=-c.bars.barWidth;break;default:w=-c.bars.barWidth/2}for(M=w+c.bars.barWidth,n=0;n<u.length;n+=a){var g=u[n],b=u[n+1],T=u[n+2];null!=g&&(oi[o].bars.horizontal?d<=Math.max(T,g)&&d>=Math.min(T,g)&&p>=b+w&&b+M>=p:d>=g+w&&g+M>=d&&p>=Math.min(T,b)&&p<=Math.max(T,b))&&(s=[o,n/a])}}}return s?(o=s[0],n=s[1],a=oi[o].datapoints.pointsize,{datapoint:oi[o].datapoints.points.slice(n*a,(n+1)*a),dataIndex:n,series:oi[o],seriesIndex:o}):null}function X(t){ni.grid.hoverable&&Q("plothover",t,function(t){return 0!=t.hoverable})}function Y(t){ni.grid.hoverable&&Q("plothover",t,function(){return!1})}function q(t){Q("plotclick",t,function(t){return 0!=t.clickable})}function Q(t,i,o){var n=li.offset(),a=i.pageX-n.left-ui.left,r=i.pageY-n.top-ui.top,l=p({left:a,top:r});l.pageX=i.pageX,l.pageY=i.pageY;var s=V(a,r,o);if(s&&(s.pageX=parseInt(s.series.xaxis.p2c(s.datapoint[0])+n.left+ui.left,10),s.pageY=parseInt(s.series.yaxis.p2c(s.datapoint[1])+n.top+ui.top,10)),ni.grid.autoHighlight){for(var c=0;c<gi.length;++c){var h=gi[c];h.auto!=t||s&&h.series==s.series&&h.point[0]==s.datapoint[0]&&h.point[1]==s.datapoint[1]||K(h.series,h.point)}s&&$(s.series,s.datapoint,t)}e.trigger(t,[l,s])}function U(){var t=ni.interaction.redrawOverlayInterval;return-1==t?void J():void(bi||(bi=setTimeout(J,t)))}function J(){bi=null,ci.save(),ri.clear(),ci.translate(ui.left,ui.top);var t,i;for(t=0;t<gi.length;++t)i=gi[t],i.series.bars.show?ii(i.series,i.point):ti(i.series,i.point);ci.restore(),l(mi.drawOverlay,[ci])}function $(t,i,e){if("number"==typeof t&&(t=oi[t]),"number"==typeof i){var o=t.datapoints.pointsize;i=t.datapoints.points.slice(o*i,o*(i+1))}var n=Z(t,i);-1==n?(gi.push({series:t,point:i,auto:e}),U()):e||(gi[n].auto=!1)}function K(t,i){if(null==t&&null==i)return gi=[],void U();if("number"==typeof t&&(t=oi[t]),"number"==typeof i){var e=t.datapoints.pointsize;i=t.datapoints.points.slice(e*i,e*(i+1))}var o=Z(t,i);-1!=o&&(gi.splice(o,1),U())}function Z(t,i){for(var e=0;e<gi.length;++e){var o=gi[e];if(o.series==t&&o.point[0]==i[0]&&o.point[1]==i[1])return e}return-1}function ti(i,e){var o=e[0],n=e[1],a=i.xaxis,r=i.yaxis,l="string"==typeof i.highlightColor?i.highlightColor:t.color.parse(i.color).scale("a",.5).toString();if(!(o<a.min||o>a.max||n<r.min||n>r.max)){var s=i.points.radius+i.points.lineWidth/2;ci.lineWidth=s,ci.strokeStyle=l;var c=1.5*s;o=a.p2c(o),n=r.p2c(n),ci.beginPath(),"circle"==i.points.symbol?ci.arc(o,n,c,0,2*Math.PI,!1):i.points.symbol(ci,o,n,c,!1),ci.closePath(),ci.stroke()}}function ii(i,e){var o,n="string"==typeof i.highlightColor?i.highlightColor:t.color.parse(i.color).scale("a",.5).toString(),a=n;switch(i.bars.align){case"left":o=0;break;case"right":o=-i.bars.barWidth;break;default:o=-i.bars.barWidth/2}ci.lineWidth=i.bars.lineWidth,ci.strokeStyle=n,E(e[0],e[1],e[2]||0,o,o+i.bars.barWidth,function(){return a},i.xaxis,i.yaxis,ci,i.bars.horizontal,i.bars.lineWidth)}function ei(i,e,o,n){if("string"==typeof i)return i;for(var a=si.createLinearGradient(0,o,0,e),r=0,l=i.colors.length;l>r;++r){var s=i.colors[r];if("string"!=typeof s){var c=t.color.parse(n);null!=s.brightness&&(c=c.scale("rgb",s.brightness)),null!=s.opacity&&(c.a*=s.opacity),s=c.toString()}a.addColorStop(r/(l-1),s)}return a}var oi=[],ni={colors:["#edc240","#afd8f8","#cb4b4b","#4da74d","#9440ed"],legend:{show:!0,noColumns:1,labelFormatter:null,labelBoxBorderColor:"#ccc",container:null,position:"ne",margin:5,backgroundColor:null,backgroundOpacity:.85,sorted:null},xaxis:{show:null,position:"bottom",mode:null,font:null,color:null,tickColor:null,transform:null,inverseTransform:null,min:null,max:null,autoscaleMargin:null,ticks:null,tickFormatter:null,labelWidth:null,labelHeight:null,reserveSpace:null,tickLength:null,alignTicksWithAxis:null,tickDecimals:null,tickSize:null,minTickSize:null},yaxis:{autoscaleMargin:.02,position:"left"},xaxes:[],yaxes:[],series:{points:{show:!1,radius:3,lineWidth:2,fill:!0,fillColor:"#ffffff",symbol:"circle"},lines:{lineWidth:2,fill:!1,fillColor:null,steps:!1},bars:{show:!1,lineWidth:2,barWidth:1,fill:!0,fillColor:null,align:"left",horizontal:!1,zero:!0},shadowSize:3,highlightColor:null},grid:{show:!0,aboveData:!1,color:"#545454",backgroundColor:null,borderColor:null,tickColor:null,margin:0,labelMargin:5,axisMargin:8,borderWidth:2,minBorderMargin:null,markings:null,markingsColor:"#f4f4f4",markingsLineWidth:2,clickable:!1,hoverable:!1,autoHighlight:!0,mouseActiveRadius:10},interaction:{redrawOverlayInterval:1e3/60},hooks:{}},ai=null,ri=null,li=null,si=null,ci=null,hi=[],fi=[],ui={left:0,right:0,top:0,bottom:0},di=0,pi=0,mi={processOptions:[],processRawData:[],processDatapoints:[],processOffset:[],drawBackground:[],drawSeries:[],draw:[],bindEvents:[],drawOverlay:[],shutdown:[]},xi=this;
|
2
|
+
xi.setData=h,xi.setupGrid=W,xi.draw=P,xi.getPlaceholder=function(){return e},xi.getCanvas=function(){return ai.element},xi.getPlotOffset=function(){return ui},xi.width=function(){return di},xi.height=function(){return pi},xi.offset=function(){var t=li.offset();return t.left+=ui.left,t.top+=ui.top,t},xi.getData=function(){return oi},xi.getAxes=function(){var i={};return t.each(hi.concat(fi),function(t,e){e&&(i[e.direction+(1!=e.n?e.n:"")+"axis"]=e)}),i},xi.getXAxes=function(){return hi},xi.getYAxes=function(){return fi},xi.c2p=p,xi.p2c=m,xi.getOptions=function(){return ni},xi.highlight=$,xi.unhighlight=K,xi.triggerRedrawOverlay=U,xi.pointOffset=function(t){return{left:parseInt(hi[u(t,"x")-1].p2c(+t.x)+ui.left,10),top:parseInt(fi[u(t,"y")-1].p2c(+t.y)+ui.top,10)}},xi.shutdown=y,xi.destroy=function(){y(),e.removeData("plot").empty(),oi=[],ni=null,ai=null,ri=null,li=null,si=null,ci=null,hi=[],fi=[],mi=null,gi=[],xi=null},xi.resize=function(){var t=e.width(),i=e.height();ai.resize(t,i),ri.resize(t,i)},xi.hooks=mi,s(xi),c(a),v(),h(n),W(),P(),k();var gi=[],bi=null}function o(t,i){return i*Math.floor(t/i)}var n=Object.prototype.hasOwnProperty;t.fn.detach||(t.fn.detach=function(){return this.each(function(){this.parentNode&&this.parentNode.removeChild(this)})}),i.prototype.resize=function(t,i){if(0>=t||0>=i)throw new Error("Invalid dimensions for plot, width = "+t+", height = "+i);var e=this.element,o=this.context,n=this.pixelRatio;this.width!=t&&(e.width=t*n,e.style.width=t+"px",this.width=t),this.height!=i&&(e.height=i*n,e.style.height=i+"px",this.height=i),o.restore(),o.save(),o.scale(n,n)},i.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)},i.prototype.render=function(){var t=this._textCache;for(var i in t)if(n.call(t,i)){var e=this.getTextLayer(i),o=t[i];e.hide();for(var a in o)if(n.call(o,a)){var r=o[a];for(var l in r)if(n.call(r,l)){for(var s,c=r[l].positions,h=0;s=c[h];h++)s.active?s.rendered||(e.append(s.element),s.rendered=!0):(c.splice(h--,1),s.rendered&&s.element.detach());0==c.length&&delete r[l]}}e.show()}},i.prototype.getTextLayer=function(i){var e=this.text[i];return null==e&&(null==this.textContainer&&(this.textContainer=t("<div class='flot-text'></div>").css({position:"absolute",top:0,left:0,bottom:0,right:0,"font-size":"smaller",color:"#545454"}).insertAfter(this.element)),e=this.text[i]=t("<div></div>").addClass(i).css({position:"absolute",top:0,left:0,bottom:0,right:0}).appendTo(this.textContainer)),e},i.prototype.getTextInfo=function(i,e,o,n,a){var r,l,s,c;if(e=""+e,r="object"==typeof o?o.style+" "+o.variant+" "+o.weight+" "+o.size+"px/"+o.lineHeight+"px "+o.family:o,l=this._textCache[i],null==l&&(l=this._textCache[i]={}),s=l[r],null==s&&(s=l[r]={}),c=s[e],null==c){var h=t("<div></div>").html(e).css({position:"absolute","max-width":a,top:-9999}).appendTo(this.getTextLayer(i));"object"==typeof o?h.css({font:r,color:o.color}):"string"==typeof o&&h.addClass(o),c=s[e]={width:h.outerWidth(!0),height:h.outerHeight(!0),element:h,positions:[]},h.detach()}return c},i.prototype.addText=function(t,i,e,o,n,a,r,l,s){var c=this.getTextInfo(t,o,n,a,r),h=c.positions;"center"==l?i-=c.width/2:"right"==l&&(i-=c.width),"middle"==s?e-=c.height/2:"bottom"==s&&(e-=c.height);for(var f,u=0;f=h[u];u++)if(f.x==i&&f.y==e)return void(f.active=!0);f={active:!0,rendered:!1,element:h.length?c.element.clone():c.element,x:i,y:e},h.push(f),f.element.css({top:Math.round(e),left:Math.round(i),"text-align":l})},i.prototype.removeText=function(t,i,e,o,a,r){if(null==o){var l=this._textCache[t];if(null!=l)for(var s in l)if(n.call(l,s)){var c=l[s];for(var h in c)if(n.call(c,h))for(var f,u=c[h].positions,d=0;f=u[d];d++)f.active=!1}}else for(var f,u=this.getTextInfo(t,o,a,r).positions,d=0;f=u[d];d++)f.x==i&&f.y==e&&(f.active=!1)},t.plot=function(i,o,n){var a=new e(t(i),o,n,t.plot.plugins);return a},t.plot.version="0.8.3",t.plot.plugins=[],t.fn.plot=function(i,e){return this.each(function(){t.plot(this,i,e)})}}(jQuery);
|
@@ -0,0 +1,201 @@
|
|
1
|
+
/*
|
2
|
+
* Flot plugin to order bars side by side.
|
3
|
+
*
|
4
|
+
* Released under the MIT license by Benjamin BUFFET, 20-Sep-2010.
|
5
|
+
* Modifications made by Steven Hall <github.com/emmerich>, 01-May-2013.
|
6
|
+
*
|
7
|
+
* This plugin is an alpha version.
|
8
|
+
*
|
9
|
+
* To activate the plugin you must specify the parameter "order" for the specific serie :
|
10
|
+
*
|
11
|
+
* $.plot($("#placeholder"), [{ data: [ ... ], bars :{ order = null or integer }])
|
12
|
+
*
|
13
|
+
* If 2 series have the same order param, they are ordered by the position in the array;
|
14
|
+
*
|
15
|
+
* The plugin adjust the point by adding a value depanding of the barwidth
|
16
|
+
* Exemple for 3 series (barwidth : 0.1) :
|
17
|
+
*
|
18
|
+
* first bar décalage : -0.15
|
19
|
+
* second bar décalage : -0.05
|
20
|
+
* third bar décalage : 0.05
|
21
|
+
*
|
22
|
+
*/
|
23
|
+
|
24
|
+
// INFO: decalage/decallage is French for gap. It's used to denote the spacing applied to each
|
25
|
+
// bar.
|
26
|
+
(function($){
|
27
|
+
function init(plot){
|
28
|
+
var orderedBarSeries;
|
29
|
+
var nbOfBarsToOrder;
|
30
|
+
var borderWidth;
|
31
|
+
var borderWidthInXabsWidth;
|
32
|
+
var pixelInXWidthEquivalent = 1;
|
33
|
+
var isHorizontal = false;
|
34
|
+
|
35
|
+
// A mapping of order integers to decallage.
|
36
|
+
var decallageByOrder = {};
|
37
|
+
|
38
|
+
/*
|
39
|
+
* This method add shift to x values
|
40
|
+
*/
|
41
|
+
function reOrderBars(plot, serie, datapoints){
|
42
|
+
var shiftedPoints = null;
|
43
|
+
|
44
|
+
if(serieNeedToBeReordered(serie)){
|
45
|
+
checkIfGraphIsHorizontal(serie);
|
46
|
+
calculPixel2XWidthConvert(plot);
|
47
|
+
retrieveBarSeries(plot);
|
48
|
+
calculBorderAndBarWidth(serie);
|
49
|
+
|
50
|
+
if(nbOfBarsToOrder >= 2){
|
51
|
+
var position = findPosition(serie);
|
52
|
+
var decallage = 0;
|
53
|
+
|
54
|
+
var centerBarShift = calculCenterBarShift();
|
55
|
+
|
56
|
+
// If we haven't already calculated the decallage for this order value, do it.
|
57
|
+
if(typeof decallageByOrder[serie.bars.order] === 'undefined') {
|
58
|
+
if (isBarAtLeftOfCenter(position)){
|
59
|
+
decallageByOrder[serie.bars.order] = -1*(sumWidth(orderedBarSeries,position-1,Math.floor(nbOfBarsToOrder / 2)-1)) - centerBarShift;
|
60
|
+
}else{
|
61
|
+
decallageByOrder[serie.bars.order] = sumWidth(orderedBarSeries,Math.ceil(nbOfBarsToOrder / 2),position-2) + centerBarShift + borderWidthInXabsWidth*2;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
// Lookup the decallage based on the series' order value.
|
66
|
+
decallage = decallageByOrder[serie.bars.order];
|
67
|
+
|
68
|
+
shiftedPoints = shiftPoints(datapoints,serie,decallage);
|
69
|
+
datapoints.points = shiftedPoints;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
return shiftedPoints;
|
73
|
+
}
|
74
|
+
|
75
|
+
function serieNeedToBeReordered(serie){
|
76
|
+
return serie.bars != null
|
77
|
+
&& serie.bars.show
|
78
|
+
&& serie.bars.order != null;
|
79
|
+
}
|
80
|
+
|
81
|
+
function calculPixel2XWidthConvert(plot){
|
82
|
+
var gridDimSize = isHorizontal ? plot.getPlaceholder().innerHeight() : plot.getPlaceholder().innerWidth();
|
83
|
+
var minMaxValues = isHorizontal ? getAxeMinMaxValues(plot.getData(),1) : getAxeMinMaxValues(plot.getData(),0);
|
84
|
+
var AxeSize = minMaxValues[1] - minMaxValues[0];
|
85
|
+
pixelInXWidthEquivalent = AxeSize / gridDimSize;
|
86
|
+
}
|
87
|
+
|
88
|
+
function getAxeMinMaxValues(series,AxeIdx){
|
89
|
+
var minMaxValues = new Array();
|
90
|
+
for(var i = 0; i < series.length; i++){
|
91
|
+
minMaxValues[0] = (series[i].data[0]) ? series[i].data[0][AxeIdx]: null;
|
92
|
+
minMaxValues[1] = (series[i].data[series[i].data.length - 1]) ? series[i].data[series[i].data.length - 1][AxeIdx]: null;
|
93
|
+
}
|
94
|
+
return minMaxValues;
|
95
|
+
}
|
96
|
+
|
97
|
+
function retrieveBarSeries(plot){
|
98
|
+
orderedBarSeries = findOthersBarsToReOrders(plot.getData());
|
99
|
+
nbOfBarsToOrder = orderedBarSeries.length;
|
100
|
+
}
|
101
|
+
|
102
|
+
function findOthersBarsToReOrders(series){
|
103
|
+
var retSeries = new Array();
|
104
|
+
var orderValuesSeen = [];
|
105
|
+
|
106
|
+
for(var i = 0; i < series.length; i++){
|
107
|
+
if(series[i].bars.order != null && series[i].bars.show &&
|
108
|
+
orderValuesSeen.indexOf(series[i].bars.order) < 0){
|
109
|
+
|
110
|
+
orderValuesSeen.push(series[i].bars.order);
|
111
|
+
retSeries.push(series[i]);
|
112
|
+
}
|
113
|
+
}
|
114
|
+
return retSeries.sort(sortByOrder);
|
115
|
+
}
|
116
|
+
|
117
|
+
function sortByOrder(serie1,serie2){
|
118
|
+
var x = serie1.bars.order;
|
119
|
+
var y = serie2.bars.order;
|
120
|
+
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
|
121
|
+
}
|
122
|
+
|
123
|
+
function calculBorderAndBarWidth(serie){
|
124
|
+
borderWidth = typeof serie.bars.lineWidth !== 'undefined' ? serie.bars.lineWidth : 2;
|
125
|
+
borderWidthInXabsWidth = borderWidth * pixelInXWidthEquivalent;
|
126
|
+
}
|
127
|
+
|
128
|
+
function checkIfGraphIsHorizontal(serie){
|
129
|
+
if(serie.bars.horizontal){
|
130
|
+
isHorizontal = true;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
|
134
|
+
function findPosition(serie){
|
135
|
+
var pos = 0
|
136
|
+
for (var i = 0; i < orderedBarSeries.length; ++i) {
|
137
|
+
if (serie == orderedBarSeries[i]){
|
138
|
+
pos = i;
|
139
|
+
break;
|
140
|
+
}
|
141
|
+
}
|
142
|
+
|
143
|
+
return pos+1;
|
144
|
+
}
|
145
|
+
|
146
|
+
function calculCenterBarShift(){
|
147
|
+
var width = 0;
|
148
|
+
|
149
|
+
if(nbOfBarsToOrder%2 != 0)
|
150
|
+
width = (orderedBarSeries[Math.ceil(nbOfBarsToOrder / 2)].bars.barWidth)/2;
|
151
|
+
|
152
|
+
return width;
|
153
|
+
}
|
154
|
+
|
155
|
+
function isBarAtLeftOfCenter(position){
|
156
|
+
return position <= Math.ceil(nbOfBarsToOrder / 2);
|
157
|
+
}
|
158
|
+
|
159
|
+
function sumWidth(series,start,end){
|
160
|
+
var totalWidth = 0;
|
161
|
+
|
162
|
+
for(var i = start; i <= end; i++){
|
163
|
+
totalWidth += series[i].bars.barWidth+borderWidthInXabsWidth*2;
|
164
|
+
}
|
165
|
+
|
166
|
+
return totalWidth;
|
167
|
+
}
|
168
|
+
|
169
|
+
function shiftPoints(datapoints,serie,dx){
|
170
|
+
var ps = datapoints.pointsize;
|
171
|
+
var points = datapoints.points;
|
172
|
+
var j = 0;
|
173
|
+
for(var i = isHorizontal ? 1 : 0;i < points.length; i += ps){
|
174
|
+
points[i] += dx;
|
175
|
+
//Adding the new x value in the serie to be abble to display the right tooltip value,
|
176
|
+
//using the index 3 to not overide the third index.
|
177
|
+
serie.data[j][3] = points[i];
|
178
|
+
j++;
|
179
|
+
}
|
180
|
+
|
181
|
+
return points;
|
182
|
+
}
|
183
|
+
|
184
|
+
plot.hooks.processDatapoints.push(reOrderBars);
|
185
|
+
|
186
|
+
}
|
187
|
+
|
188
|
+
var options = {
|
189
|
+
series : {
|
190
|
+
bars: {order: null} // or number/string
|
191
|
+
}
|
192
|
+
};
|
193
|
+
|
194
|
+
$.plot.plugins.push({
|
195
|
+
init: init,
|
196
|
+
options: options,
|
197
|
+
name: "orderBars",
|
198
|
+
version: "0.2"
|
199
|
+
});
|
200
|
+
|
201
|
+
})(jQuery);
|
@@ -0,0 +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:13px;text-align:center;padding:2px;color:" + slice.color + ";'>" + label + " " + 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);
|