chaskiq 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +34 -0
- data/lib/chaskiq/version.rb +1 -1
- data/vendor/assets/images/animated-overlay.gif +0 -0
- data/vendor/assets/images/blueimp/img/error.png +0 -0
- data/vendor/assets/images/blueimp/img/error.svg +5 -0
- data/vendor/assets/images/blueimp/img/loading.gif +0 -0
- data/vendor/assets/images/blueimp/img/play-pause.png +0 -0
- data/vendor/assets/images/blueimp/img/play-pause.svg +6 -0
- data/vendor/assets/images/blueimp/img/video-play.png +0 -0
- data/vendor/assets/images/blueimp/img/video-play.svg +5 -0
- data/vendor/assets/images/bootstrap-colorpicker/alpha-horizontal.png +0 -0
- data/vendor/assets/images/bootstrap-colorpicker/alpha.png +0 -0
- data/vendor/assets/images/bootstrap-colorpicker/hue-horizontal.png +0 -0
- data/vendor/assets/images/bootstrap-colorpicker/hue.png +0 -0
- data/vendor/assets/images/bootstrap-colorpicker/saturation.png +0 -0
- data/vendor/assets/images/chosen-sprite.png +0 -0
- data/vendor/assets/images/chosen-sprite@2x.png +0 -0
- data/vendor/assets/images/green.png +0 -0
- data/vendor/assets/images/green@2x.png +0 -0
- data/vendor/assets/images/images/animated-overlay.gif +0 -0
- data/vendor/assets/images/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/images/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/vendor/assets/images/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/vendor/assets/images/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/images/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/vendor/assets/images/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/vendor/assets/images/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/vendor/assets/images/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/vendor/assets/images/images/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/images/images/ui-icons_2e83ff_256x240.png +0 -0
- data/vendor/assets/images/images/ui-icons_454545_256x240.png +0 -0
- data/vendor/assets/images/images/ui-icons_888888_256x240.png +0 -0
- data/vendor/assets/images/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/vendor/assets/images/sort.png +0 -0
- data/vendor/assets/images/sort_asc.png +0 -0
- data/vendor/assets/images/sort_desc.png +0 -0
- data/vendor/assets/images/sprite-skin-flat.png +0 -0
- data/vendor/assets/images/sprite-skin-flat2.png +0 -0
- data/vendor/assets/images/sprite-skin-nice.png +0 -0
- data/vendor/assets/images/sprite-skin-simple.png +0 -0
- data/vendor/assets/images/spritemap.png +0 -0
- data/vendor/assets/images/spritemap@2x.png +0 -0
- data/vendor/assets/javascripts/backbone/backbone.min.js +2 -0
- data/vendor/assets/javascripts/backbone/underscore.min.js +6 -0
- data/vendor/assets/javascripts/chartjs/Chart.min.js +11 -0
- data/vendor/assets/javascripts/codemirror/codemirror.js +7830 -0
- data/vendor/assets/javascripts/codemirror/mode/apl/apl.js +175 -0
- data/vendor/assets/javascripts/codemirror/mode/apl/index.html +72 -0
- data/vendor/assets/javascripts/codemirror/mode/asterisk/asterisk.js +198 -0
- data/vendor/assets/javascripts/codemirror/mode/asterisk/index.html +154 -0
- data/vendor/assets/javascripts/codemirror/mode/clike/clike.js +474 -0
- data/vendor/assets/javascripts/codemirror/mode/clike/index.html +225 -0
- data/vendor/assets/javascripts/codemirror/mode/clike/scala.html +767 -0
- data/vendor/assets/javascripts/codemirror/mode/clojure/clojure.js +243 -0
- data/vendor/assets/javascripts/codemirror/mode/clojure/index.html +88 -0
- data/vendor/assets/javascripts/codemirror/mode/cobol/cobol.js +255 -0
- data/vendor/assets/javascripts/codemirror/mode/cobol/index.html +210 -0
- data/vendor/assets/javascripts/codemirror/mode/coffeescript/coffeescript.js +369 -0
- data/vendor/assets/javascripts/codemirror/mode/coffeescript/index.html +740 -0
- data/vendor/assets/javascripts/codemirror/mode/commonlisp/commonlisp.js +120 -0
- data/vendor/assets/javascripts/codemirror/mode/commonlisp/index.html +177 -0
- data/vendor/assets/javascripts/codemirror/mode/css/css.js +717 -0
- data/vendor/assets/javascripts/codemirror/mode/css/index.html +70 -0
- data/vendor/assets/javascripts/codemirror/mode/css/less.html +152 -0
- data/vendor/assets/javascripts/codemirror/mode/css/less_test.js +51 -0
- data/vendor/assets/javascripts/codemirror/mode/css/scss.html +157 -0
- data/vendor/assets/javascripts/codemirror/mode/css/scss_test.js +110 -0
- data/vendor/assets/javascripts/codemirror/mode/css/test.js +135 -0
- data/vendor/assets/javascripts/codemirror/mode/cypher/cypher.js +146 -0
- data/vendor/assets/javascripts/codemirror/mode/cypher/index.html +63 -0
- data/vendor/assets/javascripts/codemirror/mode/d/d.js +218 -0
- data/vendor/assets/javascripts/codemirror/mode/d/index.html +273 -0
- data/vendor/assets/javascripts/codemirror/mode/diff/diff.js +47 -0
- data/vendor/assets/javascripts/codemirror/mode/diff/index.html +117 -0
- data/vendor/assets/javascripts/codemirror/mode/django/django.js +67 -0
- data/vendor/assets/javascripts/codemirror/mode/django/index.html +63 -0
- data/vendor/assets/javascripts/codemirror/mode/dtd/dtd.js +142 -0
- data/vendor/assets/javascripts/codemirror/mode/dtd/index.html +89 -0
- data/vendor/assets/javascripts/codemirror/mode/dylan/dylan.js +299 -0
- data/vendor/assets/javascripts/codemirror/mode/dylan/index.html +407 -0
- data/vendor/assets/javascripts/codemirror/mode/ecl/ecl.js +207 -0
- data/vendor/assets/javascripts/codemirror/mode/ecl/index.html +52 -0
- data/vendor/assets/javascripts/codemirror/mode/eiffel/eiffel.js +162 -0
- data/vendor/assets/javascripts/codemirror/mode/eiffel/index.html +429 -0
- data/vendor/assets/javascripts/codemirror/mode/erlang/erlang.js +622 -0
- data/vendor/assets/javascripts/codemirror/mode/erlang/index.html +76 -0
- data/vendor/assets/javascripts/codemirror/mode/fortran/fortran.js +188 -0
- data/vendor/assets/javascripts/codemirror/mode/fortran/index.html +81 -0
- data/vendor/assets/javascripts/codemirror/mode/gas/gas.js +345 -0
- data/vendor/assets/javascripts/codemirror/mode/gas/index.html +68 -0
- data/vendor/assets/javascripts/codemirror/mode/gfm/gfm.js +122 -0
- data/vendor/assets/javascripts/codemirror/mode/gfm/index.html +82 -0
- data/vendor/assets/javascripts/codemirror/mode/gfm/test.js +164 -0
- data/vendor/assets/javascripts/codemirror/mode/gherkin/gherkin.js +178 -0
- data/vendor/assets/javascripts/codemirror/mode/gherkin/index.html +48 -0
- data/vendor/assets/javascripts/codemirror/mode/go/go.js +184 -0
- data/vendor/assets/javascripts/codemirror/mode/go/index.html +85 -0
- data/vendor/assets/javascripts/codemirror/mode/groovy/groovy.js +226 -0
- data/vendor/assets/javascripts/codemirror/mode/groovy/index.html +84 -0
- data/vendor/assets/javascripts/codemirror/mode/haml/haml.js +159 -0
- data/vendor/assets/javascripts/codemirror/mode/haml/index.html +79 -0
- data/vendor/assets/javascripts/codemirror/mode/haml/test.js +97 -0
- data/vendor/assets/javascripts/codemirror/mode/haskell/haskell.js +267 -0
- data/vendor/assets/javascripts/codemirror/mode/haskell/index.html +73 -0
- data/vendor/assets/javascripts/codemirror/mode/haxe/haxe.js +518 -0
- data/vendor/assets/javascripts/codemirror/mode/haxe/index.html +124 -0
- data/vendor/assets/javascripts/codemirror/mode/htmlembedded/htmlembedded.js +86 -0
- data/vendor/assets/javascripts/codemirror/mode/htmlembedded/index.html +58 -0
- data/vendor/assets/javascripts/codemirror/mode/htmlmixed/htmlmixed.js +121 -0
- data/vendor/assets/javascripts/codemirror/mode/htmlmixed/index.html +85 -0
- data/vendor/assets/javascripts/codemirror/mode/http/http.js +113 -0
- data/vendor/assets/javascripts/codemirror/mode/http/index.html +45 -0
- data/vendor/assets/javascripts/codemirror/mode/index.html +125 -0
- data/vendor/assets/javascripts/codemirror/mode/jade/index.html +70 -0
- data/vendor/assets/javascripts/codemirror/mode/jade/jade.js +590 -0
- data/vendor/assets/javascripts/codemirror/mode/javascript/index.html +114 -0
- data/vendor/assets/javascripts/codemirror/mode/javascript/javascript.js +684 -0
- data/vendor/assets/javascripts/codemirror/mode/javascript/json-ld.html +72 -0
- data/vendor/assets/javascripts/codemirror/mode/javascript/test.js +194 -0
- data/vendor/assets/javascripts/codemirror/mode/javascript/typescript.html +61 -0
- data/vendor/assets/javascripts/codemirror/mode/jinja2/index.html +54 -0
- data/vendor/assets/javascripts/codemirror/mode/jinja2/jinja2.js +142 -0
- data/vendor/assets/javascripts/codemirror/mode/julia/index.html +195 -0
- data/vendor/assets/javascripts/codemirror/mode/julia/julia.js +301 -0
- data/vendor/assets/javascripts/codemirror/mode/kotlin/index.html +89 -0
- data/vendor/assets/javascripts/codemirror/mode/kotlin/kotlin.js +280 -0
- data/vendor/assets/javascripts/codemirror/mode/livescript/index.html +459 -0
- data/vendor/assets/javascripts/codemirror/mode/livescript/livescript.js +280 -0
- data/vendor/assets/javascripts/codemirror/mode/lua/index.html +85 -0
- data/vendor/assets/javascripts/codemirror/mode/lua/lua.js +159 -0
- data/vendor/assets/javascripts/codemirror/mode/markdown/index.html +359 -0
- data/vendor/assets/javascripts/codemirror/mode/markdown/markdown.js +758 -0
- data/vendor/assets/javascripts/codemirror/mode/markdown/test.js +754 -0
- data/vendor/assets/javascripts/codemirror/mode/meta.js +144 -0
- data/vendor/assets/javascripts/codemirror/mode/mirc/index.html +160 -0
- data/vendor/assets/javascripts/codemirror/mode/mirc/mirc.js +193 -0
- data/vendor/assets/javascripts/codemirror/mode/mllike/index.html +179 -0
- data/vendor/assets/javascripts/codemirror/mode/mllike/mllike.js +205 -0
- data/vendor/assets/javascripts/codemirror/mode/modelica/index.html +67 -0
- data/vendor/assets/javascripts/codemirror/mode/modelica/modelica.js +245 -0
- data/vendor/assets/javascripts/codemirror/mode/nginx/index.html +181 -0
- data/vendor/assets/javascripts/codemirror/mode/nginx/nginx.js +178 -0
- data/vendor/assets/javascripts/codemirror/mode/ntriples/index.html +45 -0
- data/vendor/assets/javascripts/codemirror/mode/ntriples/ntriples.js +186 -0
- data/vendor/assets/javascripts/codemirror/mode/octave/index.html +83 -0
- data/vendor/assets/javascripts/codemirror/mode/octave/octave.js +135 -0
- data/vendor/assets/javascripts/codemirror/mode/pascal/index.html +61 -0
- data/vendor/assets/javascripts/codemirror/mode/pascal/pascal.js +109 -0
- data/vendor/assets/javascripts/codemirror/mode/pegjs/index.html +66 -0
- data/vendor/assets/javascripts/codemirror/mode/pegjs/pegjs.js +114 -0
- data/vendor/assets/javascripts/codemirror/mode/perl/index.html +75 -0
- data/vendor/assets/javascripts/codemirror/mode/perl/perl.js +832 -0
- data/vendor/assets/javascripts/codemirror/mode/php/index.html +64 -0
- data/vendor/assets/javascripts/codemirror/mode/php/php.js +226 -0
- data/vendor/assets/javascripts/codemirror/mode/php/test.js +154 -0
- data/vendor/assets/javascripts/codemirror/mode/pig/index.html +55 -0
- data/vendor/assets/javascripts/codemirror/mode/pig/pig.js +188 -0
- data/vendor/assets/javascripts/codemirror/mode/properties/index.html +53 -0
- data/vendor/assets/javascripts/codemirror/mode/properties/properties.js +78 -0
- data/vendor/assets/javascripts/codemirror/mode/puppet/index.html +121 -0
- data/vendor/assets/javascripts/codemirror/mode/puppet/puppet.js +220 -0
- data/vendor/assets/javascripts/codemirror/mode/python/index.html +198 -0
- data/vendor/assets/javascripts/codemirror/mode/python/python.js +359 -0
- data/vendor/assets/javascripts/codemirror/mode/q/index.html +144 -0
- data/vendor/assets/javascripts/codemirror/mode/q/q.js +139 -0
- data/vendor/assets/javascripts/codemirror/mode/r/index.html +85 -0
- data/vendor/assets/javascripts/codemirror/mode/r/r.js +162 -0
- data/vendor/assets/javascripts/codemirror/mode/rpm/changes/index.html +66 -0
- data/vendor/assets/javascripts/codemirror/mode/rpm/index.html +149 -0
- data/vendor/assets/javascripts/codemirror/mode/rpm/rpm.js +101 -0
- data/vendor/assets/javascripts/codemirror/mode/rst/index.html +535 -0
- data/vendor/assets/javascripts/codemirror/mode/rst/rst.js +557 -0
- data/vendor/assets/javascripts/codemirror/mode/ruby/index.html +184 -0
- data/vendor/assets/javascripts/codemirror/mode/ruby/ruby.js +285 -0
- data/vendor/assets/javascripts/codemirror/mode/ruby/test.js +14 -0
- data/vendor/assets/javascripts/codemirror/mode/rust/index.html +60 -0
- data/vendor/assets/javascripts/codemirror/mode/rust/rust.js +451 -0
- data/vendor/assets/javascripts/codemirror/mode/sass/index.html +66 -0
- data/vendor/assets/javascripts/codemirror/mode/sass/sass.js +327 -0
- data/vendor/assets/javascripts/codemirror/mode/scheme/index.html +77 -0
- data/vendor/assets/javascripts/codemirror/mode/scheme/scheme.js +248 -0
- data/vendor/assets/javascripts/codemirror/mode/shell/index.html +66 -0
- data/vendor/assets/javascripts/codemirror/mode/shell/shell.js +138 -0
- data/vendor/assets/javascripts/codemirror/mode/shell/test.js +58 -0
- data/vendor/assets/javascripts/codemirror/mode/sieve/index.html +93 -0
- data/vendor/assets/javascripts/codemirror/mode/sieve/sieve.js +193 -0
- data/vendor/assets/javascripts/codemirror/mode/slim/index.html +96 -0
- data/vendor/assets/javascripts/codemirror/mode/slim/slim.js +575 -0
- data/vendor/assets/javascripts/codemirror/mode/slim/test.js +96 -0
- data/vendor/assets/javascripts/codemirror/mode/smalltalk/index.html +68 -0
- data/vendor/assets/javascripts/codemirror/mode/smalltalk/smalltalk.js +168 -0
- data/vendor/assets/javascripts/codemirror/mode/smarty/index.html +136 -0
- data/vendor/assets/javascripts/codemirror/mode/smarty/smarty.js +221 -0
- data/vendor/assets/javascripts/codemirror/mode/smartymixed/index.html +114 -0
- data/vendor/assets/javascripts/codemirror/mode/smartymixed/smartymixed.js +197 -0
- data/vendor/assets/javascripts/codemirror/mode/solr/index.html +57 -0
- data/vendor/assets/javascripts/codemirror/mode/solr/solr.js +104 -0
- data/vendor/assets/javascripts/codemirror/mode/sparql/index.html +53 -0
- data/vendor/assets/javascripts/codemirror/mode/sparql/sparql.js +160 -0
- data/vendor/assets/javascripts/codemirror/mode/sql/index.html +84 -0
- data/vendor/assets/javascripts/codemirror/mode/sql/sql.js +393 -0
- data/vendor/assets/javascripts/codemirror/mode/stex/index.html +110 -0
- data/vendor/assets/javascripts/codemirror/mode/stex/stex.js +262 -0
- data/vendor/assets/javascripts/codemirror/mode/stex/test.js +123 -0
- data/vendor/assets/javascripts/codemirror/mode/tcl/index.html +142 -0
- data/vendor/assets/javascripts/codemirror/mode/tcl/tcl.js +147 -0
- data/vendor/assets/javascripts/codemirror/mode/textile/index.html +191 -0
- data/vendor/assets/javascripts/codemirror/mode/textile/test.js +406 -0
- data/vendor/assets/javascripts/codemirror/mode/textile/textile.js +553 -0
- data/vendor/assets/javascripts/codemirror/mode/tiddlywiki/index.html +154 -0
- data/vendor/assets/javascripts/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/vendor/assets/javascripts/codemirror/mode/tiddlywiki/tiddlywiki.js +369 -0
- data/vendor/assets/javascripts/codemirror/mode/tiki/index.html +95 -0
- data/vendor/assets/javascripts/codemirror/mode/tiki/tiki.css +26 -0
- data/vendor/assets/javascripts/codemirror/mode/tiki/tiki.js +323 -0
- data/vendor/assets/javascripts/codemirror/mode/toml/index.html +73 -0
- data/vendor/assets/javascripts/codemirror/mode/toml/toml.js +88 -0
- data/vendor/assets/javascripts/codemirror/mode/tornado/index.html +63 -0
- data/vendor/assets/javascripts/codemirror/mode/tornado/tornado.js +68 -0
- data/vendor/assets/javascripts/codemirror/mode/turtle/index.html +50 -0
- data/vendor/assets/javascripts/codemirror/mode/turtle/turtle.js +160 -0
- data/vendor/assets/javascripts/codemirror/mode/vb/index.html +102 -0
- data/vendor/assets/javascripts/codemirror/mode/vb/vb.js +274 -0
- data/vendor/assets/javascripts/codemirror/mode/vbscript/index.html +55 -0
- data/vendor/assets/javascripts/codemirror/mode/vbscript/vbscript.js +350 -0
- data/vendor/assets/javascripts/codemirror/mode/velocity/index.html +118 -0
- data/vendor/assets/javascripts/codemirror/mode/velocity/velocity.js +201 -0
- data/vendor/assets/javascripts/codemirror/mode/verilog/index.html +120 -0
- data/vendor/assets/javascripts/codemirror/mode/verilog/test.js +273 -0
- data/vendor/assets/javascripts/codemirror/mode/verilog/verilog.js +364 -0
- data/vendor/assets/javascripts/codemirror/mode/xml/index.html +57 -0
- data/vendor/assets/javascripts/codemirror/mode/xml/test.js +51 -0
- data/vendor/assets/javascripts/codemirror/mode/xml/xml.js +384 -0
- data/vendor/assets/javascripts/codemirror/mode/xquery/index.html +210 -0
- data/vendor/assets/javascripts/codemirror/mode/xquery/test.js +67 -0
- data/vendor/assets/javascripts/codemirror/mode/xquery/xquery.js +447 -0
- data/vendor/assets/javascripts/codemirror/mode/yaml/index.html +80 -0
- data/vendor/assets/javascripts/codemirror/mode/yaml/yaml.js +112 -0
- data/vendor/assets/javascripts/codemirror/mode/z80/index.html +52 -0
- data/vendor/assets/javascripts/codemirror/mode/z80/z80.js +100 -0
- data/vendor/assets/javascripts/datapicker/bootstrap-datepicker.js +1671 -0
- data/vendor/assets/javascripts/flot/curvedLines.js +315 -0
- data/vendor/assets/javascripts/flot/excanvas.min.js +1 -0
- data/vendor/assets/javascripts/flot/jquery.flot.js +3168 -0
- data/vendor/assets/javascripts/flot/jquery.flot.pie.js +820 -0
- data/vendor/assets/javascripts/flot/jquery.flot.resize.js +59 -0
- data/vendor/assets/javascripts/flot/jquery.flot.spline.js +212 -0
- data/vendor/assets/javascripts/flot/jquery.flot.symbol.js +71 -0
- data/vendor/assets/javascripts/flot/jquery.flot.time.js +432 -0
- data/vendor/assets/javascripts/flot/jquery.flot.tooltip.min.js +12 -0
- data/vendor/assets/javascripts/jquery/jquery-2.1.1.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery-ui-i18n.min.js +6 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-af.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-ar-DZ.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-ar.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-az.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-be.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-bg.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-bs.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-ca.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-cs.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-cy-GB.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-da.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-de.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-el.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-en-AU.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-en-GB.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-en-NZ.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-eo.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-es.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-et.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-eu.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-fa.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-fi.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-fo.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-fr-CA.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-fr-CH.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-fr.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-gl.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-he.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-hi.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-hr.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-hu.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-hy.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-id.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-is.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-it.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-ja.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-ka.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-kk.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-km.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-ko.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-ky.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-lb.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-lt.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-lv.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-mk.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-ml.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-ms.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-nb.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-nl-BE.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-nl.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-nn.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-no.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-pl.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-pt-BR.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-pt.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-rm.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-ro.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-ru.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-sk.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-sl.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-sq.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-sr-SR.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-sr.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-sv.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-ta.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-th.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-tj.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-tr.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-uk.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-vi.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-zh-CN.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-zh-HK.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/i18n/jquery.ui.datepicker-zh-TW.min.js +4 -0
- data/vendor/assets/javascripts/jquery-ui/images/animated-overlay.gif +0 -0
- data/vendor/assets/javascripts/jquery-ui/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/javascripts/jquery-ui/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/vendor/assets/javascripts/jquery-ui/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/vendor/assets/javascripts/jquery-ui/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/vendor/assets/javascripts/jquery-ui/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/vendor/assets/javascripts/jquery-ui/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/vendor/assets/javascripts/jquery-ui/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/vendor/assets/javascripts/jquery-ui/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/vendor/assets/javascripts/jquery-ui/images/ui-icons_222222_256x240.png +0 -0
- data/vendor/assets/javascripts/jquery-ui/images/ui-icons_2e83ff_256x240.png +0 -0
- data/vendor/assets/javascripts/jquery-ui/images/ui-icons_454545_256x240.png +0 -0
- data/vendor/assets/javascripts/jquery-ui/images/ui-icons_888888_256x240.png +0 -0
- data/vendor/assets/javascripts/jquery-ui/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/vendor/assets/javascripts/jquery-ui/jquery-ui-1.10.4.custom.min.css +7 -0
- data/vendor/assets/javascripts/jquery-ui/jquery-ui-1.10.4.min.js +7 -0
- data/vendor/assets/javascripts/jquery-ui/jquery-ui.css +1189 -0
- data/vendor/assets/javascripts/jquery-ui/jquery-ui.js +15040 -0
- data/vendor/assets/javascripts/jquery-ui/jquery-ui.min.css +4 -0
- data/vendor/assets/javascripts/jquery-ui/jquery-ui.min.js +12 -0
- data/vendor/assets/javascripts/metisMenu/jquery.metisMenu.js +120 -0
- data/vendor/assets/javascripts/morris/morris.js +1888 -0
- data/vendor/assets/javascripts/morris/raphael-2.1.0.min.js +10 -0
- data/vendor/assets/javascripts/pace/pace.min.js +2 -0
- data/vendor/assets/javascripts/peity/jquery.peity.min.js +13 -0
- data/vendor/assets/javascripts/radioactive/radioactive.min.js +1 -0
- data/vendor/assets/javascripts/rickshaw/rickshaw.min.js +3 -0
- data/vendor/assets/javascripts/rickshaw/vendor/d3.v3.js +5 -0
- data/vendor/assets/javascripts/sparkline/jquery.sparkline.min.js +5 -0
- data/vendor/assets/javascripts/summernote/summernote.min.js +6331 -0
- data/vendor/assets/javascripts/toastr/toastr.min.js +2 -0
- data/vendor/assets/stylesheets/codemirror/codemirror.css +309 -0
- data/vendor/assets/stylesheets/codemirror/elegant.css +13 -0
- data/vendor/assets/stylesheets/datapicker/datepicker3.css +789 -0
- data/vendor/assets/stylesheets/summernote/summernote-bs3.css +5970 -0
- data/vendor/assets/stylesheets/summernote/summernote.css +446 -0
- data/vendor/assets/stylesheets/toastr/toastr.css +222 -0
- metadata +362 -3
- data/spec/dummy/tmp/pids/server.pid +0 -1
@@ -0,0 +1,1888 @@
|
|
1
|
+
(function() {
|
2
|
+
var $, Morris, minutesSpecHelper, secondsSpecHelper,
|
3
|
+
__slice = [].slice,
|
4
|
+
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
|
5
|
+
__hasProp = {}.hasOwnProperty,
|
6
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
7
|
+
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
8
|
+
|
9
|
+
Morris = window.Morris = {};
|
10
|
+
|
11
|
+
$ = jQuery;
|
12
|
+
|
13
|
+
Morris.EventEmitter = (function() {
|
14
|
+
function EventEmitter() {}
|
15
|
+
|
16
|
+
EventEmitter.prototype.on = function(name, handler) {
|
17
|
+
if (this.handlers == null) {
|
18
|
+
this.handlers = {};
|
19
|
+
}
|
20
|
+
if (this.handlers[name] == null) {
|
21
|
+
this.handlers[name] = [];
|
22
|
+
}
|
23
|
+
this.handlers[name].push(handler);
|
24
|
+
return this;
|
25
|
+
};
|
26
|
+
|
27
|
+
EventEmitter.prototype.fire = function() {
|
28
|
+
var args, handler, name, _i, _len, _ref, _results;
|
29
|
+
name = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
|
30
|
+
if ((this.handlers != null) && (this.handlers[name] != null)) {
|
31
|
+
_ref = this.handlers[name];
|
32
|
+
_results = [];
|
33
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
34
|
+
handler = _ref[_i];
|
35
|
+
_results.push(handler.apply(null, args));
|
36
|
+
}
|
37
|
+
return _results;
|
38
|
+
}
|
39
|
+
};
|
40
|
+
|
41
|
+
return EventEmitter;
|
42
|
+
|
43
|
+
})();
|
44
|
+
|
45
|
+
Morris.commas = function(num) {
|
46
|
+
var absnum, intnum, ret, strabsnum;
|
47
|
+
if (num != null) {
|
48
|
+
ret = num < 0 ? "-" : "";
|
49
|
+
absnum = Math.abs(num);
|
50
|
+
intnum = Math.floor(absnum).toFixed(0);
|
51
|
+
ret += intnum.replace(/(?=(?:\d{3})+$)(?!^)/g, ',');
|
52
|
+
strabsnum = absnum.toString();
|
53
|
+
if (strabsnum.length > intnum.length) {
|
54
|
+
ret += strabsnum.slice(intnum.length);
|
55
|
+
}
|
56
|
+
return ret;
|
57
|
+
} else {
|
58
|
+
return '-';
|
59
|
+
}
|
60
|
+
};
|
61
|
+
|
62
|
+
Morris.pad2 = function(number) {
|
63
|
+
return (number < 10 ? '0' : '') + number;
|
64
|
+
};
|
65
|
+
|
66
|
+
Morris.Grid = (function(_super) {
|
67
|
+
__extends(Grid, _super);
|
68
|
+
|
69
|
+
function Grid(options) {
|
70
|
+
this.resizeHandler = __bind(this.resizeHandler, this);
|
71
|
+
var _this = this;
|
72
|
+
if (typeof options.element === 'string') {
|
73
|
+
this.el = $(document.getElementById(options.element));
|
74
|
+
} else {
|
75
|
+
this.el = $(options.element);
|
76
|
+
}
|
77
|
+
if ((this.el == null) || this.el.length === 0) {
|
78
|
+
throw new Error("Graph container element not found");
|
79
|
+
}
|
80
|
+
if (this.el.css('position') === 'static') {
|
81
|
+
this.el.css('position', 'relative');
|
82
|
+
}
|
83
|
+
this.options = $.extend({}, this.gridDefaults, this.defaults || {}, options);
|
84
|
+
if (typeof this.options.units === 'string') {
|
85
|
+
this.options.postUnits = options.units;
|
86
|
+
}
|
87
|
+
this.raphael = new Raphael(this.el[0]);
|
88
|
+
this.elementWidth = null;
|
89
|
+
this.elementHeight = null;
|
90
|
+
this.dirty = false;
|
91
|
+
this.selectFrom = null;
|
92
|
+
if (this.init) {
|
93
|
+
this.init();
|
94
|
+
}
|
95
|
+
this.setData(this.options.data);
|
96
|
+
this.el.bind('mousemove', function(evt) {
|
97
|
+
var left, offset, right, width, x;
|
98
|
+
offset = _this.el.offset();
|
99
|
+
x = evt.pageX - offset.left;
|
100
|
+
if (_this.selectFrom) {
|
101
|
+
left = _this.data[_this.hitTest(Math.min(x, _this.selectFrom))]._x;
|
102
|
+
right = _this.data[_this.hitTest(Math.max(x, _this.selectFrom))]._x;
|
103
|
+
width = right - left;
|
104
|
+
return _this.selectionRect.attr({
|
105
|
+
x: left,
|
106
|
+
width: width
|
107
|
+
});
|
108
|
+
} else {
|
109
|
+
return _this.fire('hovermove', x, evt.pageY - offset.top);
|
110
|
+
}
|
111
|
+
});
|
112
|
+
this.el.bind('mouseleave', function(evt) {
|
113
|
+
if (_this.selectFrom) {
|
114
|
+
_this.selectionRect.hide();
|
115
|
+
_this.selectFrom = null;
|
116
|
+
}
|
117
|
+
return _this.fire('hoverout');
|
118
|
+
});
|
119
|
+
this.el.bind('touchstart touchmove touchend', function(evt) {
|
120
|
+
var offset, touch;
|
121
|
+
touch = evt.originalEvent.touches[0] || evt.originalEvent.changedTouches[0];
|
122
|
+
offset = _this.el.offset();
|
123
|
+
_this.fire('hover', touch.pageX - offset.left, touch.pageY - offset.top);
|
124
|
+
return touch;
|
125
|
+
});
|
126
|
+
this.el.bind('click', function(evt) {
|
127
|
+
var offset;
|
128
|
+
offset = _this.el.offset();
|
129
|
+
return _this.fire('gridclick', evt.pageX - offset.left, evt.pageY - offset.top);
|
130
|
+
});
|
131
|
+
if (this.options.rangeSelect) {
|
132
|
+
this.selectionRect = this.raphael.rect(0, 0, 0, this.el.innerHeight()).attr({
|
133
|
+
fill: this.options.rangeSelectColor,
|
134
|
+
stroke: false
|
135
|
+
}).toBack().hide();
|
136
|
+
this.el.bind('mousedown', function(evt) {
|
137
|
+
var offset;
|
138
|
+
offset = _this.el.offset();
|
139
|
+
return _this.startRange(evt.pageX - offset.left);
|
140
|
+
});
|
141
|
+
this.el.bind('mouseup', function(evt) {
|
142
|
+
var offset;
|
143
|
+
offset = _this.el.offset();
|
144
|
+
_this.endRange(evt.pageX - offset.left);
|
145
|
+
return _this.fire('hovermove', evt.pageX - offset.left, evt.pageY - offset.top);
|
146
|
+
});
|
147
|
+
}
|
148
|
+
if (this.options.resize) {
|
149
|
+
$(window).bind('resize', function(evt) {
|
150
|
+
if (_this.timeoutId != null) {
|
151
|
+
window.clearTimeout(_this.timeoutId);
|
152
|
+
}
|
153
|
+
return _this.timeoutId = window.setTimeout(_this.resizeHandler, 100);
|
154
|
+
});
|
155
|
+
}
|
156
|
+
if (this.postInit) {
|
157
|
+
this.postInit();
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
Grid.prototype.gridDefaults = {
|
162
|
+
dateFormat: null,
|
163
|
+
axes: true,
|
164
|
+
grid: true,
|
165
|
+
gridLineColor: '#aaa',
|
166
|
+
gridStrokeWidth: 0.5,
|
167
|
+
gridTextColor: '#888',
|
168
|
+
gridTextSize: 12,
|
169
|
+
gridTextFamily: 'sans-serif',
|
170
|
+
gridTextWeight: 'normal',
|
171
|
+
hideHover: false,
|
172
|
+
yLabelFormat: null,
|
173
|
+
xLabelAngle: 0,
|
174
|
+
numLines: 5,
|
175
|
+
padding: 25,
|
176
|
+
parseTime: true,
|
177
|
+
postUnits: '',
|
178
|
+
preUnits: '',
|
179
|
+
ymax: 'auto',
|
180
|
+
ymin: 'auto 0',
|
181
|
+
goals: [],
|
182
|
+
goalStrokeWidth: 1.0,
|
183
|
+
goalLineColors: ['#666633', '#999966', '#cc6666', '#663333'],
|
184
|
+
events: [],
|
185
|
+
eventStrokeWidth: 1.0,
|
186
|
+
eventLineColors: ['#005a04', '#ccffbb', '#3a5f0b', '#005502'],
|
187
|
+
rangeSelect: null,
|
188
|
+
rangeSelectColor: '#eef',
|
189
|
+
resize: false
|
190
|
+
};
|
191
|
+
|
192
|
+
Grid.prototype.setData = function(data, redraw) {
|
193
|
+
var e, idx, index, maxGoal, minGoal, ret, row, step, total, y, ykey, ymax, ymin, yval, _ref;
|
194
|
+
if (redraw == null) {
|
195
|
+
redraw = true;
|
196
|
+
}
|
197
|
+
this.options.data = data;
|
198
|
+
if ((data == null) || data.length === 0) {
|
199
|
+
this.data = [];
|
200
|
+
this.raphael.clear();
|
201
|
+
if (this.hover != null) {
|
202
|
+
this.hover.hide();
|
203
|
+
}
|
204
|
+
return;
|
205
|
+
}
|
206
|
+
ymax = this.cumulative ? 0 : null;
|
207
|
+
ymin = this.cumulative ? 0 : null;
|
208
|
+
if (this.options.goals.length > 0) {
|
209
|
+
minGoal = Math.min.apply(Math, this.options.goals);
|
210
|
+
maxGoal = Math.max.apply(Math, this.options.goals);
|
211
|
+
ymin = ymin != null ? Math.min(ymin, minGoal) : minGoal;
|
212
|
+
ymax = ymax != null ? Math.max(ymax, maxGoal) : maxGoal;
|
213
|
+
}
|
214
|
+
this.data = (function() {
|
215
|
+
var _i, _len, _results;
|
216
|
+
_results = [];
|
217
|
+
for (index = _i = 0, _len = data.length; _i < _len; index = ++_i) {
|
218
|
+
row = data[index];
|
219
|
+
ret = {
|
220
|
+
src: row
|
221
|
+
};
|
222
|
+
ret.label = row[this.options.xkey];
|
223
|
+
if (this.options.parseTime) {
|
224
|
+
ret.x = Morris.parseDate(ret.label);
|
225
|
+
if (this.options.dateFormat) {
|
226
|
+
ret.label = this.options.dateFormat(ret.x);
|
227
|
+
} else if (typeof ret.label === 'number') {
|
228
|
+
ret.label = new Date(ret.label).toString();
|
229
|
+
}
|
230
|
+
} else {
|
231
|
+
ret.x = index;
|
232
|
+
if (this.options.xLabelFormat) {
|
233
|
+
ret.label = this.options.xLabelFormat(ret);
|
234
|
+
}
|
235
|
+
}
|
236
|
+
total = 0;
|
237
|
+
ret.y = (function() {
|
238
|
+
var _j, _len1, _ref, _results1;
|
239
|
+
_ref = this.options.ykeys;
|
240
|
+
_results1 = [];
|
241
|
+
for (idx = _j = 0, _len1 = _ref.length; _j < _len1; idx = ++_j) {
|
242
|
+
ykey = _ref[idx];
|
243
|
+
yval = row[ykey];
|
244
|
+
if (typeof yval === 'string') {
|
245
|
+
yval = parseFloat(yval);
|
246
|
+
}
|
247
|
+
if ((yval != null) && typeof yval !== 'number') {
|
248
|
+
yval = null;
|
249
|
+
}
|
250
|
+
if (yval != null) {
|
251
|
+
if (this.cumulative) {
|
252
|
+
total += yval;
|
253
|
+
} else {
|
254
|
+
if (ymax != null) {
|
255
|
+
ymax = Math.max(yval, ymax);
|
256
|
+
ymin = Math.min(yval, ymin);
|
257
|
+
} else {
|
258
|
+
ymax = ymin = yval;
|
259
|
+
}
|
260
|
+
}
|
261
|
+
}
|
262
|
+
if (this.cumulative && (total != null)) {
|
263
|
+
ymax = Math.max(total, ymax);
|
264
|
+
ymin = Math.min(total, ymin);
|
265
|
+
}
|
266
|
+
_results1.push(yval);
|
267
|
+
}
|
268
|
+
return _results1;
|
269
|
+
}).call(this);
|
270
|
+
_results.push(ret);
|
271
|
+
}
|
272
|
+
return _results;
|
273
|
+
}).call(this);
|
274
|
+
if (this.options.parseTime) {
|
275
|
+
this.data = this.data.sort(function(a, b) {
|
276
|
+
return (a.x > b.x) - (b.x > a.x);
|
277
|
+
});
|
278
|
+
}
|
279
|
+
this.xmin = this.data[0].x;
|
280
|
+
this.xmax = this.data[this.data.length - 1].x;
|
281
|
+
this.events = [];
|
282
|
+
if (this.options.events.length > 0) {
|
283
|
+
if (this.options.parseTime) {
|
284
|
+
this.events = (function() {
|
285
|
+
var _i, _len, _ref, _results;
|
286
|
+
_ref = this.options.events;
|
287
|
+
_results = [];
|
288
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
289
|
+
e = _ref[_i];
|
290
|
+
_results.push(Morris.parseDate(e));
|
291
|
+
}
|
292
|
+
return _results;
|
293
|
+
}).call(this);
|
294
|
+
} else {
|
295
|
+
this.events = this.options.events;
|
296
|
+
}
|
297
|
+
this.xmax = Math.max(this.xmax, Math.max.apply(Math, this.events));
|
298
|
+
this.xmin = Math.min(this.xmin, Math.min.apply(Math, this.events));
|
299
|
+
}
|
300
|
+
if (this.xmin === this.xmax) {
|
301
|
+
this.xmin -= 1;
|
302
|
+
this.xmax += 1;
|
303
|
+
}
|
304
|
+
this.ymin = this.yboundary('min', ymin);
|
305
|
+
this.ymax = this.yboundary('max', ymax);
|
306
|
+
if (this.ymin === this.ymax) {
|
307
|
+
if (ymin) {
|
308
|
+
this.ymin -= 1;
|
309
|
+
}
|
310
|
+
this.ymax += 1;
|
311
|
+
}
|
312
|
+
if (((_ref = this.options.axes) === true || _ref === 'both' || _ref === 'y') || this.options.grid === true) {
|
313
|
+
if (this.options.ymax === this.gridDefaults.ymax && this.options.ymin === this.gridDefaults.ymin) {
|
314
|
+
this.grid = this.autoGridLines(this.ymin, this.ymax, this.options.numLines);
|
315
|
+
this.ymin = Math.min(this.ymin, this.grid[0]);
|
316
|
+
this.ymax = Math.max(this.ymax, this.grid[this.grid.length - 1]);
|
317
|
+
} else {
|
318
|
+
step = (this.ymax - this.ymin) / (this.options.numLines - 1);
|
319
|
+
this.grid = (function() {
|
320
|
+
var _i, _ref1, _ref2, _results;
|
321
|
+
_results = [];
|
322
|
+
for (y = _i = _ref1 = this.ymin, _ref2 = this.ymax; step > 0 ? _i <= _ref2 : _i >= _ref2; y = _i += step) {
|
323
|
+
_results.push(y);
|
324
|
+
}
|
325
|
+
return _results;
|
326
|
+
}).call(this);
|
327
|
+
}
|
328
|
+
}
|
329
|
+
this.dirty = true;
|
330
|
+
if (redraw) {
|
331
|
+
return this.redraw();
|
332
|
+
}
|
333
|
+
};
|
334
|
+
|
335
|
+
Grid.prototype.yboundary = function(boundaryType, currentValue) {
|
336
|
+
var boundaryOption, suggestedValue;
|
337
|
+
boundaryOption = this.options["y" + boundaryType];
|
338
|
+
if (typeof boundaryOption === 'string') {
|
339
|
+
if (boundaryOption.slice(0, 4) === 'auto') {
|
340
|
+
if (boundaryOption.length > 5) {
|
341
|
+
suggestedValue = parseInt(boundaryOption.slice(5), 10);
|
342
|
+
if (currentValue == null) {
|
343
|
+
return suggestedValue;
|
344
|
+
}
|
345
|
+
return Math[boundaryType](currentValue, suggestedValue);
|
346
|
+
} else {
|
347
|
+
if (currentValue != null) {
|
348
|
+
return currentValue;
|
349
|
+
} else {
|
350
|
+
return 0;
|
351
|
+
}
|
352
|
+
}
|
353
|
+
} else {
|
354
|
+
return parseInt(boundaryOption, 10);
|
355
|
+
}
|
356
|
+
} else {
|
357
|
+
return boundaryOption;
|
358
|
+
}
|
359
|
+
};
|
360
|
+
|
361
|
+
Grid.prototype.autoGridLines = function(ymin, ymax, nlines) {
|
362
|
+
var gmax, gmin, grid, smag, span, step, unit, y, ymag;
|
363
|
+
span = ymax - ymin;
|
364
|
+
ymag = Math.floor(Math.log(span) / Math.log(10));
|
365
|
+
unit = Math.pow(10, ymag);
|
366
|
+
gmin = Math.floor(ymin / unit) * unit;
|
367
|
+
gmax = Math.ceil(ymax / unit) * unit;
|
368
|
+
step = (gmax - gmin) / (nlines - 1);
|
369
|
+
if (unit === 1 && step > 1 && Math.ceil(step) !== step) {
|
370
|
+
step = Math.ceil(step);
|
371
|
+
gmax = gmin + step * (nlines - 1);
|
372
|
+
}
|
373
|
+
if (gmin < 0 && gmax > 0) {
|
374
|
+
gmin = Math.floor(ymin / step) * step;
|
375
|
+
gmax = Math.ceil(ymax / step) * step;
|
376
|
+
}
|
377
|
+
if (step < 1) {
|
378
|
+
smag = Math.floor(Math.log(step) / Math.log(10));
|
379
|
+
grid = (function() {
|
380
|
+
var _i, _results;
|
381
|
+
_results = [];
|
382
|
+
for (y = _i = gmin; step > 0 ? _i <= gmax : _i >= gmax; y = _i += step) {
|
383
|
+
_results.push(parseFloat(y.toFixed(1 - smag)));
|
384
|
+
}
|
385
|
+
return _results;
|
386
|
+
})();
|
387
|
+
} else {
|
388
|
+
grid = (function() {
|
389
|
+
var _i, _results;
|
390
|
+
_results = [];
|
391
|
+
for (y = _i = gmin; step > 0 ? _i <= gmax : _i >= gmax; y = _i += step) {
|
392
|
+
_results.push(y);
|
393
|
+
}
|
394
|
+
return _results;
|
395
|
+
})();
|
396
|
+
}
|
397
|
+
return grid;
|
398
|
+
};
|
399
|
+
|
400
|
+
Grid.prototype._calc = function() {
|
401
|
+
var bottomOffsets, gridLine, h, i, w, yLabelWidths, _ref, _ref1;
|
402
|
+
w = this.el.width();
|
403
|
+
h = this.el.height();
|
404
|
+
if (this.elementWidth !== w || this.elementHeight !== h || this.dirty) {
|
405
|
+
this.elementWidth = w;
|
406
|
+
this.elementHeight = h;
|
407
|
+
this.dirty = false;
|
408
|
+
this.left = this.options.padding;
|
409
|
+
this.right = this.elementWidth - this.options.padding;
|
410
|
+
this.top = this.options.padding;
|
411
|
+
this.bottom = this.elementHeight - this.options.padding;
|
412
|
+
if ((_ref = this.options.axes) === true || _ref === 'both' || _ref === 'y') {
|
413
|
+
yLabelWidths = (function() {
|
414
|
+
var _i, _len, _ref1, _results;
|
415
|
+
_ref1 = this.grid;
|
416
|
+
_results = [];
|
417
|
+
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
418
|
+
gridLine = _ref1[_i];
|
419
|
+
_results.push(this.measureText(this.yAxisFormat(gridLine)).width);
|
420
|
+
}
|
421
|
+
return _results;
|
422
|
+
}).call(this);
|
423
|
+
this.left += Math.max.apply(Math, yLabelWidths);
|
424
|
+
}
|
425
|
+
if ((_ref1 = this.options.axes) === true || _ref1 === 'both' || _ref1 === 'x') {
|
426
|
+
bottomOffsets = (function() {
|
427
|
+
var _i, _ref2, _results;
|
428
|
+
_results = [];
|
429
|
+
for (i = _i = 0, _ref2 = this.data.length; 0 <= _ref2 ? _i < _ref2 : _i > _ref2; i = 0 <= _ref2 ? ++_i : --_i) {
|
430
|
+
_results.push(this.measureText(this.data[i].text, -this.options.xLabelAngle).height);
|
431
|
+
}
|
432
|
+
return _results;
|
433
|
+
}).call(this);
|
434
|
+
this.bottom -= Math.max.apply(Math, bottomOffsets);
|
435
|
+
}
|
436
|
+
this.width = Math.max(1, this.right - this.left);
|
437
|
+
this.height = Math.max(1, this.bottom - this.top);
|
438
|
+
this.dx = this.width / (this.xmax - this.xmin);
|
439
|
+
this.dy = this.height / (this.ymax - this.ymin);
|
440
|
+
if (this.calc) {
|
441
|
+
return this.calc();
|
442
|
+
}
|
443
|
+
}
|
444
|
+
};
|
445
|
+
|
446
|
+
Grid.prototype.transY = function(y) {
|
447
|
+
return this.bottom - (y - this.ymin) * this.dy;
|
448
|
+
};
|
449
|
+
|
450
|
+
Grid.prototype.transX = function(x) {
|
451
|
+
if (this.data.length === 1) {
|
452
|
+
return (this.left + this.right) / 2;
|
453
|
+
} else {
|
454
|
+
return this.left + (x - this.xmin) * this.dx;
|
455
|
+
}
|
456
|
+
};
|
457
|
+
|
458
|
+
Grid.prototype.redraw = function() {
|
459
|
+
this.raphael.clear();
|
460
|
+
this._calc();
|
461
|
+
this.drawGrid();
|
462
|
+
this.drawGoals();
|
463
|
+
this.drawEvents();
|
464
|
+
if (this.draw) {
|
465
|
+
return this.draw();
|
466
|
+
}
|
467
|
+
};
|
468
|
+
|
469
|
+
Grid.prototype.measureText = function(text, angle) {
|
470
|
+
var ret, tt;
|
471
|
+
if (angle == null) {
|
472
|
+
angle = 0;
|
473
|
+
}
|
474
|
+
tt = this.raphael.text(100, 100, text).attr('font-size', this.options.gridTextSize).attr('font-family', this.options.gridTextFamily).attr('font-weight', this.options.gridTextWeight).rotate(angle);
|
475
|
+
ret = tt.getBBox();
|
476
|
+
tt.remove();
|
477
|
+
return ret;
|
478
|
+
};
|
479
|
+
|
480
|
+
Grid.prototype.yAxisFormat = function(label) {
|
481
|
+
return this.yLabelFormat(label);
|
482
|
+
};
|
483
|
+
|
484
|
+
Grid.prototype.yLabelFormat = function(label) {
|
485
|
+
if (typeof this.options.yLabelFormat === 'function') {
|
486
|
+
return this.options.yLabelFormat(label);
|
487
|
+
} else {
|
488
|
+
return "" + this.options.preUnits + (Morris.commas(label)) + this.options.postUnits;
|
489
|
+
}
|
490
|
+
};
|
491
|
+
|
492
|
+
Grid.prototype.drawGrid = function() {
|
493
|
+
var lineY, y, _i, _len, _ref, _ref1, _ref2, _results;
|
494
|
+
if (this.options.grid === false && ((_ref = this.options.axes) !== true && _ref !== 'both' && _ref !== 'y')) {
|
495
|
+
return;
|
496
|
+
}
|
497
|
+
_ref1 = this.grid;
|
498
|
+
_results = [];
|
499
|
+
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
|
500
|
+
lineY = _ref1[_i];
|
501
|
+
y = this.transY(lineY);
|
502
|
+
if ((_ref2 = this.options.axes) === true || _ref2 === 'both' || _ref2 === 'y') {
|
503
|
+
this.drawYAxisLabel(this.left - this.options.padding / 2, y, this.yAxisFormat(lineY));
|
504
|
+
}
|
505
|
+
if (this.options.grid) {
|
506
|
+
_results.push(this.drawGridLine("M" + this.left + "," + y + "H" + (this.left + this.width)));
|
507
|
+
} else {
|
508
|
+
_results.push(void 0);
|
509
|
+
}
|
510
|
+
}
|
511
|
+
return _results;
|
512
|
+
};
|
513
|
+
|
514
|
+
Grid.prototype.drawGoals = function() {
|
515
|
+
var color, goal, i, _i, _len, _ref, _results;
|
516
|
+
_ref = this.options.goals;
|
517
|
+
_results = [];
|
518
|
+
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
|
519
|
+
goal = _ref[i];
|
520
|
+
color = this.options.goalLineColors[i % this.options.goalLineColors.length];
|
521
|
+
_results.push(this.drawGoal(goal, color));
|
522
|
+
}
|
523
|
+
return _results;
|
524
|
+
};
|
525
|
+
|
526
|
+
Grid.prototype.drawEvents = function() {
|
527
|
+
var color, event, i, _i, _len, _ref, _results;
|
528
|
+
_ref = this.events;
|
529
|
+
_results = [];
|
530
|
+
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
|
531
|
+
event = _ref[i];
|
532
|
+
color = this.options.eventLineColors[i % this.options.eventLineColors.length];
|
533
|
+
_results.push(this.drawEvent(event, color));
|
534
|
+
}
|
535
|
+
return _results;
|
536
|
+
};
|
537
|
+
|
538
|
+
Grid.prototype.drawGoal = function(goal, color) {
|
539
|
+
return this.raphael.path("M" + this.left + "," + (this.transY(goal)) + "H" + this.right).attr('stroke', color).attr('stroke-width', this.options.goalStrokeWidth);
|
540
|
+
};
|
541
|
+
|
542
|
+
Grid.prototype.drawEvent = function(event, color) {
|
543
|
+
return this.raphael.path("M" + (this.transX(event)) + "," + this.bottom + "V" + this.top).attr('stroke', color).attr('stroke-width', this.options.eventStrokeWidth);
|
544
|
+
};
|
545
|
+
|
546
|
+
Grid.prototype.drawYAxisLabel = function(xPos, yPos, text) {
|
547
|
+
return this.raphael.text(xPos, yPos, text).attr('font-size', this.options.gridTextSize).attr('font-family', this.options.gridTextFamily).attr('font-weight', this.options.gridTextWeight).attr('fill', this.options.gridTextColor).attr('text-anchor', 'end');
|
548
|
+
};
|
549
|
+
|
550
|
+
Grid.prototype.drawGridLine = function(path) {
|
551
|
+
return this.raphael.path(path).attr('stroke', this.options.gridLineColor).attr('stroke-width', this.options.gridStrokeWidth);
|
552
|
+
};
|
553
|
+
|
554
|
+
Grid.prototype.startRange = function(x) {
|
555
|
+
this.hover.hide();
|
556
|
+
this.selectFrom = x;
|
557
|
+
return this.selectionRect.attr({
|
558
|
+
x: x,
|
559
|
+
width: 0
|
560
|
+
}).show();
|
561
|
+
};
|
562
|
+
|
563
|
+
Grid.prototype.endRange = function(x) {
|
564
|
+
var end, start;
|
565
|
+
if (this.selectFrom) {
|
566
|
+
start = Math.min(this.selectFrom, x);
|
567
|
+
end = Math.max(this.selectFrom, x);
|
568
|
+
this.options.rangeSelect.call(this.el, {
|
569
|
+
start: this.data[this.hitTest(start)].x,
|
570
|
+
end: this.data[this.hitTest(end)].x
|
571
|
+
});
|
572
|
+
return this.selectFrom = null;
|
573
|
+
}
|
574
|
+
};
|
575
|
+
|
576
|
+
Grid.prototype.resizeHandler = function() {
|
577
|
+
this.timeoutId = null;
|
578
|
+
this.raphael.setSize(this.el.width(), this.el.height());
|
579
|
+
return this.redraw();
|
580
|
+
};
|
581
|
+
|
582
|
+
return Grid;
|
583
|
+
|
584
|
+
})(Morris.EventEmitter);
|
585
|
+
|
586
|
+
Morris.parseDate = function(date) {
|
587
|
+
var isecs, m, msecs, n, o, offsetmins, p, q, r, ret, secs;
|
588
|
+
if (typeof date === 'number') {
|
589
|
+
return date;
|
590
|
+
}
|
591
|
+
m = date.match(/^(\d+) Q(\d)$/);
|
592
|
+
n = date.match(/^(\d+)-(\d+)$/);
|
593
|
+
o = date.match(/^(\d+)-(\d+)-(\d+)$/);
|
594
|
+
p = date.match(/^(\d+) W(\d+)$/);
|
595
|
+
q = date.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+)(Z|([+-])(\d\d):?(\d\d))?$/);
|
596
|
+
r = date.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+):(\d+(\.\d+)?)(Z|([+-])(\d\d):?(\d\d))?$/);
|
597
|
+
if (m) {
|
598
|
+
return new Date(parseInt(m[1], 10), parseInt(m[2], 10) * 3 - 1, 1).getTime();
|
599
|
+
} else if (n) {
|
600
|
+
return new Date(parseInt(n[1], 10), parseInt(n[2], 10) - 1, 1).getTime();
|
601
|
+
} else if (o) {
|
602
|
+
return new Date(parseInt(o[1], 10), parseInt(o[2], 10) - 1, parseInt(o[3], 10)).getTime();
|
603
|
+
} else if (p) {
|
604
|
+
ret = new Date(parseInt(p[1], 10), 0, 1);
|
605
|
+
if (ret.getDay() !== 4) {
|
606
|
+
ret.setMonth(0, 1 + ((4 - ret.getDay()) + 7) % 7);
|
607
|
+
}
|
608
|
+
return ret.getTime() + parseInt(p[2], 10) * 604800000;
|
609
|
+
} else if (q) {
|
610
|
+
if (!q[6]) {
|
611
|
+
return new Date(parseInt(q[1], 10), parseInt(q[2], 10) - 1, parseInt(q[3], 10), parseInt(q[4], 10), parseInt(q[5], 10)).getTime();
|
612
|
+
} else {
|
613
|
+
offsetmins = 0;
|
614
|
+
if (q[6] !== 'Z') {
|
615
|
+
offsetmins = parseInt(q[8], 10) * 60 + parseInt(q[9], 10);
|
616
|
+
if (q[7] === '+') {
|
617
|
+
offsetmins = 0 - offsetmins;
|
618
|
+
}
|
619
|
+
}
|
620
|
+
return Date.UTC(parseInt(q[1], 10), parseInt(q[2], 10) - 1, parseInt(q[3], 10), parseInt(q[4], 10), parseInt(q[5], 10) + offsetmins);
|
621
|
+
}
|
622
|
+
} else if (r) {
|
623
|
+
secs = parseFloat(r[6]);
|
624
|
+
isecs = Math.floor(secs);
|
625
|
+
msecs = Math.round((secs - isecs) * 1000);
|
626
|
+
if (!r[8]) {
|
627
|
+
return new Date(parseInt(r[1], 10), parseInt(r[2], 10) - 1, parseInt(r[3], 10), parseInt(r[4], 10), parseInt(r[5], 10), isecs, msecs).getTime();
|
628
|
+
} else {
|
629
|
+
offsetmins = 0;
|
630
|
+
if (r[8] !== 'Z') {
|
631
|
+
offsetmins = parseInt(r[10], 10) * 60 + parseInt(r[11], 10);
|
632
|
+
if (r[9] === '+') {
|
633
|
+
offsetmins = 0 - offsetmins;
|
634
|
+
}
|
635
|
+
}
|
636
|
+
return Date.UTC(parseInt(r[1], 10), parseInt(r[2], 10) - 1, parseInt(r[3], 10), parseInt(r[4], 10), parseInt(r[5], 10) + offsetmins, isecs, msecs);
|
637
|
+
}
|
638
|
+
} else {
|
639
|
+
return new Date(parseInt(date, 10), 0, 1).getTime();
|
640
|
+
}
|
641
|
+
};
|
642
|
+
|
643
|
+
Morris.Hover = (function() {
|
644
|
+
Hover.defaults = {
|
645
|
+
"class": 'morris-hover morris-default-style'
|
646
|
+
};
|
647
|
+
|
648
|
+
function Hover(options) {
|
649
|
+
if (options == null) {
|
650
|
+
options = {};
|
651
|
+
}
|
652
|
+
this.options = $.extend({}, Morris.Hover.defaults, options);
|
653
|
+
this.el = $("<div class='" + this.options["class"] + "'></div>");
|
654
|
+
this.el.hide();
|
655
|
+
this.options.parent.append(this.el);
|
656
|
+
}
|
657
|
+
|
658
|
+
Hover.prototype.update = function(html, x, y) {
|
659
|
+
this.html;
|
660
|
+
this.show();
|
661
|
+
return this.moveTo(x, y);
|
662
|
+
};
|
663
|
+
|
664
|
+
Hover.prototype.html = function(content) {
|
665
|
+
return this.el.html(content);
|
666
|
+
};
|
667
|
+
|
668
|
+
Hover.prototype.moveTo = function(x, y) {
|
669
|
+
var hoverHeight, hoverWidth, left, parentHeight, parentWidth, top;
|
670
|
+
parentWidth = this.options.parent.innerWidth();
|
671
|
+
parentHeight = this.options.parent.innerHeight();
|
672
|
+
hoverWidth = this.el.outerWidth();
|
673
|
+
hoverHeight = this.el.outerHeight();
|
674
|
+
left = Math.min(Math.max(0, x - hoverWidth / 2), parentWidth - hoverWidth);
|
675
|
+
if (y != null) {
|
676
|
+
top = y - hoverHeight - 10;
|
677
|
+
if (top < 0) {
|
678
|
+
top = y + 10;
|
679
|
+
if (top + hoverHeight > parentHeight) {
|
680
|
+
top = parentHeight / 2 - hoverHeight / 2;
|
681
|
+
}
|
682
|
+
}
|
683
|
+
} else {
|
684
|
+
top = parentHeight / 2 - hoverHeight / 2;
|
685
|
+
}
|
686
|
+
return this.el.css({
|
687
|
+
left: left + "px",
|
688
|
+
top: parseInt(top) + "px"
|
689
|
+
});
|
690
|
+
};
|
691
|
+
|
692
|
+
Hover.prototype.show = function() {
|
693
|
+
return this.el.show();
|
694
|
+
};
|
695
|
+
|
696
|
+
Hover.prototype.hide = function() {
|
697
|
+
return this.el.hide();
|
698
|
+
};
|
699
|
+
|
700
|
+
return Hover;
|
701
|
+
|
702
|
+
})();
|
703
|
+
|
704
|
+
Morris.Line = (function(_super) {
|
705
|
+
__extends(Line, _super);
|
706
|
+
|
707
|
+
function Line(options) {
|
708
|
+
this.hilight = __bind(this.hilight, this);
|
709
|
+
this.onHoverOut = __bind(this.onHoverOut, this);
|
710
|
+
this.onHoverMove = __bind(this.onHoverMove, this);
|
711
|
+
this.onGridClick = __bind(this.onGridClick, this);
|
712
|
+
if (!(this instanceof Morris.Line)) {
|
713
|
+
return new Morris.Line(options);
|
714
|
+
}
|
715
|
+
Line.__super__.constructor.call(this, options);
|
716
|
+
}
|
717
|
+
|
718
|
+
Line.prototype.init = function() {
|
719
|
+
if (this.options.hideHover !== 'always') {
|
720
|
+
this.hover = new Morris.Hover({
|
721
|
+
parent: this.el
|
722
|
+
});
|
723
|
+
this.on('hovermove', this.onHoverMove);
|
724
|
+
this.on('hoverout', this.onHoverOut);
|
725
|
+
return this.on('gridclick', this.onGridClick);
|
726
|
+
}
|
727
|
+
};
|
728
|
+
|
729
|
+
Line.prototype.defaults = {
|
730
|
+
lineWidth: 3,
|
731
|
+
pointSize: 4,
|
732
|
+
lineColors: ['#0b62a4', '#7A92A3', '#4da74d', '#afd8f8', '#edc240', '#cb4b4b', '#9440ed'],
|
733
|
+
pointStrokeWidths: [1],
|
734
|
+
pointStrokeColors: ['#ffffff'],
|
735
|
+
pointFillColors: [],
|
736
|
+
smooth: true,
|
737
|
+
xLabels: 'auto',
|
738
|
+
xLabelFormat: null,
|
739
|
+
xLabelMargin: 24,
|
740
|
+
continuousLine: true,
|
741
|
+
hideHover: false
|
742
|
+
};
|
743
|
+
|
744
|
+
Line.prototype.calc = function() {
|
745
|
+
this.calcPoints();
|
746
|
+
return this.generatePaths();
|
747
|
+
};
|
748
|
+
|
749
|
+
Line.prototype.calcPoints = function() {
|
750
|
+
var row, y, _i, _len, _ref, _results;
|
751
|
+
_ref = this.data;
|
752
|
+
_results = [];
|
753
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
754
|
+
row = _ref[_i];
|
755
|
+
row._x = this.transX(row.x);
|
756
|
+
row._y = (function() {
|
757
|
+
var _j, _len1, _ref1, _results1;
|
758
|
+
_ref1 = row.y;
|
759
|
+
_results1 = [];
|
760
|
+
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
761
|
+
y = _ref1[_j];
|
762
|
+
if (y != null) {
|
763
|
+
_results1.push(this.transY(y));
|
764
|
+
} else {
|
765
|
+
_results1.push(y);
|
766
|
+
}
|
767
|
+
}
|
768
|
+
return _results1;
|
769
|
+
}).call(this);
|
770
|
+
_results.push(row._ymax = Math.min.apply(Math, [this.bottom].concat((function() {
|
771
|
+
var _j, _len1, _ref1, _results1;
|
772
|
+
_ref1 = row._y;
|
773
|
+
_results1 = [];
|
774
|
+
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
775
|
+
y = _ref1[_j];
|
776
|
+
if (y != null) {
|
777
|
+
_results1.push(y);
|
778
|
+
}
|
779
|
+
}
|
780
|
+
return _results1;
|
781
|
+
})())));
|
782
|
+
}
|
783
|
+
return _results;
|
784
|
+
};
|
785
|
+
|
786
|
+
Line.prototype.hitTest = function(x) {
|
787
|
+
var index, r, _i, _len, _ref;
|
788
|
+
if (this.data.length === 0) {
|
789
|
+
return null;
|
790
|
+
}
|
791
|
+
_ref = this.data.slice(1);
|
792
|
+
for (index = _i = 0, _len = _ref.length; _i < _len; index = ++_i) {
|
793
|
+
r = _ref[index];
|
794
|
+
if (x < (r._x + this.data[index]._x) / 2) {
|
795
|
+
break;
|
796
|
+
}
|
797
|
+
}
|
798
|
+
return index;
|
799
|
+
};
|
800
|
+
|
801
|
+
Line.prototype.onGridClick = function(x, y) {
|
802
|
+
var index;
|
803
|
+
index = this.hitTest(x);
|
804
|
+
return this.fire('click', index, this.data[index].src, x, y);
|
805
|
+
};
|
806
|
+
|
807
|
+
Line.prototype.onHoverMove = function(x, y) {
|
808
|
+
var index;
|
809
|
+
index = this.hitTest(x);
|
810
|
+
return this.displayHoverForRow(index);
|
811
|
+
};
|
812
|
+
|
813
|
+
Line.prototype.onHoverOut = function() {
|
814
|
+
if (this.options.hideHover !== false) {
|
815
|
+
return this.displayHoverForRow(null);
|
816
|
+
}
|
817
|
+
};
|
818
|
+
|
819
|
+
Line.prototype.displayHoverForRow = function(index) {
|
820
|
+
var _ref;
|
821
|
+
if (index != null) {
|
822
|
+
(_ref = this.hover).update.apply(_ref, this.hoverContentForRow(index));
|
823
|
+
return this.hilight(index);
|
824
|
+
} else {
|
825
|
+
this.hover.hide();
|
826
|
+
return this.hilight();
|
827
|
+
}
|
828
|
+
};
|
829
|
+
|
830
|
+
Line.prototype.hoverContentForRow = function(index) {
|
831
|
+
var content, j, row, y, _i, _len, _ref;
|
832
|
+
row = this.data[index];
|
833
|
+
content = "<div class='morris-hover-row-label'>" + row.label + "</div>";
|
834
|
+
_ref = row.y;
|
835
|
+
for (j = _i = 0, _len = _ref.length; _i < _len; j = ++_i) {
|
836
|
+
y = _ref[j];
|
837
|
+
content += "<div class='morris-hover-point' style='color: " + (this.colorFor(row, j, 'label')) + "'>\n " + this.options.labels[j] + ":\n " + (this.yLabelFormat(y)) + "\n</div>";
|
838
|
+
}
|
839
|
+
if (typeof this.options.hoverCallback === 'function') {
|
840
|
+
content = this.options.hoverCallback(index, this.options, content, row.src);
|
841
|
+
}
|
842
|
+
return [content, row._x, row._ymax];
|
843
|
+
};
|
844
|
+
|
845
|
+
Line.prototype.generatePaths = function() {
|
846
|
+
var c, coords, i, r, smooth;
|
847
|
+
return this.paths = (function() {
|
848
|
+
var _i, _ref, _ref1, _results;
|
849
|
+
_results = [];
|
850
|
+
for (i = _i = 0, _ref = this.options.ykeys.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
|
851
|
+
smooth = typeof this.options.smooth === "boolean" ? this.options.smooth : (_ref1 = this.options.ykeys[i], __indexOf.call(this.options.smooth, _ref1) >= 0);
|
852
|
+
coords = (function() {
|
853
|
+
var _j, _len, _ref2, _results1;
|
854
|
+
_ref2 = this.data;
|
855
|
+
_results1 = [];
|
856
|
+
for (_j = 0, _len = _ref2.length; _j < _len; _j++) {
|
857
|
+
r = _ref2[_j];
|
858
|
+
if (r._y[i] !== void 0) {
|
859
|
+
_results1.push({
|
860
|
+
x: r._x,
|
861
|
+
y: r._y[i]
|
862
|
+
});
|
863
|
+
}
|
864
|
+
}
|
865
|
+
return _results1;
|
866
|
+
}).call(this);
|
867
|
+
if (this.options.continuousLine) {
|
868
|
+
coords = (function() {
|
869
|
+
var _j, _len, _results1;
|
870
|
+
_results1 = [];
|
871
|
+
for (_j = 0, _len = coords.length; _j < _len; _j++) {
|
872
|
+
c = coords[_j];
|
873
|
+
if (c.y !== null) {
|
874
|
+
_results1.push(c);
|
875
|
+
}
|
876
|
+
}
|
877
|
+
return _results1;
|
878
|
+
})();
|
879
|
+
}
|
880
|
+
if (coords.length > 1) {
|
881
|
+
_results.push(Morris.Line.createPath(coords, smooth, this.bottom));
|
882
|
+
} else {
|
883
|
+
_results.push(null);
|
884
|
+
}
|
885
|
+
}
|
886
|
+
return _results;
|
887
|
+
}).call(this);
|
888
|
+
};
|
889
|
+
|
890
|
+
Line.prototype.draw = function() {
|
891
|
+
var _ref;
|
892
|
+
if ((_ref = this.options.axes) === true || _ref === 'both' || _ref === 'x') {
|
893
|
+
this.drawXAxis();
|
894
|
+
}
|
895
|
+
this.drawSeries();
|
896
|
+
if (this.options.hideHover === false) {
|
897
|
+
return this.displayHoverForRow(this.data.length - 1);
|
898
|
+
}
|
899
|
+
};
|
900
|
+
|
901
|
+
Line.prototype.drawXAxis = function() {
|
902
|
+
var drawLabel, l, labels, prevAngleMargin, prevLabelMargin, row, ypos, _i, _len, _results,
|
903
|
+
_this = this;
|
904
|
+
ypos = this.bottom + this.options.padding / 2;
|
905
|
+
prevLabelMargin = null;
|
906
|
+
prevAngleMargin = null;
|
907
|
+
drawLabel = function(labelText, xpos) {
|
908
|
+
var label, labelBox, margin, offset, textBox;
|
909
|
+
label = _this.drawXAxisLabel(_this.transX(xpos), ypos, labelText);
|
910
|
+
textBox = label.getBBox();
|
911
|
+
label.transform("r" + (-_this.options.xLabelAngle));
|
912
|
+
labelBox = label.getBBox();
|
913
|
+
label.transform("t0," + (labelBox.height / 2) + "...");
|
914
|
+
if (_this.options.xLabelAngle !== 0) {
|
915
|
+
offset = -0.5 * textBox.width * Math.cos(_this.options.xLabelAngle * Math.PI / 180.0);
|
916
|
+
label.transform("t" + offset + ",0...");
|
917
|
+
}
|
918
|
+
labelBox = label.getBBox();
|
919
|
+
if (((prevLabelMargin == null) || prevLabelMargin >= labelBox.x + labelBox.width || (prevAngleMargin != null) && prevAngleMargin >= labelBox.x) && labelBox.x >= 0 && (labelBox.x + labelBox.width) < _this.el.width()) {
|
920
|
+
if (_this.options.xLabelAngle !== 0) {
|
921
|
+
margin = 1.25 * _this.options.gridTextSize / Math.sin(_this.options.xLabelAngle * Math.PI / 180.0);
|
922
|
+
prevAngleMargin = labelBox.x - margin;
|
923
|
+
}
|
924
|
+
return prevLabelMargin = labelBox.x - _this.options.xLabelMargin;
|
925
|
+
} else {
|
926
|
+
return label.remove();
|
927
|
+
}
|
928
|
+
};
|
929
|
+
if (this.options.parseTime) {
|
930
|
+
if (this.data.length === 1 && this.options.xLabels === 'auto') {
|
931
|
+
labels = [[this.data[0].label, this.data[0].x]];
|
932
|
+
} else {
|
933
|
+
labels = Morris.labelSeries(this.xmin, this.xmax, this.width, this.options.xLabels, this.options.xLabelFormat);
|
934
|
+
}
|
935
|
+
} else {
|
936
|
+
labels = (function() {
|
937
|
+
var _i, _len, _ref, _results;
|
938
|
+
_ref = this.data;
|
939
|
+
_results = [];
|
940
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
941
|
+
row = _ref[_i];
|
942
|
+
_results.push([row.label, row.x]);
|
943
|
+
}
|
944
|
+
return _results;
|
945
|
+
}).call(this);
|
946
|
+
}
|
947
|
+
labels.reverse();
|
948
|
+
_results = [];
|
949
|
+
for (_i = 0, _len = labels.length; _i < _len; _i++) {
|
950
|
+
l = labels[_i];
|
951
|
+
_results.push(drawLabel(l[0], l[1]));
|
952
|
+
}
|
953
|
+
return _results;
|
954
|
+
};
|
955
|
+
|
956
|
+
Line.prototype.drawSeries = function() {
|
957
|
+
var i, _i, _j, _ref, _ref1, _results;
|
958
|
+
this.seriesPoints = [];
|
959
|
+
for (i = _i = _ref = this.options.ykeys.length - 1; _ref <= 0 ? _i <= 0 : _i >= 0; i = _ref <= 0 ? ++_i : --_i) {
|
960
|
+
this._drawLineFor(i);
|
961
|
+
}
|
962
|
+
_results = [];
|
963
|
+
for (i = _j = _ref1 = this.options.ykeys.length - 1; _ref1 <= 0 ? _j <= 0 : _j >= 0; i = _ref1 <= 0 ? ++_j : --_j) {
|
964
|
+
_results.push(this._drawPointFor(i));
|
965
|
+
}
|
966
|
+
return _results;
|
967
|
+
};
|
968
|
+
|
969
|
+
Line.prototype._drawPointFor = function(index) {
|
970
|
+
var circle, row, _i, _len, _ref, _results;
|
971
|
+
this.seriesPoints[index] = [];
|
972
|
+
_ref = this.data;
|
973
|
+
_results = [];
|
974
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
975
|
+
row = _ref[_i];
|
976
|
+
circle = null;
|
977
|
+
if (row._y[index] != null) {
|
978
|
+
circle = this.drawLinePoint(row._x, row._y[index], this.colorFor(row, index, 'point'), index);
|
979
|
+
}
|
980
|
+
_results.push(this.seriesPoints[index].push(circle));
|
981
|
+
}
|
982
|
+
return _results;
|
983
|
+
};
|
984
|
+
|
985
|
+
Line.prototype._drawLineFor = function(index) {
|
986
|
+
var path;
|
987
|
+
path = this.paths[index];
|
988
|
+
if (path !== null) {
|
989
|
+
return this.drawLinePath(path, this.colorFor(null, index, 'line'), index);
|
990
|
+
}
|
991
|
+
};
|
992
|
+
|
993
|
+
Line.createPath = function(coords, smooth, bottom) {
|
994
|
+
var coord, g, grads, i, ix, lg, path, prevCoord, x1, x2, y1, y2, _i, _len;
|
995
|
+
path = "";
|
996
|
+
if (smooth) {
|
997
|
+
grads = Morris.Line.gradients(coords);
|
998
|
+
}
|
999
|
+
prevCoord = {
|
1000
|
+
y: null
|
1001
|
+
};
|
1002
|
+
for (i = _i = 0, _len = coords.length; _i < _len; i = ++_i) {
|
1003
|
+
coord = coords[i];
|
1004
|
+
if (coord.y != null) {
|
1005
|
+
if (prevCoord.y != null) {
|
1006
|
+
if (smooth) {
|
1007
|
+
g = grads[i];
|
1008
|
+
lg = grads[i - 1];
|
1009
|
+
ix = (coord.x - prevCoord.x) / 4;
|
1010
|
+
x1 = prevCoord.x + ix;
|
1011
|
+
y1 = Math.min(bottom, prevCoord.y + ix * lg);
|
1012
|
+
x2 = coord.x - ix;
|
1013
|
+
y2 = Math.min(bottom, coord.y - ix * g);
|
1014
|
+
path += "C" + x1 + "," + y1 + "," + x2 + "," + y2 + "," + coord.x + "," + coord.y;
|
1015
|
+
} else {
|
1016
|
+
path += "L" + coord.x + "," + coord.y;
|
1017
|
+
}
|
1018
|
+
} else {
|
1019
|
+
if (!smooth || (grads[i] != null)) {
|
1020
|
+
path += "M" + coord.x + "," + coord.y;
|
1021
|
+
}
|
1022
|
+
}
|
1023
|
+
}
|
1024
|
+
prevCoord = coord;
|
1025
|
+
}
|
1026
|
+
return path;
|
1027
|
+
};
|
1028
|
+
|
1029
|
+
Line.gradients = function(coords) {
|
1030
|
+
var coord, grad, i, nextCoord, prevCoord, _i, _len, _results;
|
1031
|
+
grad = function(a, b) {
|
1032
|
+
return (a.y - b.y) / (a.x - b.x);
|
1033
|
+
};
|
1034
|
+
_results = [];
|
1035
|
+
for (i = _i = 0, _len = coords.length; _i < _len; i = ++_i) {
|
1036
|
+
coord = coords[i];
|
1037
|
+
if (coord.y != null) {
|
1038
|
+
nextCoord = coords[i + 1] || {
|
1039
|
+
y: null
|
1040
|
+
};
|
1041
|
+
prevCoord = coords[i - 1] || {
|
1042
|
+
y: null
|
1043
|
+
};
|
1044
|
+
if ((prevCoord.y != null) && (nextCoord.y != null)) {
|
1045
|
+
_results.push(grad(prevCoord, nextCoord));
|
1046
|
+
} else if (prevCoord.y != null) {
|
1047
|
+
_results.push(grad(prevCoord, coord));
|
1048
|
+
} else if (nextCoord.y != null) {
|
1049
|
+
_results.push(grad(coord, nextCoord));
|
1050
|
+
} else {
|
1051
|
+
_results.push(null);
|
1052
|
+
}
|
1053
|
+
} else {
|
1054
|
+
_results.push(null);
|
1055
|
+
}
|
1056
|
+
}
|
1057
|
+
return _results;
|
1058
|
+
};
|
1059
|
+
|
1060
|
+
Line.prototype.hilight = function(index) {
|
1061
|
+
var i, _i, _j, _ref, _ref1;
|
1062
|
+
if (this.prevHilight !== null && this.prevHilight !== index) {
|
1063
|
+
for (i = _i = 0, _ref = this.seriesPoints.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) {
|
1064
|
+
if (this.seriesPoints[i][this.prevHilight]) {
|
1065
|
+
this.seriesPoints[i][this.prevHilight].animate(this.pointShrinkSeries(i));
|
1066
|
+
}
|
1067
|
+
}
|
1068
|
+
}
|
1069
|
+
if (index !== null && this.prevHilight !== index) {
|
1070
|
+
for (i = _j = 0, _ref1 = this.seriesPoints.length - 1; 0 <= _ref1 ? _j <= _ref1 : _j >= _ref1; i = 0 <= _ref1 ? ++_j : --_j) {
|
1071
|
+
if (this.seriesPoints[i][index]) {
|
1072
|
+
this.seriesPoints[i][index].animate(this.pointGrowSeries(i));
|
1073
|
+
}
|
1074
|
+
}
|
1075
|
+
}
|
1076
|
+
return this.prevHilight = index;
|
1077
|
+
};
|
1078
|
+
|
1079
|
+
Line.prototype.colorFor = function(row, sidx, type) {
|
1080
|
+
if (typeof this.options.lineColors === 'function') {
|
1081
|
+
return this.options.lineColors.call(this, row, sidx, type);
|
1082
|
+
} else if (type === 'point') {
|
1083
|
+
return this.options.pointFillColors[sidx % this.options.pointFillColors.length] || this.options.lineColors[sidx % this.options.lineColors.length];
|
1084
|
+
} else {
|
1085
|
+
return this.options.lineColors[sidx % this.options.lineColors.length];
|
1086
|
+
}
|
1087
|
+
};
|
1088
|
+
|
1089
|
+
Line.prototype.drawXAxisLabel = function(xPos, yPos, text) {
|
1090
|
+
return this.raphael.text(xPos, yPos, text).attr('font-size', this.options.gridTextSize).attr('font-family', this.options.gridTextFamily).attr('font-weight', this.options.gridTextWeight).attr('fill', this.options.gridTextColor);
|
1091
|
+
};
|
1092
|
+
|
1093
|
+
Line.prototype.drawLinePath = function(path, lineColor, lineIndex) {
|
1094
|
+
return this.raphael.path(path).attr('stroke', lineColor).attr('stroke-width', this.lineWidthForSeries(lineIndex));
|
1095
|
+
};
|
1096
|
+
|
1097
|
+
Line.prototype.drawLinePoint = function(xPos, yPos, pointColor, lineIndex) {
|
1098
|
+
return this.raphael.circle(xPos, yPos, this.pointSizeForSeries(lineIndex)).attr('fill', pointColor).attr('stroke-width', this.pointStrokeWidthForSeries(lineIndex)).attr('stroke', this.pointStrokeColorForSeries(lineIndex));
|
1099
|
+
};
|
1100
|
+
|
1101
|
+
Line.prototype.pointStrokeWidthForSeries = function(index) {
|
1102
|
+
return this.options.pointStrokeWidths[index % this.options.pointStrokeWidths.length];
|
1103
|
+
};
|
1104
|
+
|
1105
|
+
Line.prototype.pointStrokeColorForSeries = function(index) {
|
1106
|
+
return this.options.pointStrokeColors[index % this.options.pointStrokeColors.length];
|
1107
|
+
};
|
1108
|
+
|
1109
|
+
Line.prototype.lineWidthForSeries = function(index) {
|
1110
|
+
if (this.options.lineWidth instanceof Array) {
|
1111
|
+
return this.options.lineWidth[index % this.options.lineWidth.length];
|
1112
|
+
} else {
|
1113
|
+
return this.options.lineWidth;
|
1114
|
+
}
|
1115
|
+
};
|
1116
|
+
|
1117
|
+
Line.prototype.pointSizeForSeries = function(index) {
|
1118
|
+
if (this.options.pointSize instanceof Array) {
|
1119
|
+
return this.options.pointSize[index % this.options.pointSize.length];
|
1120
|
+
} else {
|
1121
|
+
return this.options.pointSize;
|
1122
|
+
}
|
1123
|
+
};
|
1124
|
+
|
1125
|
+
Line.prototype.pointGrowSeries = function(index) {
|
1126
|
+
return Raphael.animation({
|
1127
|
+
r: this.pointSizeForSeries(index) + 3
|
1128
|
+
}, 25, 'linear');
|
1129
|
+
};
|
1130
|
+
|
1131
|
+
Line.prototype.pointShrinkSeries = function(index) {
|
1132
|
+
return Raphael.animation({
|
1133
|
+
r: this.pointSizeForSeries(index)
|
1134
|
+
}, 25, 'linear');
|
1135
|
+
};
|
1136
|
+
|
1137
|
+
return Line;
|
1138
|
+
|
1139
|
+
})(Morris.Grid);
|
1140
|
+
|
1141
|
+
Morris.labelSeries = function(dmin, dmax, pxwidth, specName, xLabelFormat) {
|
1142
|
+
var d, d0, ddensity, name, ret, s, spec, t, _i, _len, _ref;
|
1143
|
+
ddensity = 200 * (dmax - dmin) / pxwidth;
|
1144
|
+
d0 = new Date(dmin);
|
1145
|
+
spec = Morris.LABEL_SPECS[specName];
|
1146
|
+
if (spec === void 0) {
|
1147
|
+
_ref = Morris.AUTO_LABEL_ORDER;
|
1148
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1149
|
+
name = _ref[_i];
|
1150
|
+
s = Morris.LABEL_SPECS[name];
|
1151
|
+
if (ddensity >= s.span) {
|
1152
|
+
spec = s;
|
1153
|
+
break;
|
1154
|
+
}
|
1155
|
+
}
|
1156
|
+
}
|
1157
|
+
if (spec === void 0) {
|
1158
|
+
spec = Morris.LABEL_SPECS["second"];
|
1159
|
+
}
|
1160
|
+
if (xLabelFormat) {
|
1161
|
+
spec = $.extend({}, spec, {
|
1162
|
+
fmt: xLabelFormat
|
1163
|
+
});
|
1164
|
+
}
|
1165
|
+
d = spec.start(d0);
|
1166
|
+
ret = [];
|
1167
|
+
while ((t = d.getTime()) <= dmax) {
|
1168
|
+
if (t >= dmin) {
|
1169
|
+
ret.push([spec.fmt(d), t]);
|
1170
|
+
}
|
1171
|
+
spec.incr(d);
|
1172
|
+
}
|
1173
|
+
return ret;
|
1174
|
+
};
|
1175
|
+
|
1176
|
+
minutesSpecHelper = function(interval) {
|
1177
|
+
return {
|
1178
|
+
span: interval * 60 * 1000,
|
1179
|
+
start: function(d) {
|
1180
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours());
|
1181
|
+
},
|
1182
|
+
fmt: function(d) {
|
1183
|
+
return "" + (Morris.pad2(d.getHours())) + ":" + (Morris.pad2(d.getMinutes()));
|
1184
|
+
},
|
1185
|
+
incr: function(d) {
|
1186
|
+
return d.setUTCMinutes(d.getUTCMinutes() + interval);
|
1187
|
+
}
|
1188
|
+
};
|
1189
|
+
};
|
1190
|
+
|
1191
|
+
secondsSpecHelper = function(interval) {
|
1192
|
+
return {
|
1193
|
+
span: interval * 1000,
|
1194
|
+
start: function(d) {
|
1195
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes());
|
1196
|
+
},
|
1197
|
+
fmt: function(d) {
|
1198
|
+
return "" + (Morris.pad2(d.getHours())) + ":" + (Morris.pad2(d.getMinutes())) + ":" + (Morris.pad2(d.getSeconds()));
|
1199
|
+
},
|
1200
|
+
incr: function(d) {
|
1201
|
+
return d.setUTCSeconds(d.getUTCSeconds() + interval);
|
1202
|
+
}
|
1203
|
+
};
|
1204
|
+
};
|
1205
|
+
|
1206
|
+
Morris.LABEL_SPECS = {
|
1207
|
+
"decade": {
|
1208
|
+
span: 172800000000,
|
1209
|
+
start: function(d) {
|
1210
|
+
return new Date(d.getFullYear() - d.getFullYear() % 10, 0, 1);
|
1211
|
+
},
|
1212
|
+
fmt: function(d) {
|
1213
|
+
return "" + (d.getFullYear());
|
1214
|
+
},
|
1215
|
+
incr: function(d) {
|
1216
|
+
return d.setFullYear(d.getFullYear() + 10);
|
1217
|
+
}
|
1218
|
+
},
|
1219
|
+
"year": {
|
1220
|
+
span: 17280000000,
|
1221
|
+
start: function(d) {
|
1222
|
+
return new Date(d.getFullYear(), 0, 1);
|
1223
|
+
},
|
1224
|
+
fmt: function(d) {
|
1225
|
+
return "" + (d.getFullYear());
|
1226
|
+
},
|
1227
|
+
incr: function(d) {
|
1228
|
+
return d.setFullYear(d.getFullYear() + 1);
|
1229
|
+
}
|
1230
|
+
},
|
1231
|
+
"month": {
|
1232
|
+
span: 2419200000,
|
1233
|
+
start: function(d) {
|
1234
|
+
return new Date(d.getFullYear(), d.getMonth(), 1);
|
1235
|
+
},
|
1236
|
+
fmt: function(d) {
|
1237
|
+
return "" + (d.getFullYear()) + "-" + (Morris.pad2(d.getMonth() + 1));
|
1238
|
+
},
|
1239
|
+
incr: function(d) {
|
1240
|
+
return d.setMonth(d.getMonth() + 1);
|
1241
|
+
}
|
1242
|
+
},
|
1243
|
+
"week": {
|
1244
|
+
span: 604800000,
|
1245
|
+
start: function(d) {
|
1246
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
1247
|
+
},
|
1248
|
+
fmt: function(d) {
|
1249
|
+
return "" + (d.getFullYear()) + "-" + (Morris.pad2(d.getMonth() + 1)) + "-" + (Morris.pad2(d.getDate()));
|
1250
|
+
},
|
1251
|
+
incr: function(d) {
|
1252
|
+
return d.setDate(d.getDate() + 7);
|
1253
|
+
}
|
1254
|
+
},
|
1255
|
+
"day": {
|
1256
|
+
span: 86400000,
|
1257
|
+
start: function(d) {
|
1258
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
1259
|
+
},
|
1260
|
+
fmt: function(d) {
|
1261
|
+
return "" + (d.getFullYear()) + "-" + (Morris.pad2(d.getMonth() + 1)) + "-" + (Morris.pad2(d.getDate()));
|
1262
|
+
},
|
1263
|
+
incr: function(d) {
|
1264
|
+
return d.setDate(d.getDate() + 1);
|
1265
|
+
}
|
1266
|
+
},
|
1267
|
+
"hour": minutesSpecHelper(60),
|
1268
|
+
"30min": minutesSpecHelper(30),
|
1269
|
+
"15min": minutesSpecHelper(15),
|
1270
|
+
"10min": minutesSpecHelper(10),
|
1271
|
+
"5min": minutesSpecHelper(5),
|
1272
|
+
"minute": minutesSpecHelper(1),
|
1273
|
+
"30sec": secondsSpecHelper(30),
|
1274
|
+
"15sec": secondsSpecHelper(15),
|
1275
|
+
"10sec": secondsSpecHelper(10),
|
1276
|
+
"5sec": secondsSpecHelper(5),
|
1277
|
+
"second": secondsSpecHelper(1)
|
1278
|
+
};
|
1279
|
+
|
1280
|
+
Morris.AUTO_LABEL_ORDER = ["decade", "year", "month", "week", "day", "hour", "30min", "15min", "10min", "5min", "minute", "30sec", "15sec", "10sec", "5sec", "second"];
|
1281
|
+
|
1282
|
+
Morris.Area = (function(_super) {
|
1283
|
+
var areaDefaults;
|
1284
|
+
|
1285
|
+
__extends(Area, _super);
|
1286
|
+
|
1287
|
+
areaDefaults = {
|
1288
|
+
fillOpacity: 'auto',
|
1289
|
+
behaveLikeLine: false
|
1290
|
+
};
|
1291
|
+
|
1292
|
+
function Area(options) {
|
1293
|
+
var areaOptions;
|
1294
|
+
if (!(this instanceof Morris.Area)) {
|
1295
|
+
return new Morris.Area(options);
|
1296
|
+
}
|
1297
|
+
areaOptions = $.extend({}, areaDefaults, options);
|
1298
|
+
this.cumulative = !areaOptions.behaveLikeLine;
|
1299
|
+
if (areaOptions.fillOpacity === 'auto') {
|
1300
|
+
areaOptions.fillOpacity = areaOptions.behaveLikeLine ? .8 : 1;
|
1301
|
+
}
|
1302
|
+
Area.__super__.constructor.call(this, areaOptions);
|
1303
|
+
}
|
1304
|
+
|
1305
|
+
Area.prototype.calcPoints = function() {
|
1306
|
+
var row, total, y, _i, _len, _ref, _results;
|
1307
|
+
_ref = this.data;
|
1308
|
+
_results = [];
|
1309
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1310
|
+
row = _ref[_i];
|
1311
|
+
row._x = this.transX(row.x);
|
1312
|
+
total = 0;
|
1313
|
+
row._y = (function() {
|
1314
|
+
var _j, _len1, _ref1, _results1;
|
1315
|
+
_ref1 = row.y;
|
1316
|
+
_results1 = [];
|
1317
|
+
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
1318
|
+
y = _ref1[_j];
|
1319
|
+
if (this.options.behaveLikeLine) {
|
1320
|
+
_results1.push(this.transY(y));
|
1321
|
+
} else {
|
1322
|
+
total += y || 0;
|
1323
|
+
_results1.push(this.transY(total));
|
1324
|
+
}
|
1325
|
+
}
|
1326
|
+
return _results1;
|
1327
|
+
}).call(this);
|
1328
|
+
_results.push(row._ymax = Math.max.apply(Math, row._y));
|
1329
|
+
}
|
1330
|
+
return _results;
|
1331
|
+
};
|
1332
|
+
|
1333
|
+
Area.prototype.drawSeries = function() {
|
1334
|
+
var i, range, _i, _j, _k, _len, _ref, _ref1, _results, _results1, _results2;
|
1335
|
+
this.seriesPoints = [];
|
1336
|
+
if (this.options.behaveLikeLine) {
|
1337
|
+
range = (function() {
|
1338
|
+
_results = [];
|
1339
|
+
for (var _i = 0, _ref = this.options.ykeys.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; 0 <= _ref ? _i++ : _i--){ _results.push(_i); }
|
1340
|
+
return _results;
|
1341
|
+
}).apply(this);
|
1342
|
+
} else {
|
1343
|
+
range = (function() {
|
1344
|
+
_results1 = [];
|
1345
|
+
for (var _j = _ref1 = this.options.ykeys.length - 1; _ref1 <= 0 ? _j <= 0 : _j >= 0; _ref1 <= 0 ? _j++ : _j--){ _results1.push(_j); }
|
1346
|
+
return _results1;
|
1347
|
+
}).apply(this);
|
1348
|
+
}
|
1349
|
+
_results2 = [];
|
1350
|
+
for (_k = 0, _len = range.length; _k < _len; _k++) {
|
1351
|
+
i = range[_k];
|
1352
|
+
this._drawFillFor(i);
|
1353
|
+
this._drawLineFor(i);
|
1354
|
+
_results2.push(this._drawPointFor(i));
|
1355
|
+
}
|
1356
|
+
return _results2;
|
1357
|
+
};
|
1358
|
+
|
1359
|
+
Area.prototype._drawFillFor = function(index) {
|
1360
|
+
var path;
|
1361
|
+
path = this.paths[index];
|
1362
|
+
if (path !== null) {
|
1363
|
+
path = path + ("L" + (this.transX(this.xmax)) + "," + this.bottom + "L" + (this.transX(this.xmin)) + "," + this.bottom + "Z");
|
1364
|
+
return this.drawFilledPath(path, this.fillForSeries(index));
|
1365
|
+
}
|
1366
|
+
};
|
1367
|
+
|
1368
|
+
Area.prototype.fillForSeries = function(i) {
|
1369
|
+
var color;
|
1370
|
+
color = Raphael.rgb2hsl(this.colorFor(this.data[i], i, 'line'));
|
1371
|
+
return Raphael.hsl(color.h, this.options.behaveLikeLine ? color.s * 0.9 : color.s * 0.75, Math.min(0.98, this.options.behaveLikeLine ? color.l * 1.2 : color.l * 1.25));
|
1372
|
+
};
|
1373
|
+
|
1374
|
+
Area.prototype.drawFilledPath = function(path, fill) {
|
1375
|
+
return this.raphael.path(path).attr('fill', fill).attr('fill-opacity', this.options.fillOpacity).attr('stroke', 'none');
|
1376
|
+
};
|
1377
|
+
|
1378
|
+
return Area;
|
1379
|
+
|
1380
|
+
})(Morris.Line);
|
1381
|
+
|
1382
|
+
Morris.Bar = (function(_super) {
|
1383
|
+
__extends(Bar, _super);
|
1384
|
+
|
1385
|
+
function Bar(options) {
|
1386
|
+
this.onHoverOut = __bind(this.onHoverOut, this);
|
1387
|
+
this.onHoverMove = __bind(this.onHoverMove, this);
|
1388
|
+
this.onGridClick = __bind(this.onGridClick, this);
|
1389
|
+
if (!(this instanceof Morris.Bar)) {
|
1390
|
+
return new Morris.Bar(options);
|
1391
|
+
}
|
1392
|
+
Bar.__super__.constructor.call(this, $.extend({}, options, {
|
1393
|
+
parseTime: false
|
1394
|
+
}));
|
1395
|
+
}
|
1396
|
+
|
1397
|
+
Bar.prototype.init = function() {
|
1398
|
+
this.cumulative = this.options.stacked;
|
1399
|
+
if (this.options.hideHover !== 'always') {
|
1400
|
+
this.hover = new Morris.Hover({
|
1401
|
+
parent: this.el
|
1402
|
+
});
|
1403
|
+
this.on('hovermove', this.onHoverMove);
|
1404
|
+
this.on('hoverout', this.onHoverOut);
|
1405
|
+
return this.on('gridclick', this.onGridClick);
|
1406
|
+
}
|
1407
|
+
};
|
1408
|
+
|
1409
|
+
Bar.prototype.defaults = {
|
1410
|
+
barSizeRatio: 0.75,
|
1411
|
+
barGap: 3,
|
1412
|
+
barColors: ['#0b62a4', '#7a92a3', '#4da74d', '#afd8f8', '#edc240', '#cb4b4b', '#9440ed'],
|
1413
|
+
barOpacity: 1.0,
|
1414
|
+
barRadius: [0, 0, 0, 0],
|
1415
|
+
xLabelMargin: 50
|
1416
|
+
};
|
1417
|
+
|
1418
|
+
Bar.prototype.calc = function() {
|
1419
|
+
var _ref;
|
1420
|
+
this.calcBars();
|
1421
|
+
if (this.options.hideHover === false) {
|
1422
|
+
return (_ref = this.hover).update.apply(_ref, this.hoverContentForRow(this.data.length - 1));
|
1423
|
+
}
|
1424
|
+
};
|
1425
|
+
|
1426
|
+
Bar.prototype.calcBars = function() {
|
1427
|
+
var idx, row, y, _i, _len, _ref, _results;
|
1428
|
+
_ref = this.data;
|
1429
|
+
_results = [];
|
1430
|
+
for (idx = _i = 0, _len = _ref.length; _i < _len; idx = ++_i) {
|
1431
|
+
row = _ref[idx];
|
1432
|
+
row._x = this.left + this.width * (idx + 0.5) / this.data.length;
|
1433
|
+
_results.push(row._y = (function() {
|
1434
|
+
var _j, _len1, _ref1, _results1;
|
1435
|
+
_ref1 = row.y;
|
1436
|
+
_results1 = [];
|
1437
|
+
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
1438
|
+
y = _ref1[_j];
|
1439
|
+
if (y != null) {
|
1440
|
+
_results1.push(this.transY(y));
|
1441
|
+
} else {
|
1442
|
+
_results1.push(null);
|
1443
|
+
}
|
1444
|
+
}
|
1445
|
+
return _results1;
|
1446
|
+
}).call(this));
|
1447
|
+
}
|
1448
|
+
return _results;
|
1449
|
+
};
|
1450
|
+
|
1451
|
+
Bar.prototype.draw = function() {
|
1452
|
+
var _ref;
|
1453
|
+
if ((_ref = this.options.axes) === true || _ref === 'both' || _ref === 'x') {
|
1454
|
+
this.drawXAxis();
|
1455
|
+
}
|
1456
|
+
return this.drawSeries();
|
1457
|
+
};
|
1458
|
+
|
1459
|
+
Bar.prototype.drawXAxis = function() {
|
1460
|
+
var i, label, labelBox, margin, offset, prevAngleMargin, prevLabelMargin, row, textBox, ypos, _i, _ref, _results;
|
1461
|
+
ypos = this.bottom + (this.options.xAxisLabelTopPadding || this.options.padding / 2);
|
1462
|
+
prevLabelMargin = null;
|
1463
|
+
prevAngleMargin = null;
|
1464
|
+
_results = [];
|
1465
|
+
for (i = _i = 0, _ref = this.data.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
|
1466
|
+
row = this.data[this.data.length - 1 - i];
|
1467
|
+
label = this.drawXAxisLabel(row._x, ypos, row.label);
|
1468
|
+
textBox = label.getBBox();
|
1469
|
+
label.transform("r" + (-this.options.xLabelAngle));
|
1470
|
+
labelBox = label.getBBox();
|
1471
|
+
label.transform("t0," + (labelBox.height / 2) + "...");
|
1472
|
+
if (this.options.xLabelAngle !== 0) {
|
1473
|
+
offset = -0.5 * textBox.width * Math.cos(this.options.xLabelAngle * Math.PI / 180.0);
|
1474
|
+
label.transform("t" + offset + ",0...");
|
1475
|
+
}
|
1476
|
+
if (((prevLabelMargin == null) || prevLabelMargin >= labelBox.x + labelBox.width || (prevAngleMargin != null) && prevAngleMargin >= labelBox.x) && labelBox.x >= 0 && (labelBox.x + labelBox.width) < this.el.width()) {
|
1477
|
+
if (this.options.xLabelAngle !== 0) {
|
1478
|
+
margin = 1.25 * this.options.gridTextSize / Math.sin(this.options.xLabelAngle * Math.PI / 180.0);
|
1479
|
+
prevAngleMargin = labelBox.x - margin;
|
1480
|
+
}
|
1481
|
+
_results.push(prevLabelMargin = labelBox.x - this.options.xLabelMargin);
|
1482
|
+
} else {
|
1483
|
+
_results.push(label.remove());
|
1484
|
+
}
|
1485
|
+
}
|
1486
|
+
return _results;
|
1487
|
+
};
|
1488
|
+
|
1489
|
+
Bar.prototype.drawSeries = function() {
|
1490
|
+
var barWidth, bottom, groupWidth, idx, lastTop, left, leftPadding, numBars, row, sidx, size, top, ypos, zeroPos;
|
1491
|
+
groupWidth = this.width / this.options.data.length;
|
1492
|
+
numBars = this.options.stacked != null ? 1 : this.options.ykeys.length;
|
1493
|
+
barWidth = (groupWidth * this.options.barSizeRatio - this.options.barGap * (numBars - 1)) / numBars;
|
1494
|
+
leftPadding = groupWidth * (1 - this.options.barSizeRatio) / 2;
|
1495
|
+
zeroPos = this.ymin <= 0 && this.ymax >= 0 ? this.transY(0) : null;
|
1496
|
+
return this.bars = (function() {
|
1497
|
+
var _i, _len, _ref, _results;
|
1498
|
+
_ref = this.data;
|
1499
|
+
_results = [];
|
1500
|
+
for (idx = _i = 0, _len = _ref.length; _i < _len; idx = ++_i) {
|
1501
|
+
row = _ref[idx];
|
1502
|
+
lastTop = 0;
|
1503
|
+
_results.push((function() {
|
1504
|
+
var _j, _len1, _ref1, _results1;
|
1505
|
+
_ref1 = row._y;
|
1506
|
+
_results1 = [];
|
1507
|
+
for (sidx = _j = 0, _len1 = _ref1.length; _j < _len1; sidx = ++_j) {
|
1508
|
+
ypos = _ref1[sidx];
|
1509
|
+
if (ypos !== null) {
|
1510
|
+
if (zeroPos) {
|
1511
|
+
top = Math.min(ypos, zeroPos);
|
1512
|
+
bottom = Math.max(ypos, zeroPos);
|
1513
|
+
} else {
|
1514
|
+
top = ypos;
|
1515
|
+
bottom = this.bottom;
|
1516
|
+
}
|
1517
|
+
left = this.left + idx * groupWidth + leftPadding;
|
1518
|
+
if (!this.options.stacked) {
|
1519
|
+
left += sidx * (barWidth + this.options.barGap);
|
1520
|
+
}
|
1521
|
+
size = bottom - top;
|
1522
|
+
if (this.options.stacked) {
|
1523
|
+
top -= lastTop;
|
1524
|
+
}
|
1525
|
+
this.drawBar(left, top, barWidth, size, this.colorFor(row, sidx, 'bar'), this.options.barOpacity, this.options.barRadius);
|
1526
|
+
_results1.push(lastTop += size);
|
1527
|
+
} else {
|
1528
|
+
_results1.push(null);
|
1529
|
+
}
|
1530
|
+
}
|
1531
|
+
return _results1;
|
1532
|
+
}).call(this));
|
1533
|
+
}
|
1534
|
+
return _results;
|
1535
|
+
}).call(this);
|
1536
|
+
};
|
1537
|
+
|
1538
|
+
Bar.prototype.colorFor = function(row, sidx, type) {
|
1539
|
+
var r, s;
|
1540
|
+
if (typeof this.options.barColors === 'function') {
|
1541
|
+
r = {
|
1542
|
+
x: row.x,
|
1543
|
+
y: row.y[sidx],
|
1544
|
+
label: row.label
|
1545
|
+
};
|
1546
|
+
s = {
|
1547
|
+
index: sidx,
|
1548
|
+
key: this.options.ykeys[sidx],
|
1549
|
+
label: this.options.labels[sidx]
|
1550
|
+
};
|
1551
|
+
return this.options.barColors.call(this, r, s, type);
|
1552
|
+
} else {
|
1553
|
+
return this.options.barColors[sidx % this.options.barColors.length];
|
1554
|
+
}
|
1555
|
+
};
|
1556
|
+
|
1557
|
+
Bar.prototype.hitTest = function(x) {
|
1558
|
+
if (this.data.length === 0) {
|
1559
|
+
return null;
|
1560
|
+
}
|
1561
|
+
x = Math.max(Math.min(x, this.right), this.left);
|
1562
|
+
return Math.min(this.data.length - 1, Math.floor((x - this.left) / (this.width / this.data.length)));
|
1563
|
+
};
|
1564
|
+
|
1565
|
+
Bar.prototype.onGridClick = function(x, y) {
|
1566
|
+
var index;
|
1567
|
+
index = this.hitTest(x);
|
1568
|
+
return this.fire('click', index, this.data[index].src, x, y);
|
1569
|
+
};
|
1570
|
+
|
1571
|
+
Bar.prototype.onHoverMove = function(x, y) {
|
1572
|
+
var index, _ref;
|
1573
|
+
index = this.hitTest(x);
|
1574
|
+
return (_ref = this.hover).update.apply(_ref, this.hoverContentForRow(index));
|
1575
|
+
};
|
1576
|
+
|
1577
|
+
Bar.prototype.onHoverOut = function() {
|
1578
|
+
if (this.options.hideHover !== false) {
|
1579
|
+
return this.hover.hide();
|
1580
|
+
}
|
1581
|
+
};
|
1582
|
+
|
1583
|
+
Bar.prototype.hoverContentForRow = function(index) {
|
1584
|
+
var content, j, row, x, y, _i, _len, _ref;
|
1585
|
+
row = this.data[index];
|
1586
|
+
content = "<div class='morris-hover-row-label'>" + row.label + "</div>";
|
1587
|
+
_ref = row.y;
|
1588
|
+
for (j = _i = 0, _len = _ref.length; _i < _len; j = ++_i) {
|
1589
|
+
y = _ref[j];
|
1590
|
+
content += "<div class='morris-hover-point' style='color: " + (this.colorFor(row, j, 'label')) + "'>\n " + this.options.labels[j] + ":\n " + (this.yLabelFormat(y)) + "\n</div>";
|
1591
|
+
}
|
1592
|
+
if (typeof this.options.hoverCallback === 'function') {
|
1593
|
+
content = this.options.hoverCallback(index, this.options, content, row.src);
|
1594
|
+
}
|
1595
|
+
x = this.left + (index + 0.5) * this.width / this.data.length;
|
1596
|
+
return [content, x];
|
1597
|
+
};
|
1598
|
+
|
1599
|
+
Bar.prototype.drawXAxisLabel = function(xPos, yPos, text) {
|
1600
|
+
var label;
|
1601
|
+
return label = this.raphael.text(xPos, yPos, text).attr('font-size', this.options.gridTextSize).attr('font-family', this.options.gridTextFamily).attr('font-weight', this.options.gridTextWeight).attr('fill', this.options.gridTextColor);
|
1602
|
+
};
|
1603
|
+
|
1604
|
+
Bar.prototype.drawBar = function(xPos, yPos, width, height, barColor, opacity, radiusArray) {
|
1605
|
+
var maxRadius, path;
|
1606
|
+
maxRadius = Math.max.apply(Math, radiusArray);
|
1607
|
+
if (maxRadius === 0 || maxRadius > height) {
|
1608
|
+
path = this.raphael.rect(xPos, yPos, width, height);
|
1609
|
+
} else {
|
1610
|
+
path = this.raphael.path(this.roundedRect(xPos, yPos, width, height, radiusArray));
|
1611
|
+
}
|
1612
|
+
return path.attr('fill', barColor).attr('fill-opacity', opacity).attr('stroke', 'none');
|
1613
|
+
};
|
1614
|
+
|
1615
|
+
Bar.prototype.roundedRect = function(x, y, w, h, r) {
|
1616
|
+
if (r == null) {
|
1617
|
+
r = [0, 0, 0, 0];
|
1618
|
+
}
|
1619
|
+
return ["M", x, r[0] + y, "Q", x, y, x + r[0], y, "L", x + w - r[1], y, "Q", x + w, y, x + w, y + r[1], "L", x + w, y + h - r[2], "Q", x + w, y + h, x + w - r[2], y + h, "L", x + r[3], y + h, "Q", x, y + h, x, y + h - r[3], "Z"];
|
1620
|
+
};
|
1621
|
+
|
1622
|
+
return Bar;
|
1623
|
+
|
1624
|
+
})(Morris.Grid);
|
1625
|
+
|
1626
|
+
Morris.Donut = (function(_super) {
|
1627
|
+
__extends(Donut, _super);
|
1628
|
+
|
1629
|
+
Donut.prototype.defaults = {
|
1630
|
+
colors: ['#0B62A4', '#3980B5', '#679DC6', '#95BBD7', '#B0CCE1', '#095791', '#095085', '#083E67', '#052C48', '#042135'],
|
1631
|
+
backgroundColor: '#FFFFFF',
|
1632
|
+
labelColor: '#000000',
|
1633
|
+
formatter: Morris.commas,
|
1634
|
+
resize: false
|
1635
|
+
};
|
1636
|
+
|
1637
|
+
function Donut(options) {
|
1638
|
+
this.resizeHandler = __bind(this.resizeHandler, this);
|
1639
|
+
this.select = __bind(this.select, this);
|
1640
|
+
this.click = __bind(this.click, this);
|
1641
|
+
var _this = this;
|
1642
|
+
if (!(this instanceof Morris.Donut)) {
|
1643
|
+
return new Morris.Donut(options);
|
1644
|
+
}
|
1645
|
+
this.options = $.extend({}, this.defaults, options);
|
1646
|
+
if (typeof options.element === 'string') {
|
1647
|
+
this.el = $(document.getElementById(options.element));
|
1648
|
+
} else {
|
1649
|
+
this.el = $(options.element);
|
1650
|
+
}
|
1651
|
+
if (this.el === null || this.el.length === 0) {
|
1652
|
+
throw new Error("Graph placeholder not found.");
|
1653
|
+
}
|
1654
|
+
if (options.data === void 0 || options.data.length === 0) {
|
1655
|
+
return;
|
1656
|
+
}
|
1657
|
+
this.raphael = new Raphael(this.el[0]);
|
1658
|
+
if (this.options.resize) {
|
1659
|
+
$(window).bind('resize', function(evt) {
|
1660
|
+
if (_this.timeoutId != null) {
|
1661
|
+
window.clearTimeout(_this.timeoutId);
|
1662
|
+
}
|
1663
|
+
return _this.timeoutId = window.setTimeout(_this.resizeHandler, 100);
|
1664
|
+
});
|
1665
|
+
}
|
1666
|
+
this.setData(options.data);
|
1667
|
+
}
|
1668
|
+
|
1669
|
+
Donut.prototype.redraw = function() {
|
1670
|
+
var C, cx, cy, i, idx, last, max_value, min, next, seg, total, value, w, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _results;
|
1671
|
+
this.raphael.clear();
|
1672
|
+
cx = this.el.width() / 2;
|
1673
|
+
cy = this.el.height() / 2;
|
1674
|
+
w = (Math.min(cx, cy) - 10) / 3;
|
1675
|
+
total = 0;
|
1676
|
+
_ref = this.values;
|
1677
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1678
|
+
value = _ref[_i];
|
1679
|
+
total += value;
|
1680
|
+
}
|
1681
|
+
min = 5 / (2 * w);
|
1682
|
+
C = 1.9999 * Math.PI - min * this.data.length;
|
1683
|
+
last = 0;
|
1684
|
+
idx = 0;
|
1685
|
+
this.segments = [];
|
1686
|
+
_ref1 = this.values;
|
1687
|
+
for (i = _j = 0, _len1 = _ref1.length; _j < _len1; i = ++_j) {
|
1688
|
+
value = _ref1[i];
|
1689
|
+
next = last + min + C * (value / total);
|
1690
|
+
seg = new Morris.DonutSegment(cx, cy, w * 2, w, last, next, this.data[i].color || this.options.colors[idx % this.options.colors.length], this.options.backgroundColor, idx, this.raphael);
|
1691
|
+
seg.render();
|
1692
|
+
this.segments.push(seg);
|
1693
|
+
seg.on('hover', this.select);
|
1694
|
+
seg.on('click', this.click);
|
1695
|
+
last = next;
|
1696
|
+
idx += 1;
|
1697
|
+
}
|
1698
|
+
this.text1 = this.drawEmptyDonutLabel(cx, cy - 10, this.options.labelColor, 15, 800);
|
1699
|
+
this.text2 = this.drawEmptyDonutLabel(cx, cy + 10, this.options.labelColor, 14);
|
1700
|
+
max_value = Math.max.apply(Math, this.values);
|
1701
|
+
idx = 0;
|
1702
|
+
_ref2 = this.values;
|
1703
|
+
_results = [];
|
1704
|
+
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
|
1705
|
+
value = _ref2[_k];
|
1706
|
+
if (value === max_value) {
|
1707
|
+
this.select(idx);
|
1708
|
+
break;
|
1709
|
+
}
|
1710
|
+
_results.push(idx += 1);
|
1711
|
+
}
|
1712
|
+
return _results;
|
1713
|
+
};
|
1714
|
+
|
1715
|
+
Donut.prototype.setData = function(data) {
|
1716
|
+
var row;
|
1717
|
+
this.data = data;
|
1718
|
+
this.values = (function() {
|
1719
|
+
var _i, _len, _ref, _results;
|
1720
|
+
_ref = this.data;
|
1721
|
+
_results = [];
|
1722
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1723
|
+
row = _ref[_i];
|
1724
|
+
_results.push(parseFloat(row.value));
|
1725
|
+
}
|
1726
|
+
return _results;
|
1727
|
+
}).call(this);
|
1728
|
+
return this.redraw();
|
1729
|
+
};
|
1730
|
+
|
1731
|
+
Donut.prototype.click = function(idx) {
|
1732
|
+
return this.fire('click', idx, this.data[idx]);
|
1733
|
+
};
|
1734
|
+
|
1735
|
+
Donut.prototype.select = function(idx) {
|
1736
|
+
var row, s, segment, _i, _len, _ref;
|
1737
|
+
_ref = this.segments;
|
1738
|
+
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
1739
|
+
s = _ref[_i];
|
1740
|
+
s.deselect();
|
1741
|
+
}
|
1742
|
+
segment = this.segments[idx];
|
1743
|
+
segment.select();
|
1744
|
+
row = this.data[idx];
|
1745
|
+
return this.setLabels(row.label, this.options.formatter(row.value, row));
|
1746
|
+
};
|
1747
|
+
|
1748
|
+
Donut.prototype.setLabels = function(label1, label2) {
|
1749
|
+
var inner, maxHeightBottom, maxHeightTop, maxWidth, text1bbox, text1scale, text2bbox, text2scale;
|
1750
|
+
inner = (Math.min(this.el.width() / 2, this.el.height() / 2) - 10) * 2 / 3;
|
1751
|
+
maxWidth = 1.8 * inner;
|
1752
|
+
maxHeightTop = inner / 2;
|
1753
|
+
maxHeightBottom = inner / 3;
|
1754
|
+
this.text1.attr({
|
1755
|
+
text: label1,
|
1756
|
+
transform: ''
|
1757
|
+
});
|
1758
|
+
text1bbox = this.text1.getBBox();
|
1759
|
+
text1scale = Math.min(maxWidth / text1bbox.width, maxHeightTop / text1bbox.height);
|
1760
|
+
this.text1.attr({
|
1761
|
+
transform: "S" + text1scale + "," + text1scale + "," + (text1bbox.x + text1bbox.width / 2) + "," + (text1bbox.y + text1bbox.height)
|
1762
|
+
});
|
1763
|
+
this.text2.attr({
|
1764
|
+
text: label2,
|
1765
|
+
transform: ''
|
1766
|
+
});
|
1767
|
+
text2bbox = this.text2.getBBox();
|
1768
|
+
text2scale = Math.min(maxWidth / text2bbox.width, maxHeightBottom / text2bbox.height);
|
1769
|
+
return this.text2.attr({
|
1770
|
+
transform: "S" + text2scale + "," + text2scale + "," + (text2bbox.x + text2bbox.width / 2) + "," + text2bbox.y
|
1771
|
+
});
|
1772
|
+
};
|
1773
|
+
|
1774
|
+
Donut.prototype.drawEmptyDonutLabel = function(xPos, yPos, color, fontSize, fontWeight) {
|
1775
|
+
var text;
|
1776
|
+
text = this.raphael.text(xPos, yPos, '').attr('font-size', fontSize).attr('fill', color);
|
1777
|
+
if (fontWeight != null) {
|
1778
|
+
text.attr('font-weight', fontWeight);
|
1779
|
+
}
|
1780
|
+
return text;
|
1781
|
+
};
|
1782
|
+
|
1783
|
+
Donut.prototype.resizeHandler = function() {
|
1784
|
+
this.timeoutId = null;
|
1785
|
+
this.raphael.setSize(this.el.width(), this.el.height());
|
1786
|
+
return this.redraw();
|
1787
|
+
};
|
1788
|
+
|
1789
|
+
return Donut;
|
1790
|
+
|
1791
|
+
})(Morris.EventEmitter);
|
1792
|
+
|
1793
|
+
Morris.DonutSegment = (function(_super) {
|
1794
|
+
__extends(DonutSegment, _super);
|
1795
|
+
|
1796
|
+
function DonutSegment(cx, cy, inner, outer, p0, p1, color, backgroundColor, index, raphael) {
|
1797
|
+
this.cx = cx;
|
1798
|
+
this.cy = cy;
|
1799
|
+
this.inner = inner;
|
1800
|
+
this.outer = outer;
|
1801
|
+
this.color = color;
|
1802
|
+
this.backgroundColor = backgroundColor;
|
1803
|
+
this.index = index;
|
1804
|
+
this.raphael = raphael;
|
1805
|
+
this.deselect = __bind(this.deselect, this);
|
1806
|
+
this.select = __bind(this.select, this);
|
1807
|
+
this.sin_p0 = Math.sin(p0);
|
1808
|
+
this.cos_p0 = Math.cos(p0);
|
1809
|
+
this.sin_p1 = Math.sin(p1);
|
1810
|
+
this.cos_p1 = Math.cos(p1);
|
1811
|
+
this.is_long = (p1 - p0) > Math.PI ? 1 : 0;
|
1812
|
+
this.path = this.calcSegment(this.inner + 3, this.inner + this.outer - 5);
|
1813
|
+
this.selectedPath = this.calcSegment(this.inner + 3, this.inner + this.outer);
|
1814
|
+
this.hilight = this.calcArc(this.inner);
|
1815
|
+
}
|
1816
|
+
|
1817
|
+
DonutSegment.prototype.calcArcPoints = function(r) {
|
1818
|
+
return [this.cx + r * this.sin_p0, this.cy + r * this.cos_p0, this.cx + r * this.sin_p1, this.cy + r * this.cos_p1];
|
1819
|
+
};
|
1820
|
+
|
1821
|
+
DonutSegment.prototype.calcSegment = function(r1, r2) {
|
1822
|
+
var ix0, ix1, iy0, iy1, ox0, ox1, oy0, oy1, _ref, _ref1;
|
1823
|
+
_ref = this.calcArcPoints(r1), ix0 = _ref[0], iy0 = _ref[1], ix1 = _ref[2], iy1 = _ref[3];
|
1824
|
+
_ref1 = this.calcArcPoints(r2), ox0 = _ref1[0], oy0 = _ref1[1], ox1 = _ref1[2], oy1 = _ref1[3];
|
1825
|
+
return ("M" + ix0 + "," + iy0) + ("A" + r1 + "," + r1 + ",0," + this.is_long + ",0," + ix1 + "," + iy1) + ("L" + ox1 + "," + oy1) + ("A" + r2 + "," + r2 + ",0," + this.is_long + ",1," + ox0 + "," + oy0) + "Z";
|
1826
|
+
};
|
1827
|
+
|
1828
|
+
DonutSegment.prototype.calcArc = function(r) {
|
1829
|
+
var ix0, ix1, iy0, iy1, _ref;
|
1830
|
+
_ref = this.calcArcPoints(r), ix0 = _ref[0], iy0 = _ref[1], ix1 = _ref[2], iy1 = _ref[3];
|
1831
|
+
return ("M" + ix0 + "," + iy0) + ("A" + r + "," + r + ",0," + this.is_long + ",0," + ix1 + "," + iy1);
|
1832
|
+
};
|
1833
|
+
|
1834
|
+
DonutSegment.prototype.render = function() {
|
1835
|
+
var _this = this;
|
1836
|
+
this.arc = this.drawDonutArc(this.hilight, this.color);
|
1837
|
+
return this.seg = this.drawDonutSegment(this.path, this.color, this.backgroundColor, function() {
|
1838
|
+
return _this.fire('hover', _this.index);
|
1839
|
+
}, function() {
|
1840
|
+
return _this.fire('click', _this.index);
|
1841
|
+
});
|
1842
|
+
};
|
1843
|
+
|
1844
|
+
DonutSegment.prototype.drawDonutArc = function(path, color) {
|
1845
|
+
return this.raphael.path(path).attr({
|
1846
|
+
stroke: color,
|
1847
|
+
'stroke-width': 2,
|
1848
|
+
opacity: 0
|
1849
|
+
});
|
1850
|
+
};
|
1851
|
+
|
1852
|
+
DonutSegment.prototype.drawDonutSegment = function(path, fillColor, strokeColor, hoverFunction, clickFunction) {
|
1853
|
+
return this.raphael.path(path).attr({
|
1854
|
+
fill: fillColor,
|
1855
|
+
stroke: strokeColor,
|
1856
|
+
'stroke-width': 3
|
1857
|
+
}).hover(hoverFunction).click(clickFunction);
|
1858
|
+
};
|
1859
|
+
|
1860
|
+
DonutSegment.prototype.select = function() {
|
1861
|
+
if (!this.selected) {
|
1862
|
+
this.seg.animate({
|
1863
|
+
path: this.selectedPath
|
1864
|
+
}, 150, '<>');
|
1865
|
+
this.arc.animate({
|
1866
|
+
opacity: 1
|
1867
|
+
}, 150, '<>');
|
1868
|
+
return this.selected = true;
|
1869
|
+
}
|
1870
|
+
};
|
1871
|
+
|
1872
|
+
DonutSegment.prototype.deselect = function() {
|
1873
|
+
if (this.selected) {
|
1874
|
+
this.seg.animate({
|
1875
|
+
path: this.path
|
1876
|
+
}, 150, '<>');
|
1877
|
+
this.arc.animate({
|
1878
|
+
opacity: 0
|
1879
|
+
}, 150, '<>');
|
1880
|
+
return this.selected = false;
|
1881
|
+
}
|
1882
|
+
};
|
1883
|
+
|
1884
|
+
return DonutSegment;
|
1885
|
+
|
1886
|
+
})(Morris.EventEmitter);
|
1887
|
+
|
1888
|
+
}).call(this);
|