old_sql 1.16.0 → 1.17.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +24 -13
- data/app/controllers/old_sql/report_controller.rb +3 -17
- data/app/views/layouts/old_sql/chart.html.erb +11 -0
- data/app/views/old_sql/report/chart.html.erb +8 -25
- data/lib/generators/old_sql/templates/user_design_template.csv +2 -3
- data/lib/generators/old_sql/templates/user_old_sql_demo_chart_design.yml +18 -9
- data/lib/old_sql/report_design/chart.rb +2 -2
- data/lib/old_sql/report_design/chart_item.rb +4 -4
- data/lib/old_sql/report_design/chart_parser.rb +2 -2
- data/public/javascripts/old_sql/chart.js +33 -0
- metadata +5 -265
- data/public/javascripts/old_sql/MochiKit-1.4.2/Changes +0 -362
- data/public/javascripts/old_sql/MochiKit-1.4.2/LICENSE.txt +0 -69
- data/public/javascripts/old_sql/MochiKit-1.4.2/MANIFEST +0 -179
- data/public/javascripts/old_sql/MochiKit-1.4.2/META.json +0 -17
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Async.html +0 -814
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Base.html +0 -1703
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Color.html +0 -755
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/DOM.html +0 -1197
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/DateTime.html +0 -168
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/DragAndDrop.html +0 -187
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Format.html +0 -300
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Iter.html +0 -524
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Logging.html +0 -420
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/LoggingPane.html +0 -142
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Position.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Selector.html +0 -240
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Signal.html +0 -508
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Sortable.html +0 -244
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Style.html +0 -385
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/VersionHistory.html +0 -384
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/Visual.html +0 -1161
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/html/MochiKit/index.html +0 -447
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/js/toc.js +0 -113
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Async.rst +0 -767
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Base.rst +0 -1445
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Color.rst +0 -651
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/DOM.rst +0 -1143
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/DateTime.rst +0 -145
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/DragAndDrop.rst +0 -197
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Format.rst +0 -258
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Iter.rst +0 -454
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Logging.rst +0 -348
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/LoggingPane.rst +0 -128
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Position.rst +0 -26
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Selector.rst +0 -203
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Signal.rst +0 -498
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Sortable.rst +0 -186
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Style.rst +0 -353
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/VersionHistory.rst +0 -362
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/Visual.rst +0 -895
- data/public/javascripts/old_sql/MochiKit-1.4.2/doc/rst/MochiKit/index.rst +0 -83
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/ajax_tables.css +0 -69
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/ajax_tables.js +0 -401
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/domains.json +0 -10
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/domains.xml +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/ajax_tables/index.html +0 -96
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/color_wheel/color_wheel.css +0 -4
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/color_wheel/color_wheel.js +0 -95
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/color_wheel/index.html +0 -31
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/dnd_sortable.css +0 -23
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/dropmarker.png +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/icon.png +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/index.html +0 -54
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable2_test.html +0 -150
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable3_test.html +0 -42
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable4_test.html +0 -90
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable5_test.html +0 -29
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable_test.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/dnd_sortable/sortable_tree_test.html +0 -189
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/draggable/draggable.css +0 -28
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/draggable/draggable.js +0 -73
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/draggable/index.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_bigslide.html +0 -36
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_blind.html +0 -65
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_blindslide.html +0 -31
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_combi.css +0 -18
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_fadeappear.html +0 -61
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_grow_shrink.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_onload.html +0 -67
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_queue.html +0 -67
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_queue_limit.html +0 -30
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_scroll.html +0 -483
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/effects_slide.html +0 -62
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/full.html +0 -71
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/icon.png +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/effects/index.html +0 -150
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/interpreter/index.html +0 -88
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/interpreter/interpreter.css +0 -54
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/interpreter/interpreter.js +0 -373
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/key_events/index.html +0 -78
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/key_events/key_events.css +0 -5
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/key_events/key_events.js +0 -85
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/logging_pane/index.html +0 -46
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/logging_pane/logging_pane.css +0 -78
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/logging_pane/logging_pane.js +0 -11
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mochiregexp/index.html +0 -74
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mochiregexp/mochiregexp.css +0 -73
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mochiregexp/mochiregexp.js +0 -125
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mouse_events/index.html +0 -88
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mouse_events/mouse_events.css +0 -17
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/mouse_events/mouse_events.js +0 -59
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/rounded_corners/index.html +0 -28
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/rounded_corners/rounded_corners.css +0 -3
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/rounded_corners/rounded_corners.js +0 -19
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_boxes.html +0 -45
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_full.html +0 -119
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_ghost.html +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_hoverclass.html +0 -43
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_scroll.html +0 -91
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/dnd_snap.html +0 -54
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/index.html +0 -93
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/simple_dnd/simple_dnd.css +0 -64
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/sortable_tables/index.html +0 -71
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/sortable_tables/sortable_tables.css +0 -66
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/sortable_tables/sortable_tables.js +0 -203
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/SyntaxHighlighter.css +0 -177
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/Tests.html +0 -339
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushCSharp.js +0 -30
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushDelphi.js +0 -31
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushJScript.js +0 -22
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushPhp.js +0 -23
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushPython.js +0 -71
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushSql.js +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushVb.js +0 -29
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shBrushXml.js +0 -61
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/lib/SyntaxHighlighter/shCore.js +0 -622
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/view-source.css +0 -1
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/view-source.html +0 -19
- data/public/javascripts/old_sql/MochiKit-1.4.2/examples/view-source/view-source.js +0 -70
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/_img/bg_docheader.gif +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/_img/g_bullet.gif +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/_img/g_logo_doc.gif +0 -0
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/css/documentation.css +0 -130
- data/public/javascripts/old_sql/MochiKit-1.4.2/include/css/general.css +0 -48
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Async.js +0 -682
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Base.js +0 -1489
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Color.js +0 -863
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/DOM.js +0 -1256
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/DateTime.js +0 -222
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/DragAndDrop.js +0 -793
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Format.js +0 -304
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Iter.js +0 -844
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Logging.js +0 -315
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/LoggingPane.js +0 -353
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/MochiKit.js +0 -188
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/MockDOM.js +0 -115
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Position.js +0 -236
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Selector.js +0 -415
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Signal.js +0 -897
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Sortable.js +0 -589
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Style.js +0 -594
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Test.js +0 -162
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/Visual.js +0 -2026
- data/public/javascripts/old_sql/MochiKit-1.4.2/lib/MochiKit/__package__.js +0 -18
- data/public/javascripts/old_sql/MochiKit-1.4.2/packed/MochiKit/MochiKit.js +0 -7829
- data/public/javascripts/old_sql/MochiKit-1.4.2/packed/MochiKit/__package__.js +0 -6
- data/public/javascripts/old_sql/MochiKit-1.4.2/packed/MochiKit/customize.html +0 -251
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/FakeJSAN.js +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/SimpleTest/SimpleTest.js +0 -381
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/SimpleTest/TestRunner.js +0 -159
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/SimpleTest/test.css +0 -28
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/cli.js +0 -6
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/index.html +0 -25
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/standalone.js +0 -16
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Base.js +0 -577
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Color.js +0 -137
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_DateTime.js +0 -52
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_DragAndDrop.js +0 -30
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Format.js +0 -89
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Iter.js +0 -186
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Logging.js +0 -88
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Async.html +0 -408
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Async.json +0 -1
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Base.html +0 -34
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Color.html +0 -84
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-DOM-Safari.html +0 -48
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-DOM.html +0 -363
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-DateTime.html +0 -39
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-DragAndDrop.html +0 -54
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Format.html +0 -39
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Iter.html +0 -38
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-JSAN.html +0 -32
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Logging.html +0 -40
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-MochiKit.html +0 -18
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Selector.html +0 -295
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Signal.html +0 -43
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Style.html +0 -223
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_MochiKit-Visual.html +0 -197
- data/public/javascripts/old_sql/MochiKit-1.4.2/tests/test_Signal.js +0 -481
- data/public/javascripts/old_sql/plotkit-0.9.1/COPYING +0 -28
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/Base.js +0 -406
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/Canvas.js +0 -683
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/EasyPlot.js +0 -161
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/Layout.js +0 -756
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/PlotKit.js +0 -151
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/PlotKit_Packed.js +0 -2177
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/SVG.js +0 -705
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/SweetCanvas.js +0 -348
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/SweetSVG.js +0 -247
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/dummy.svg +0 -9
- data/public/javascripts/old_sql/plotkit-0.9.1/PlotKit/excanvas.js +0 -723
- data/public/javascripts/old_sql/plotkit-0.9.1/README +0 -1
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/MochiKitAdditions.html +0 -2
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/MochiKitAdditions.txt +0 -2
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Base.html +0 -302
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Base.txt +0 -139
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Canvas.html +0 -172
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Canvas.txt +0 -81
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.EasyPlot.html +0 -155
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.EasyPlot.txt +0 -50
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Layout.html +0 -428
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Layout.txt +0 -330
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.QuickStart.html +0 -368
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.QuickStart.txt +0 -256
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Renderer.html +0 -436
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.Renderer.txt +0 -299
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SVG.html +0 -159
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SVG.txt +0 -64
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SweetCanvas.html +0 -131
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SweetCanvas.txt +0 -34
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SweetSVG.html +0 -131
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.SweetSVG.txt +0 -34
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.html +0 -334
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/PlotKit.txt +0 -151
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/SVGCanvasCompat.html +0 -304
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/SVGCanvasCompat.txt +0 -144
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/barsample.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/black.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/blue.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/cyan.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/doc.css +0 -62
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/generate.py +0 -37
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/green.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/orange.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/piesample.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/purple.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/doc/red.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/scripts/custom_rhino.jar +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/scripts/pack.py +0 -58
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/axis.html +0 -31
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/basic.html +0 -25
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/basic.js +0 -143
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/debug.html +0 -56
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/demo-svg.html +0 -58
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/demo-svg.js +0 -133
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/demo.html +0 -57
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/demo.js +0 -136
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/dynamic.html +0 -161
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/firefox.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/konqueror.png +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/mozilla.ico +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/msie.gif +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/opera.ico +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/img/safari.gif +0 -0
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/labels-img.html +0 -38
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/labels.html +0 -43
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/prototype_compat.html +0 -28
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart-easy.html +0 -29
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart-horiz.html +0 -53
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart-neg.html +0 -29
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart-svg.html +0 -61
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/quickstart.html +0 -57
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/sample.txt +0 -6
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/svg-sweet.html +0 -29
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/svg-sweet.js +0 -141
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/svg.html +0 -26
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/svg.js +0 -147
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/sweet.html +0 -24
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/sweet.js +0 -89
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/tests.css +0 -66
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/testsvg.html +0 -20
- data/public/javascripts/old_sql/plotkit-0.9.1/tests/testsvg.js +0 -31
@@ -1,151 +0,0 @@
|
|
1
|
-
/***
|
2
|
-
|
3
|
-
PlotKit Autoload Javascript Module.
|
4
|
-
|
5
|
-
This file was adapted from MochiKit.
|
6
|
-
See <http://mochikit.com/> for documentation, downloads, license, etc.
|
7
|
-
(c) 2005 Bob Ippolito. All rights Reserved.
|
8
|
-
|
9
|
-
Modified by Alastair Tse, 2006, for PlotKit.
|
10
|
-
|
11
|
-
***/
|
12
|
-
|
13
|
-
if (typeof(PlotKit) == 'undefined') {
|
14
|
-
PlotKit = {};
|
15
|
-
}
|
16
|
-
|
17
|
-
if (typeof(PlotKit.PlotKit) == 'undefined') {
|
18
|
-
PlotKit.PlotKit = {};
|
19
|
-
}
|
20
|
-
|
21
|
-
PlotKit.PlotKit.NAME = "PlotKit.PlotKit";
|
22
|
-
PlotKit.PlotKit.VERSION = "0.9.1";
|
23
|
-
PlotKit.PlotKit.__repr__ = function () {
|
24
|
-
return "[" + this.NAME + " " + this.VERSION + "]";
|
25
|
-
};
|
26
|
-
|
27
|
-
PlotKit.PlotKit.toString = function () {
|
28
|
-
return this.__repr__();
|
29
|
-
};
|
30
|
-
|
31
|
-
PlotKit.PlotKit.SUBMODULES = [
|
32
|
-
"Base",
|
33
|
-
"Layout",
|
34
|
-
"Canvas",
|
35
|
-
"SVG",
|
36
|
-
"SweetCanvas",
|
37
|
-
"SweetSVG",
|
38
|
-
"EasyPlot"
|
39
|
-
];
|
40
|
-
|
41
|
-
if (typeof(JSAN) != 'undefined' || typeof(dojo) != 'undefined') {
|
42
|
-
if (typeof(dojo) != 'undefined') {
|
43
|
-
dojo.provide('PlotKit.PlotKit');
|
44
|
-
dojo.require("PlotKit.*");
|
45
|
-
}
|
46
|
-
if (typeof(JSAN) != 'undefined') {
|
47
|
-
// hopefully this makes it easier for static analysis?
|
48
|
-
JSAN.use("PlotKit.Base", []);
|
49
|
-
JSAN.use("PlotKit.Layout", []);
|
50
|
-
JSAN.use("PlotKit.Canvas", []);
|
51
|
-
JSAN.use("PlotKit.SweetCanvas", []);
|
52
|
-
JSAN.use("PlotKit.SVG", []);
|
53
|
-
JSAN.use("PlotKit.SweetSVG", []);
|
54
|
-
}
|
55
|
-
(function () {
|
56
|
-
var extend = MochiKit.Base.extend;
|
57
|
-
var self = PlotKit.PlotKit;
|
58
|
-
var modules = self.SUBMODULES;
|
59
|
-
var EXPORT = [];
|
60
|
-
var EXPORT_OK = [];
|
61
|
-
var EXPORT_TAGS = {};
|
62
|
-
var i, k, m, all;
|
63
|
-
for (i = 0; i < modules.length; i++) {
|
64
|
-
m = PlotKit[modules[i]];
|
65
|
-
extend(EXPORT, m.EXPORT);
|
66
|
-
extend(EXPORT_OK, m.EXPORT_OK);
|
67
|
-
for (k in m.EXPORT_TAGS) {
|
68
|
-
EXPORT_TAGS[k] = extend(EXPORT_TAGS[k], m.EXPORT_TAGS[k]);
|
69
|
-
}
|
70
|
-
all = m.EXPORT_TAGS[":all"];
|
71
|
-
if (!all) {
|
72
|
-
all = extend(null, m.EXPORT, m.EXPORT_OK);
|
73
|
-
}
|
74
|
-
var j;
|
75
|
-
for (j = 0; j < all.length; j++) {
|
76
|
-
k = all[j];
|
77
|
-
self[k] = m[k];
|
78
|
-
}
|
79
|
-
}
|
80
|
-
self.EXPORT = EXPORT;
|
81
|
-
self.EXPORT_OK = EXPORT_OK;
|
82
|
-
self.EXPORT_TAGS = EXPORT_TAGS;
|
83
|
-
}());
|
84
|
-
|
85
|
-
} else {
|
86
|
-
if (typeof(PlotKit.__compat__) == 'undefined') {
|
87
|
-
PlotKit.__compat__ = true;
|
88
|
-
}
|
89
|
-
(function () {
|
90
|
-
if (typeof(document) == "undefined") {
|
91
|
-
return;
|
92
|
-
}
|
93
|
-
|
94
|
-
var scripts = document.getElementsByTagName("script");
|
95
|
-
var kXULNSURI = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
96
|
-
var base = null;
|
97
|
-
var baseElem = null;
|
98
|
-
var allScripts = {};
|
99
|
-
var i;
|
100
|
-
for (i = 0; i < scripts.length; i++) {
|
101
|
-
var src = scripts[i].getAttribute("src");
|
102
|
-
if (!src) {
|
103
|
-
continue;
|
104
|
-
}
|
105
|
-
allScripts[src] = true;
|
106
|
-
if (src.match(/PlotKit.js$/)) {
|
107
|
-
base = src.substring(0, src.lastIndexOf('PlotKit.js'));
|
108
|
-
baseElem = scripts[i];
|
109
|
-
}
|
110
|
-
|
111
|
-
}
|
112
|
-
|
113
|
-
if (base === null) {
|
114
|
-
return;
|
115
|
-
}
|
116
|
-
var modules = PlotKit.PlotKit.SUBMODULES;
|
117
|
-
for (var i = 0; i < modules.length; i++) {
|
118
|
-
if (PlotKit[modules[i]]) {
|
119
|
-
continue;
|
120
|
-
}
|
121
|
-
var uri = base + modules[i] + '.js';
|
122
|
-
if (uri in allScripts) {
|
123
|
-
continue;
|
124
|
-
}
|
125
|
-
if (document.documentElement &&
|
126
|
-
document.documentElement.namespaceURI == kXULNSURI) {
|
127
|
-
// XUL
|
128
|
-
var s = document.createElementNS(kXULNSURI, 'script');
|
129
|
-
s.setAttribute("id", "PlotKit_" + base + modules[i]);
|
130
|
-
s.setAttribute("src", uri);
|
131
|
-
s.setAttribute("type", "application/x-javascript");
|
132
|
-
baseElem.parentNode.appendChild(s);
|
133
|
-
} else {
|
134
|
-
// HTML
|
135
|
-
/*
|
136
|
-
DOM can not be used here because Safari does
|
137
|
-
deferred loading of scripts unless they are
|
138
|
-
in the document or inserted with document.write
|
139
|
-
|
140
|
-
This is not XHTML compliant. If you want XHTML
|
141
|
-
compliance then you must use the packed version of MochiKit
|
142
|
-
or include each script individually (basically unroll
|
143
|
-
these document.write calls into your XHTML source)
|
144
|
-
|
145
|
-
*/
|
146
|
-
document.write('<script src="' + uri +
|
147
|
-
'" type="text/javascript"></script>');
|
148
|
-
}
|
149
|
-
};
|
150
|
-
})();
|
151
|
-
}
|
@@ -1,2177 +0,0 @@
|
|
1
|
-
/***
|
2
|
-
|
3
|
-
PlotKit.PlotKit 0.9.1 : PACKED VERSION
|
4
|
-
|
5
|
-
THIS FILE IS AUTOMATICALLY GENERATED. If creating patches, please
|
6
|
-
diff against the source tree, not this file.
|
7
|
-
|
8
|
-
For more information, <http://www.liquidx.net/plotkit/>.
|
9
|
-
|
10
|
-
Copyright (c) 2006. Alastair Tse.
|
11
|
-
|
12
|
-
***/
|
13
|
-
|
14
|
-
try{
|
15
|
-
if(typeof (MochiKit.Base)=="undefined"||typeof (MochiKit.DOM)=="undefined"||typeof (MochiKit.Color)=="undefined"||typeof (MochiKit.Format)=="undefined"){
|
16
|
-
throw "";
|
17
|
-
}
|
18
|
-
}
|
19
|
-
catch(e){
|
20
|
-
throw "PlotKit depends on MochiKit.{Base,Color,DOM,Format}";
|
21
|
-
}
|
22
|
-
MochiKit.Base.update(MochiKit.Color.Color.prototype,{asFillColor:function(){
|
23
|
-
return this.lighterColorWithLevel(0.3);
|
24
|
-
},asStrokeColor:function(){
|
25
|
-
return this.darkerColorWithLevel(0.1);
|
26
|
-
},asPointColor:function(){
|
27
|
-
return this.lighterColorWithLevel(0.1);
|
28
|
-
}});
|
29
|
-
if(typeof (PlotKit)=="undefined"){
|
30
|
-
PlotKit={};
|
31
|
-
}
|
32
|
-
PlotKit.NAME="PlotKit";
|
33
|
-
PlotKit.VERSION="0.8";
|
34
|
-
PlotKit.__repr__=function(){
|
35
|
-
return "["+this.NAME+" "+this.VERSION+"]";
|
36
|
-
};
|
37
|
-
PlotKit.toString=function(){
|
38
|
-
return this.__repr__();
|
39
|
-
};
|
40
|
-
if(typeof (PlotKit.Base)=="undefined"){
|
41
|
-
PlotKit.Base={};
|
42
|
-
}
|
43
|
-
PlotKit.Base.NAME="PlotKit.Base";
|
44
|
-
PlotKit.Base.VERSION=PlotKit.VERSION;
|
45
|
-
PlotKit.Base.__repr__=function(){
|
46
|
-
return "["+this.NAME+" "+this.VERSION+"]";
|
47
|
-
};
|
48
|
-
PlotKit.Base.toString=function(){
|
49
|
-
return this.__repr__();
|
50
|
-
};
|
51
|
-
PlotKit.Base.usingPrototype=function(){
|
52
|
-
try{
|
53
|
-
return (typeof (Object.extend)=="function");
|
54
|
-
}
|
55
|
-
catch(e){
|
56
|
-
return false;
|
57
|
-
}
|
58
|
-
};
|
59
|
-
MochiKit.Base.update(PlotKit.Base,{roundInterval:function(_1,_2,_3){
|
60
|
-
var _4=MochiKit.Format.roundToFixed;
|
61
|
-
var _5=_1/_2;
|
62
|
-
return parseFloat(_4(_5,_3));
|
63
|
-
},collapse:function(_6){
|
64
|
-
var m=MochiKit.Base;
|
65
|
-
var _8=new Array();
|
66
|
-
for(var i=0;i<_6.length;i++){
|
67
|
-
_8=m.concat(_8,_6[i]);
|
68
|
-
}
|
69
|
-
if(PlotKit.Base.usingPrototype()){
|
70
|
-
delete _8.extend;
|
71
|
-
delete _8.from;
|
72
|
-
delete _8.inspect;
|
73
|
-
}
|
74
|
-
return _8;
|
75
|
-
},uniq:function(_10){
|
76
|
-
var m=MochiKit.Base;
|
77
|
-
if(!m.isArrayLike(_10)||(_10.length<1)){
|
78
|
-
return new Array();
|
79
|
-
}
|
80
|
-
var _11=new Array();
|
81
|
-
var _12=_10[0];
|
82
|
-
_11.push(_10[0]);
|
83
|
-
for(var i=1;i<_10.length;i++){
|
84
|
-
if(m.compare(_10[i],_12)!=0){
|
85
|
-
_12=_10[i];
|
86
|
-
_11.push(_10[i]);
|
87
|
-
}
|
88
|
-
}
|
89
|
-
return _11;
|
90
|
-
},colorScheme:function(){
|
91
|
-
var mb=MochiKit.Base;
|
92
|
-
var mc=MochiKit.Color;
|
93
|
-
var _15=["red","orange","yellow","green","cyan","blue","purple","magenta"];
|
94
|
-
var _16=function(_17){
|
95
|
-
return mc.Color[_17+"Color"]();
|
96
|
-
};
|
97
|
-
return mb.map(_16,_15);
|
98
|
-
},baseDarkPrimaryColors:function(){
|
99
|
-
var _18=MochiKit.Color.Color.fromHexString;
|
100
|
-
return [_18("#ad3f40"),_18("#ddac2c"),_18("#dfdd0c"),_18("#5276c4"),_18("#739c5a")];
|
101
|
-
},basePrimaryColors:function(){
|
102
|
-
var _19=MochiKit.Color.Color.fromHexString;
|
103
|
-
return [_19("#d24c4d"),_19("#f2b32f"),_19("#ece90e"),_19("#5d83da"),_19("#78a15d")];
|
104
|
-
},baseBlueColors:function(){
|
105
|
-
var _20=MochiKit.Color.Color.fromHexString;
|
106
|
-
return [_20("#4b6b94"),_20("#5d81b4"),_20("#acbad2")];
|
107
|
-
},palette:function(_21,_22,_23,_24){
|
108
|
-
var _25=MochiKit.Base.isUndefinedOrNull;
|
109
|
-
var _26=new Array();
|
110
|
-
if(_25(_24)){
|
111
|
-
_24=0.1;
|
112
|
-
}
|
113
|
-
if(_25(_23)){
|
114
|
-
_23=0.4;
|
115
|
-
}
|
116
|
-
if(_25(_22)){
|
117
|
-
_22=-0.2;
|
118
|
-
}
|
119
|
-
var _27=_22;
|
120
|
-
while(_27<=_23){
|
121
|
-
_26.push(_27);
|
122
|
-
_27+=_24;
|
123
|
-
}
|
124
|
-
var _28=function(_29,_30){
|
125
|
-
return _29.lighterColorWithLevel(_30);
|
126
|
-
};
|
127
|
-
return MochiKit.Base.map(partial(_28,_21),_26);
|
128
|
-
},excanvasSupported:function(){
|
129
|
-
if(/MSIE/.test(navigator.userAgent)&&!window.opera){
|
130
|
-
return true;
|
131
|
-
}
|
132
|
-
return false;
|
133
|
-
},findPosX:function(obj){
|
134
|
-
var _32=0;
|
135
|
-
if(obj.offsetParent){
|
136
|
-
while(obj.offsetParent){
|
137
|
-
_32+=obj.offsetLeft;
|
138
|
-
obj=obj.offsetParent;
|
139
|
-
}
|
140
|
-
}else{
|
141
|
-
if(obj.x){
|
142
|
-
_32+=obj.x;
|
143
|
-
}
|
144
|
-
}
|
145
|
-
return _32;
|
146
|
-
},findPosY:function(obj){
|
147
|
-
var _33=0;
|
148
|
-
if(obj.offsetParent){
|
149
|
-
while(obj.offsetParent){
|
150
|
-
_33+=obj.offsetTop;
|
151
|
-
obj=obj.offsetParent;
|
152
|
-
}
|
153
|
-
}else{
|
154
|
-
if(obj.y){
|
155
|
-
_33+=obj.y;
|
156
|
-
}
|
157
|
-
}
|
158
|
-
return _33;
|
159
|
-
},isFuncLike:function(obj){
|
160
|
-
return (typeof (obj)=="function");
|
161
|
-
}});
|
162
|
-
PlotKit.Base.map=function(fn,lst){
|
163
|
-
if(PlotKit.Base.usingPrototype()){
|
164
|
-
var _36=[];
|
165
|
-
for(var x in lst){
|
166
|
-
if(typeof (lst[x])=="function"){
|
167
|
-
continue;
|
168
|
-
}
|
169
|
-
_36.push(fn(lst[x]));
|
170
|
-
}
|
171
|
-
return _36;
|
172
|
-
}else{
|
173
|
-
return MochiKit.Base.map(fn,lst);
|
174
|
-
}
|
175
|
-
};
|
176
|
-
PlotKit.Base.items=function(lst){
|
177
|
-
if(PlotKit.Base.usingPrototype()){
|
178
|
-
var _38=[];
|
179
|
-
for(var x in lst){
|
180
|
-
if(typeof (lst[x])=="function"){
|
181
|
-
continue;
|
182
|
-
}
|
183
|
-
_38.push([x,lst[x]]);
|
184
|
-
}
|
185
|
-
return _38;
|
186
|
-
}else{
|
187
|
-
return MochiKit.Base.items(lst);
|
188
|
-
}
|
189
|
-
};
|
190
|
-
PlotKit.Base.keys=function(lst){
|
191
|
-
if(PlotKit.Base.usingPrototype()){
|
192
|
-
var _39=[];
|
193
|
-
for(var x in lst){
|
194
|
-
if(typeof (lst[x])=="function"){
|
195
|
-
continue;
|
196
|
-
}
|
197
|
-
_39.push(x);
|
198
|
-
}
|
199
|
-
return _39;
|
200
|
-
}else{
|
201
|
-
return MochiKit.Base.keys(lst);
|
202
|
-
}
|
203
|
-
};
|
204
|
-
PlotKit.Base.baseColors=function(){
|
205
|
-
var _40=MochiKit.Color.Color.fromHexString;
|
206
|
-
return [_40("#476fb2"),_40("#be2c2b"),_40("#85b730"),_40("#734a99"),_40("#26a1c5"),_40("#fb8707"),_40("#000000")];
|
207
|
-
};
|
208
|
-
PlotKit.Base.officeBaseStyle={"axisLineWidth":2,"axisLabelColor":Color.grayColor(),"axisLineColor":Color.whiteColor(),"padding":{top:5,bottom:10,left:30,right:30}};
|
209
|
-
MochiKit.Base.update(PlotKit.Base,{officeBlue:function(){
|
210
|
-
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"backgroundColor":PlotKit.Base.baseColors()[0].lighterColorWithLevel(0.45)};
|
211
|
-
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
|
212
|
-
return r;
|
213
|
-
},officeRed:function(){
|
214
|
-
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[1]),"backgroundColor":PlotKit.Base.baseColors()[1].lighterColorWithLevel(0.5)};
|
215
|
-
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
|
216
|
-
return r;
|
217
|
-
},officeGreen:function(){
|
218
|
-
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[2]),"backgroundColor":PlotKit.Base.baseColors()[2].lighterColorWithLevel(0.5)};
|
219
|
-
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
|
220
|
-
return r;
|
221
|
-
},officePurple:function(){
|
222
|
-
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[3]),"backgroundColor":PlotKit.Base.baseColors()[3].lighterColorWithLevel(0.5)};
|
223
|
-
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
|
224
|
-
return r;
|
225
|
-
},officeCyan:function(){
|
226
|
-
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[4]),"backgroundColor":PlotKit.Base.baseColors()[4].lighterColorWithLevel(0.5)};
|
227
|
-
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
|
228
|
-
return r;
|
229
|
-
},officeOrange:function(){
|
230
|
-
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[5]),"backgroundColor":PlotKit.Base.baseColors()[5].lighterColorWithLevel(0.4)};
|
231
|
-
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
|
232
|
-
return r;
|
233
|
-
},officeBlack:function(){
|
234
|
-
var r={"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[6],0,0.6),"backgroundColor":PlotKit.Base.baseColors()[6].lighterColorWithLevel(0.9)};
|
235
|
-
MochiKit.Base.update(r,PlotKit.Base.officeBaseStyle);
|
236
|
-
return r;
|
237
|
-
}});
|
238
|
-
PlotKit.Base.EXPORT=["baseColors","collapse","colorScheme","findPosX","findPosY","officeBaseStyle","officeBlue","officeRed","officeGreen","officePurple","officeCyan","officeOrange","officeBlack","roundInterval","uniq","isFuncLike","excanvasSupported"];
|
239
|
-
PlotKit.Base.EXPORT_OK=[];
|
240
|
-
PlotKit.Base.__new__=function(){
|
241
|
-
var m=MochiKit.Base;
|
242
|
-
m.nameFunctions(this);
|
243
|
-
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
|
244
|
-
};
|
245
|
-
PlotKit.Base.__new__();
|
246
|
-
MochiKit.Base._exportSymbols(this,PlotKit.Base);
|
247
|
-
try{
|
248
|
-
if(typeof (PlotKit.Base)=="undefined"){
|
249
|
-
throw "";
|
250
|
-
}
|
251
|
-
}
|
252
|
-
catch(e){
|
253
|
-
throw "PlotKit.Layout depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.Base";
|
254
|
-
}
|
255
|
-
if(typeof (PlotKit.Layout)=="undefined"){
|
256
|
-
PlotKit.Layout={};
|
257
|
-
}
|
258
|
-
PlotKit.Layout.NAME="PlotKit.Layout";
|
259
|
-
PlotKit.Layout.VERSION=PlotKit.VERSION;
|
260
|
-
PlotKit.Layout.__repr__=function(){
|
261
|
-
return "["+this.NAME+" "+this.VERSION+"]";
|
262
|
-
};
|
263
|
-
PlotKit.Layout.toString=function(){
|
264
|
-
return this.__repr__();
|
265
|
-
};
|
266
|
-
PlotKit.Layout.valid_styles=["bar","line","pie","point"];
|
267
|
-
PlotKit.Layout=function(_42,_43){
|
268
|
-
this.options={"barWidthFillFraction":0.75,"barOrientation":"vertical","xOriginIsZero":true,"yOriginIsZero":true,"xAxis":null,"yAxis":null,"xTicks":null,"yTicks":null,"xNumberOfTicks":10,"yNumberOfTicks":5,"xTickPrecision":1,"yTickPrecision":1,"pieRadius":0.4};
|
269
|
-
this.style=_42;
|
270
|
-
MochiKit.Base.update(this.options,_43?_43:{});
|
271
|
-
if(!MochiKit.Base.isUndefinedOrNull(this.options.xAxis)){
|
272
|
-
this.minxval=this.options.xAxis[0];
|
273
|
-
this.maxxval=this.options.xAxis[1];
|
274
|
-
this.xscale=this.maxxval-this.minxval;
|
275
|
-
}else{
|
276
|
-
this.minxval=0;
|
277
|
-
this.maxxval=null;
|
278
|
-
this.xscale=null;
|
279
|
-
}
|
280
|
-
if(!MochiKit.Base.isUndefinedOrNull(this.options.yAxis)){
|
281
|
-
this.minyval=this.options.yAxis[0];
|
282
|
-
this.maxyval=this.options.yAxis[1];
|
283
|
-
this.yscale=this.maxyval-this.minyval;
|
284
|
-
}else{
|
285
|
-
this.minyval=0;
|
286
|
-
this.maxyval=null;
|
287
|
-
this.yscale=null;
|
288
|
-
}
|
289
|
-
this.bars=new Array();
|
290
|
-
this.points=new Array();
|
291
|
-
this.slices=new Array();
|
292
|
-
this.xticks=new Array();
|
293
|
-
this.yticks=new Array();
|
294
|
-
this.datasets=new Array();
|
295
|
-
this.minxdelta=0;
|
296
|
-
this.xrange=1;
|
297
|
-
this.yrange=1;
|
298
|
-
this.hitTestCache={x2maxy:null};
|
299
|
-
};
|
300
|
-
PlotKit.Layout.prototype.addDataset=function(_44,_45){
|
301
|
-
this.datasets[_44]=_45;
|
302
|
-
};
|
303
|
-
PlotKit.Layout.prototype.removeDataset=function(_46,_47){
|
304
|
-
delete this.datasets[_46];
|
305
|
-
};
|
306
|
-
PlotKit.Layout.prototype.addDatasetFromTable=function(_48,_49,_50,_51,_52){
|
307
|
-
var _53=MochiKit.Base.isUndefinedOrNull;
|
308
|
-
var _54=MochiKit.DOM.scrapeText;
|
309
|
-
var _55=MochiKit.Format.strip;
|
310
|
-
if(_53(_50)){
|
311
|
-
_50=0;
|
312
|
-
}
|
313
|
-
if(_53(_51)){
|
314
|
-
_51=1;
|
315
|
-
}
|
316
|
-
if(_53(_52)){
|
317
|
-
_52=-1;
|
318
|
-
}
|
319
|
-
var _56=_49.tBodies[0].rows;
|
320
|
-
var _57=new Array();
|
321
|
-
var _58=new Array();
|
322
|
-
if(!_53(_56)){
|
323
|
-
for(var i=0;i<_56.length;i++){
|
324
|
-
_57.push([parseFloat(_55(_54(_56[i].cells[_50]))),parseFloat(_55(_54(_56[i].cells[_51])))]);
|
325
|
-
if(_52>=0){
|
326
|
-
_58.push({v:parseFloat(_55(_54(_56[i].cells[_50]))),label:_55(_54(_56[i].cells[_52]))});
|
327
|
-
}
|
328
|
-
}
|
329
|
-
this.addDataset(_48,_57);
|
330
|
-
if(_52>=0){
|
331
|
-
this.options.xTicks=_58;
|
332
|
-
}
|
333
|
-
return true;
|
334
|
-
}
|
335
|
-
return false;
|
336
|
-
};
|
337
|
-
PlotKit.Layout.prototype.evaluate=function(){
|
338
|
-
this._evaluateLimits();
|
339
|
-
this._evaluateScales();
|
340
|
-
if(this.style=="bar"){
|
341
|
-
if(this.options.barOrientation=="horizontal"){
|
342
|
-
this._evaluateHorizBarCharts();
|
343
|
-
}else{
|
344
|
-
this._evaluateBarCharts();
|
345
|
-
}
|
346
|
-
this._evaluateBarTicks();
|
347
|
-
}else{
|
348
|
-
if(this.style=="line"){
|
349
|
-
this._evaluateLineCharts();
|
350
|
-
this._evaluateLineTicks();
|
351
|
-
}else{
|
352
|
-
if(this.style=="pie"){
|
353
|
-
this._evaluatePieCharts();
|
354
|
-
this._evaluatePieTicks();
|
355
|
-
}
|
356
|
-
}
|
357
|
-
}
|
358
|
-
};
|
359
|
-
PlotKit.Layout.prototype.hitTest=function(x,y){
|
360
|
-
var f=MochiKit.Format.twoDigitFloat;
|
361
|
-
if((this.style=="bar")&&this.bars&&(this.bars.length>0)){
|
362
|
-
for(var i=0;i<this.bars.length;i++){
|
363
|
-
var bar=this.bars[i];
|
364
|
-
if((x>=bar.x)&&(x<=bar.x+bar.w)&&(y>=bar.y)&&(y-bar.y<=bar.h)){
|
365
|
-
return bar;
|
366
|
-
}
|
367
|
-
}
|
368
|
-
}else{
|
369
|
-
if(this.style=="line"){
|
370
|
-
if(this.hitTestCache.x2maxy==null){
|
371
|
-
this._regenerateHitTestCache();
|
372
|
-
}
|
373
|
-
var _62=x/this.xscale;
|
374
|
-
var _63=this.hitTestCache.xvalues;
|
375
|
-
var _64=null;
|
376
|
-
var _65=null;
|
377
|
-
for(var i=1;i<_63.length;i++){
|
378
|
-
if(_63[i]>_62){
|
379
|
-
_64=_63[i-1];
|
380
|
-
_65=_63[i];
|
381
|
-
break;
|
382
|
-
}
|
383
|
-
}
|
384
|
-
if((_64!=null)){
|
385
|
-
var _66=this.hitTestCache.x2maxy[_64];
|
386
|
-
var _67=this.hitTestCache.x2maxy[_65];
|
387
|
-
var _68=(1-y)/this.yscale;
|
388
|
-
var _69=(_67-_66)/(_65-_64);
|
389
|
-
var _70=_66+_69*(_62-_64);
|
390
|
-
if(_70>=_68){
|
391
|
-
var obj={xval:_62,yval:_68,xafter:_65,yafter:_67,xbefore:_64,ybefore:_66,yprojected:_70};
|
392
|
-
return obj;
|
393
|
-
}
|
394
|
-
}
|
395
|
-
}else{
|
396
|
-
if(this.style=="pie"){
|
397
|
-
var _71=Math.sqrt((y-0.5)*(y-0.5)+(x-0.5)*(x-0.5));
|
398
|
-
if(_71>this.options.pieRadius){
|
399
|
-
return null;
|
400
|
-
}
|
401
|
-
var _72=Math.atan2(y-0.5,x-0.5)-Math.PI/2;
|
402
|
-
for(var i=0;i<this.slices.length;i++){
|
403
|
-
var _73=this.slices[i];
|
404
|
-
if(_73.startAngle<_72&&_73.endAngle>=_72){
|
405
|
-
return _73;
|
406
|
-
}
|
407
|
-
}
|
408
|
-
}
|
409
|
-
}
|
410
|
-
}
|
411
|
-
return null;
|
412
|
-
};
|
413
|
-
PlotKit.Layout.prototype.rectForX=function(x){
|
414
|
-
return null;
|
415
|
-
};
|
416
|
-
PlotKit.Layout.prototype.angleRangeForX=function(x){
|
417
|
-
return null;
|
418
|
-
};
|
419
|
-
PlotKit.Layout.prototype._evaluateLimits=function(){
|
420
|
-
var map=PlotKit.Base.map;
|
421
|
-
var _75=PlotKit.Base.items;
|
422
|
-
var _76=MochiKit.Base.itemgetter;
|
423
|
-
var _77=PlotKit.Base.collapse;
|
424
|
-
var _78=MochiKit.Base.listMin;
|
425
|
-
var _79=MochiKit.Base.listMax;
|
426
|
-
var _80=MochiKit.Base.isUndefinedOrNull;
|
427
|
-
var all=_77(map(_76(1),_75(this.datasets)));
|
428
|
-
if(_80(this.options.xAxis)){
|
429
|
-
if(this.options.xOriginIsZero){
|
430
|
-
this.minxval=0;
|
431
|
-
}else{
|
432
|
-
this.minxval=_78(map(parseFloat,map(_76(0),all)));
|
433
|
-
}
|
434
|
-
this.maxxval=_79(map(parseFloat,map(_76(0),all)));
|
435
|
-
}else{
|
436
|
-
this.minxval=this.options.xAxis[0];
|
437
|
-
this.maxxval=this.options.xAxis[1];
|
438
|
-
this.xscale=this.maxval-this.minxval;
|
439
|
-
}
|
440
|
-
if(_80(this.options.yAxis)){
|
441
|
-
if(this.options.yOriginIsZero){
|
442
|
-
this.minyval=0;
|
443
|
-
}else{
|
444
|
-
this.minyval=_78(map(parseFloat,map(_76(1),all)));
|
445
|
-
}
|
446
|
-
this.maxyval=_79(map(parseFloat,map(_76(1),all)));
|
447
|
-
}else{
|
448
|
-
this.minyval=this.options.yAxis[0];
|
449
|
-
this.maxyval=this.options.yAxis[1];
|
450
|
-
this.yscale=this.maxyval-this.minyval;
|
451
|
-
}
|
452
|
-
};
|
453
|
-
PlotKit.Layout.prototype._evaluateScales=function(){
|
454
|
-
var _82=MochiKit.Base.isUndefinedOrNull;
|
455
|
-
this.xrange=this.maxxval-this.minxval;
|
456
|
-
if(this.xrange==0){
|
457
|
-
this.xscale=1;
|
458
|
-
}else{
|
459
|
-
this.xscale=1/this.xrange;
|
460
|
-
}
|
461
|
-
this.yrange=this.maxyval-this.minyval;
|
462
|
-
if(this.yrange==0){
|
463
|
-
this.yscale=1;
|
464
|
-
}else{
|
465
|
-
this.yscale=1/this.yrange;
|
466
|
-
}
|
467
|
-
};
|
468
|
-
PlotKit.Layout.prototype._uniqueXValues=function(){
|
469
|
-
var _83=PlotKit.Base.collapse;
|
470
|
-
var map=PlotKit.Base.map;
|
471
|
-
var _84=PlotKit.Base.uniq;
|
472
|
-
var _85=MochiKit.Base.itemgetter;
|
473
|
-
var _86=PlotKit.Base.items;
|
474
|
-
var _87=map(parseFloat,map(_85(0),_83(map(_85(1),_86(this.datasets)))));
|
475
|
-
_87.sort(MochiKit.Base.compare);
|
476
|
-
return _84(_87);
|
477
|
-
};
|
478
|
-
PlotKit.Layout.prototype._evaluateBarCharts=function(){
|
479
|
-
var _88=PlotKit.Base.items;
|
480
|
-
var _89=_88(this.datasets).length;
|
481
|
-
var _90=10000000;
|
482
|
-
var _91=this._uniqueXValues();
|
483
|
-
for(var i=1;i<_91.length;i++){
|
484
|
-
_90=Math.min(Math.abs(_91[i]-_91[i-1]),_90);
|
485
|
-
}
|
486
|
-
var _92=0;
|
487
|
-
var _93=0;
|
488
|
-
var _94=0;
|
489
|
-
if(_91.length==1){
|
490
|
-
_90=1;
|
491
|
-
this.xscale=1;
|
492
|
-
this.minxval=_91[0];
|
493
|
-
_92=1*this.options.barWidthFillFraction;
|
494
|
-
_93=_92/_89;
|
495
|
-
_94=(1-this.options.barWidthFillFraction)/2;
|
496
|
-
}else{
|
497
|
-
if(this.xrange==1){
|
498
|
-
this.xscale=0.5;
|
499
|
-
}else{
|
500
|
-
if(this.xrange==2){
|
501
|
-
this.xscale=1/3;
|
502
|
-
}else{
|
503
|
-
this.xscale=(1-_90/this.xrange)/this.xrange;
|
504
|
-
}
|
505
|
-
}
|
506
|
-
_92=_90*this.xscale*this.options.barWidthFillFraction;
|
507
|
-
_93=_92/_89;
|
508
|
-
_94=_90*this.xscale*(1-this.options.barWidthFillFraction)/2;
|
509
|
-
}
|
510
|
-
this.minxdelta=_90;
|
511
|
-
this.bars=new Array();
|
512
|
-
var i=0;
|
513
|
-
for(var _95 in this.datasets){
|
514
|
-
var _96=this.datasets[_95];
|
515
|
-
if(PlotKit.Base.isFuncLike(_96)){
|
516
|
-
continue;
|
517
|
-
}
|
518
|
-
for(var j=0;j<_96.length;j++){
|
519
|
-
var _98=_96[j];
|
520
|
-
var _99={x:((parseFloat(_98[0])-this.minxval)*this.xscale)+(i*_93)+_94,y:1-((parseFloat(_98[1])-this.minyval)*this.yscale),w:_93,h:((parseFloat(_98[1])-this.minyval)*this.yscale),xval:parseFloat(_98[0]),yval:parseFloat(_98[1]),name:_95};
|
521
|
-
if((_99.x>=0)&&(_99.x<=1)&&(_99.y>=0)&&(_99.y<=1)){
|
522
|
-
this.bars.push(_99);
|
523
|
-
}
|
524
|
-
}
|
525
|
-
i++;
|
526
|
-
}
|
527
|
-
};
|
528
|
-
PlotKit.Layout.prototype._evaluateHorizBarCharts=function(){
|
529
|
-
var _100=PlotKit.Base.items;
|
530
|
-
var _101=_100(this.datasets).length;
|
531
|
-
var _102=10000000;
|
532
|
-
var _103=this._uniqueXValues();
|
533
|
-
for(var i=1;i<_103.length;i++){
|
534
|
-
_102=Math.min(Math.abs(_103[i]-_103[i-1]),_102);
|
535
|
-
}
|
536
|
-
var _104=0;
|
537
|
-
var _105=0;
|
538
|
-
var _106=0;
|
539
|
-
if(_103.length==1){
|
540
|
-
_102=1;
|
541
|
-
this.xscale=1;
|
542
|
-
this.minxval=_103[0];
|
543
|
-
_104=1*this.options.barWidthFillFraction;
|
544
|
-
_105=_104/_101;
|
545
|
-
_106=(1-this.options.barWidthFillFraction)/2;
|
546
|
-
}else{
|
547
|
-
this.xscale=(1-_102/this.xrange)/this.xrange;
|
548
|
-
_104=_102*this.xscale*this.options.barWidthFillFraction;
|
549
|
-
_105=_104/_101;
|
550
|
-
_106=_102*this.xscale*(1-this.options.barWidthFillFraction)/2;
|
551
|
-
}
|
552
|
-
this.minxdelta=_102;
|
553
|
-
this.bars=new Array();
|
554
|
-
var i=0;
|
555
|
-
for(var _107 in this.datasets){
|
556
|
-
var _108=this.datasets[_107];
|
557
|
-
if(PlotKit.Base.isFuncLike(_108)){
|
558
|
-
continue;
|
559
|
-
}
|
560
|
-
for(var j=0;j<_108.length;j++){
|
561
|
-
var item=_108[j];
|
562
|
-
var rect={y:((parseFloat(item[0])-this.minxval)*this.xscale)+(i*_105)+_106,x:0,h:_105,w:((parseFloat(item[1])-this.minyval)*this.yscale),xval:parseFloat(item[0]),yval:parseFloat(item[1]),name:_107};
|
563
|
-
if(rect.y<=0){
|
564
|
-
rect.y=0;
|
565
|
-
}
|
566
|
-
if(rect.y>=1){
|
567
|
-
rect.y=1;
|
568
|
-
}
|
569
|
-
if((rect.x>=0)&&(rect.x<=1)){
|
570
|
-
this.bars.push(rect);
|
571
|
-
}
|
572
|
-
}
|
573
|
-
i++;
|
574
|
-
}
|
575
|
-
};
|
576
|
-
PlotKit.Layout.prototype._evaluateLineCharts=function(){
|
577
|
-
var _111=PlotKit.Base.items;
|
578
|
-
var _112=_111(this.datasets).length;
|
579
|
-
this.points=new Array();
|
580
|
-
var i=0;
|
581
|
-
for(var _113 in this.datasets){
|
582
|
-
var _114=this.datasets[_113];
|
583
|
-
if(PlotKit.Base.isFuncLike(_114)){
|
584
|
-
continue;
|
585
|
-
}
|
586
|
-
_114.sort(function(a,b){
|
587
|
-
return compare(parseFloat(a[0]),parseFloat(b[0]));
|
588
|
-
});
|
589
|
-
for(var j=0;j<_114.length;j++){
|
590
|
-
var item=_114[j];
|
591
|
-
var _117={x:((parseFloat(item[0])-this.minxval)*this.xscale),y:1-((parseFloat(item[1])-this.minyval)*this.yscale),xval:parseFloat(item[0]),yval:parseFloat(item[1]),name:_113};
|
592
|
-
if(_117.y<=0){
|
593
|
-
_117.y=0;
|
594
|
-
}
|
595
|
-
if(_117.y>=1){
|
596
|
-
_117.y=1;
|
597
|
-
}
|
598
|
-
if((_117.x>=0)&&(_117.x<=1)){
|
599
|
-
this.points.push(_117);
|
600
|
-
}
|
601
|
-
}
|
602
|
-
i++;
|
603
|
-
}
|
604
|
-
};
|
605
|
-
PlotKit.Layout.prototype._evaluatePieCharts=function(){
|
606
|
-
var _118=PlotKit.Base.items;
|
607
|
-
var sum=MochiKit.Iter.sum;
|
608
|
-
var _120=MochiKit.Base.itemgetter;
|
609
|
-
var _121=_118(this.datasets).length;
|
610
|
-
var _122=_118(this.datasets)[0][1];
|
611
|
-
var _123=sum(map(_120(1),_122));
|
612
|
-
this.slices=new Array();
|
613
|
-
var _124=0;
|
614
|
-
for(var i=0;i<_122.length;i++){
|
615
|
-
var _125=_122[i][1]/_123;
|
616
|
-
var _126=_124*Math.PI*2;
|
617
|
-
var _127=(_124+_125)*Math.PI*2;
|
618
|
-
var _128={fraction:_125,xval:_122[i][0],yval:_122[i][1],startAngle:_126,endAngle:_127};
|
619
|
-
if(_122[i][1]!=0){
|
620
|
-
this.slices.push(_128);
|
621
|
-
}
|
622
|
-
_124+=_125;
|
623
|
-
}
|
624
|
-
};
|
625
|
-
PlotKit.Layout.prototype._evaluateLineTicksForXAxis=function(){
|
626
|
-
var _129=MochiKit.Base.isUndefinedOrNull;
|
627
|
-
if(this.options.xTicks){
|
628
|
-
this.xticks=new Array();
|
629
|
-
var _130=function(tick){
|
630
|
-
var _132=tick.label;
|
631
|
-
if(_129(_132)){
|
632
|
-
_132=tick.v.toString();
|
633
|
-
}
|
634
|
-
var pos=this.xscale*(tick.v-this.minxval);
|
635
|
-
if((pos>=0)&&(pos<=1)){
|
636
|
-
this.xticks.push([pos,_132]);
|
637
|
-
}
|
638
|
-
};
|
639
|
-
MochiKit.Iter.forEach(this.options.xTicks,bind(_130,this));
|
640
|
-
}else{
|
641
|
-
if(this.options.xNumberOfTicks){
|
642
|
-
var _134=this._uniqueXValues();
|
643
|
-
var _135=this.xrange/this.options.xNumberOfTicks;
|
644
|
-
var _136=0;
|
645
|
-
this.xticks=new Array();
|
646
|
-
for(var i=0;i<=_134.length;i++){
|
647
|
-
if((_134[i]-this.minxval)>=(_136*_135)){
|
648
|
-
var pos=this.xscale*(_134[i]-this.minxval);
|
649
|
-
if((pos>1)||(pos<0)){
|
650
|
-
continue;
|
651
|
-
}
|
652
|
-
this.xticks.push([pos,_134[i]]);
|
653
|
-
_136++;
|
654
|
-
}
|
655
|
-
if(_136>this.options.xNumberOfTicks){
|
656
|
-
break;
|
657
|
-
}
|
658
|
-
}
|
659
|
-
}
|
660
|
-
}
|
661
|
-
};
|
662
|
-
PlotKit.Layout.prototype._evaluateLineTicksForYAxis=function(){
|
663
|
-
var _137=MochiKit.Base.isUndefinedOrNull;
|
664
|
-
if(this.options.yTicks){
|
665
|
-
this.yticks=new Array();
|
666
|
-
var _138=function(tick){
|
667
|
-
var _139=tick.label;
|
668
|
-
if(_137(_139)){
|
669
|
-
_139=tick.v.toString();
|
670
|
-
}
|
671
|
-
var pos=1-(this.yscale*(tick.v-this.minyval));
|
672
|
-
if((pos>=0)&&(pos<=1)){
|
673
|
-
this.yticks.push([pos,_139]);
|
674
|
-
}
|
675
|
-
};
|
676
|
-
MochiKit.Iter.forEach(this.options.yTicks,bind(_138,this));
|
677
|
-
}else{
|
678
|
-
if(this.options.yNumberOfTicks){
|
679
|
-
this.yticks=new Array();
|
680
|
-
var _140=PlotKit.Base.roundInterval;
|
681
|
-
var prec=this.options.yTickPrecision;
|
682
|
-
var _142=_140(this.yrange,this.options.yNumberOfTicks,prec);
|
683
|
-
for(var i=0;i<=this.options.yNumberOfTicks;i++){
|
684
|
-
var yval=this.minyval+(i*_142);
|
685
|
-
var pos=1-((yval-this.minyval)*this.yscale);
|
686
|
-
if((pos>1)||(pos<0)){
|
687
|
-
continue;
|
688
|
-
}
|
689
|
-
this.yticks.push([pos,MochiKit.Format.roundToFixed(yval,prec)]);
|
690
|
-
}
|
691
|
-
}
|
692
|
-
}
|
693
|
-
};
|
694
|
-
PlotKit.Layout.prototype._evaluateLineTicks=function(){
|
695
|
-
this._evaluateLineTicksForXAxis();
|
696
|
-
this._evaluateLineTicksForYAxis();
|
697
|
-
};
|
698
|
-
PlotKit.Layout.prototype._evaluateBarTicks=function(){
|
699
|
-
this._evaluateLineTicks();
|
700
|
-
var _144=function(tick){
|
701
|
-
return [tick[0]+(this.minxdelta*this.xscale)/2,tick[1]];
|
702
|
-
};
|
703
|
-
this.xticks=MochiKit.Base.map(bind(_144,this),this.xticks);
|
704
|
-
if(this.options.barOrientation=="horizontal"){
|
705
|
-
var _145=this.xticks;
|
706
|
-
this.xticks=this.yticks;
|
707
|
-
this.yticks=_145;
|
708
|
-
var _146=function(tick){
|
709
|
-
return [1-tick[0],tick[1]];
|
710
|
-
};
|
711
|
-
this.xticks=MochiKit.Base.map(_146,this.xticks);
|
712
|
-
}
|
713
|
-
};
|
714
|
-
PlotKit.Layout.prototype._evaluatePieTicks=function(){
|
715
|
-
var _147=MochiKit.Base.isUndefinedOrNull;
|
716
|
-
var _148=MochiKit.Format.numberFormatter("#%");
|
717
|
-
this.xticks=new Array();
|
718
|
-
if(this.options.xTicks){
|
719
|
-
var _149=new Array();
|
720
|
-
for(var i=0;i<this.slices.length;i++){
|
721
|
-
_149[this.slices[i].xval]=this.slices[i];
|
722
|
-
}
|
723
|
-
for(var i=0;i<this.options.xTicks.length;i++){
|
724
|
-
var tick=this.options.xTicks[i];
|
725
|
-
var _150=_149[tick.v];
|
726
|
-
var _151=tick.label;
|
727
|
-
if(_150){
|
728
|
-
if(_147(_151)){
|
729
|
-
_151=tick.v.toString();
|
730
|
-
}
|
731
|
-
_151+=" ("+_148(_150.fraction)+")";
|
732
|
-
this.xticks.push([tick.v,_151]);
|
733
|
-
}
|
734
|
-
}
|
735
|
-
}else{
|
736
|
-
for(var i=0;i<this.slices.length;i++){
|
737
|
-
var _150=this.slices[i];
|
738
|
-
var _151=_150.xval+" ("+_148(_150.fraction)+")";
|
739
|
-
this.xticks.push([_150.xval,_151]);
|
740
|
-
}
|
741
|
-
}
|
742
|
-
};
|
743
|
-
PlotKit.Layout.prototype._regenerateHitTestCache=function(){
|
744
|
-
this.hitTestCache.xvalues=this._uniqueXValues();
|
745
|
-
this.hitTestCache.xlookup=new Array();
|
746
|
-
this.hitTestCache.x2maxy=new Array();
|
747
|
-
var _152=MochiKit.Base.listMax;
|
748
|
-
var _153=MochiKit.Base.itemgetter;
|
749
|
-
var map=MochiKit.Base.map;
|
750
|
-
var _154=keys(this.datasets);
|
751
|
-
for(var i=0;i<_154.length;i++){
|
752
|
-
var _155=this.datasets[_154[i]];
|
753
|
-
for(var j=0;j<_155.length;j++){
|
754
|
-
var xval=_155[j][0];
|
755
|
-
var yval=_155[j][1];
|
756
|
-
if(this.hitTestCache.xlookup[xval]){
|
757
|
-
this.hitTestCache.xlookup[xval].push([yval,_154[i]]);
|
758
|
-
}else{
|
759
|
-
this.hitTestCache.xlookup[xval]=[[yval,_154[i]]];
|
760
|
-
}
|
761
|
-
}
|
762
|
-
}
|
763
|
-
for(var x in this.hitTestCache.xlookup){
|
764
|
-
var _157=this.hitTestCache.xlookup[x];
|
765
|
-
this.hitTestCache.x2maxy[x]=_152(map(_153(0),_157));
|
766
|
-
}
|
767
|
-
};
|
768
|
-
PlotKit.LayoutModule={};
|
769
|
-
PlotKit.LayoutModule.Layout=PlotKit.Layout;
|
770
|
-
PlotKit.LayoutModule.EXPORT=["Layout"];
|
771
|
-
PlotKit.LayoutModule.EXPORT_OK=[];
|
772
|
-
PlotKit.LayoutModule.__new__=function(){
|
773
|
-
var m=MochiKit.Base;
|
774
|
-
m.nameFunctions(this);
|
775
|
-
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
|
776
|
-
};
|
777
|
-
PlotKit.LayoutModule.__new__();
|
778
|
-
MochiKit.Base._exportSymbols(this,PlotKit.LayoutModule);
|
779
|
-
try{
|
780
|
-
if((typeof (PlotKit.Base)=="undefined")||(typeof (PlotKit.Layout)=="undefined")){
|
781
|
-
throw "";
|
782
|
-
}
|
783
|
-
}
|
784
|
-
catch(e){
|
785
|
-
throw "PlotKit.Layout depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Base,Layout}";
|
786
|
-
}
|
787
|
-
if(typeof (PlotKit.CanvasRenderer)=="undefined"){
|
788
|
-
PlotKit.CanvasRenderer={};
|
789
|
-
}
|
790
|
-
PlotKit.CanvasRenderer.NAME="PlotKit.CanvasRenderer";
|
791
|
-
PlotKit.CanvasRenderer.VERSION=PlotKit.VERSION;
|
792
|
-
PlotKit.CanvasRenderer.__repr__=function(){
|
793
|
-
return "["+this.NAME+" "+this.VERSION+"]";
|
794
|
-
};
|
795
|
-
PlotKit.CanvasRenderer.toString=function(){
|
796
|
-
return this.__repr__();
|
797
|
-
};
|
798
|
-
PlotKit.CanvasRenderer=function(_158,_159,_160){
|
799
|
-
if(arguments.length>0){
|
800
|
-
this.__init__(_158,_159,_160);
|
801
|
-
}
|
802
|
-
};
|
803
|
-
PlotKit.CanvasRenderer.prototype.__init__=function(_161,_162,_163){
|
804
|
-
var _164=MochiKit.Base.isUndefinedOrNull;
|
805
|
-
var _165=MochiKit.Color.Color;
|
806
|
-
this.options={"drawBackground":true,"backgroundColor":_165.whiteColor(),"padding":{left:30,right:30,top:5,bottom:10},"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[0]),"strokeColor":_165.whiteColor(),"strokeColorTransform":"asStrokeColor","strokeWidth":0.5,"shouldFill":true,"shouldStroke":true,"drawXAxis":true,"drawYAxis":true,"axisLineColor":_165.blackColor(),"axisLineWidth":0.5,"axisTickSize":3,"axisLabelColor":_165.blackColor(),"axisLabelFont":"Arial","axisLabelFontSize":9,"axisLabelWidth":50,"pieRadius":0.4,"enableEvents":true};
|
807
|
-
MochiKit.Base.update(this.options,_163?_163:{});
|
808
|
-
this.layout=_162;
|
809
|
-
this.element=MochiKit.DOM.getElement(_161);
|
810
|
-
this.container=this.element.parentNode;
|
811
|
-
this.isIE=PlotKit.Base.excanvasSupported();
|
812
|
-
if(this.isIE&&!_164(G_vmlCanvasManager)){
|
813
|
-
this.IEDelay=0.5;
|
814
|
-
this.maxTries=5;
|
815
|
-
this.renderDelay=null;
|
816
|
-
this.clearDelay=null;
|
817
|
-
this.element=G_vmlCanvasManager.initElement(this.element);
|
818
|
-
}
|
819
|
-
this.height=this.element.height;
|
820
|
-
this.width=this.element.width;
|
821
|
-
if(_164(this.element)){
|
822
|
-
throw "CanvasRenderer() - passed canvas is not found";
|
823
|
-
}
|
824
|
-
if(!this.isIE&&!(PlotKit.CanvasRenderer.isSupported(this.element))){
|
825
|
-
throw "CanvasRenderer() - Canvas is not supported.";
|
826
|
-
}
|
827
|
-
if(_164(this.container)||(this.container.nodeName.toLowerCase()!="div")){
|
828
|
-
throw "CanvasRenderer() - <canvas> needs to be enclosed in <div>";
|
829
|
-
}
|
830
|
-
this.xlabels=new Array();
|
831
|
-
this.ylabels=new Array();
|
832
|
-
this.isFirstRender=true;
|
833
|
-
this.area={x:this.options.padding.left,y:this.options.padding.top,w:this.width-this.options.padding.left-this.options.padding.right,h:this.height-this.options.padding.top-this.options.padding.bottom};
|
834
|
-
MochiKit.DOM.updateNodeAttributes(this.container,{"style":{"position":"relative","width":this.width+"px"}});
|
835
|
-
};
|
836
|
-
PlotKit.CanvasRenderer.prototype.render=function(){
|
837
|
-
if(this.isIE){
|
838
|
-
try{
|
839
|
-
if(this.renderDelay){
|
840
|
-
this.renderDelay.cancel();
|
841
|
-
this.renderDelay=null;
|
842
|
-
}
|
843
|
-
var _166=this.element.getContext("2d");
|
844
|
-
}
|
845
|
-
catch(e){
|
846
|
-
this.isFirstRender=false;
|
847
|
-
if(this.maxTries-->0){
|
848
|
-
this.renderDelay=MochiKit.Async.wait(this.IEDelay);
|
849
|
-
this.renderDelay.addCallback(bind(this.render,this));
|
850
|
-
}
|
851
|
-
return;
|
852
|
-
}
|
853
|
-
}
|
854
|
-
if(this.options.drawBackground){
|
855
|
-
this._renderBackground();
|
856
|
-
}
|
857
|
-
if(this.layout.style=="bar"){
|
858
|
-
this._renderBarChart();
|
859
|
-
this._renderBarAxis();
|
860
|
-
}else{
|
861
|
-
if(this.layout.style=="pie"){
|
862
|
-
this._renderPieChart();
|
863
|
-
this._renderPieAxis();
|
864
|
-
}else{
|
865
|
-
if(this.layout.style=="line"){
|
866
|
-
this._renderLineChart();
|
867
|
-
this._renderLineAxis();
|
868
|
-
}
|
869
|
-
}
|
870
|
-
}
|
871
|
-
};
|
872
|
-
PlotKit.CanvasRenderer.prototype._renderBarChartWrap=function(data,_168){
|
873
|
-
var _169=this.element.getContext("2d");
|
874
|
-
var _170=this.options.colorScheme.length;
|
875
|
-
var _171=this.options.colorScheme;
|
876
|
-
var _172=MochiKit.Base.keys(this.layout.datasets);
|
877
|
-
var _173=_172.length;
|
878
|
-
for(var i=0;i<_173;i++){
|
879
|
-
var _174=_172[i];
|
880
|
-
var _175=_171[i%_170];
|
881
|
-
_169.save();
|
882
|
-
_169.fillStyle=_175.toRGBString();
|
883
|
-
if(this.options.strokeColor){
|
884
|
-
_169.strokeStyle=this.options.strokeColor.toRGBString();
|
885
|
-
}else{
|
886
|
-
if(this.options.strokeColorTransform){
|
887
|
-
_169.strokeStyle=_175[this.options.strokeColorTransform]().toRGBString();
|
888
|
-
}
|
889
|
-
}
|
890
|
-
_169.lineWidth=this.options.strokeWidth;
|
891
|
-
var _176=function(obj){
|
892
|
-
if(obj.name==_174){
|
893
|
-
_168(_169,obj);
|
894
|
-
}
|
895
|
-
};
|
896
|
-
MochiKit.Iter.forEach(data,bind(_176,this));
|
897
|
-
_169.restore();
|
898
|
-
}
|
899
|
-
};
|
900
|
-
PlotKit.CanvasRenderer.prototype._renderBarChart=function(){
|
901
|
-
var bind=MochiKit.Base.bind;
|
902
|
-
var _178=function(_179,bar){
|
903
|
-
var x=this.area.w*bar.x+this.area.x;
|
904
|
-
var y=this.area.h*bar.y+this.area.y;
|
905
|
-
var w=this.area.w*bar.w;
|
906
|
-
var h=this.area.h*bar.h;
|
907
|
-
if((w<1)||(h<1)){
|
908
|
-
return;
|
909
|
-
}
|
910
|
-
if(this.options.shouldFill){
|
911
|
-
_179.fillRect(x,y,w,h);
|
912
|
-
}
|
913
|
-
if(this.options.shouldStroke){
|
914
|
-
_179.strokeRect(x,y,w,h);
|
915
|
-
}
|
916
|
-
};
|
917
|
-
this._renderBarChartWrap(this.layout.bars,bind(_178,this));
|
918
|
-
};
|
919
|
-
PlotKit.CanvasRenderer.prototype._renderLineChart=function(){
|
920
|
-
var _182=this.element.getContext("2d");
|
921
|
-
var _183=this.options.colorScheme.length;
|
922
|
-
var _184=this.options.colorScheme;
|
923
|
-
var _185=MochiKit.Base.keys(this.layout.datasets);
|
924
|
-
var _186=_185.length;
|
925
|
-
var bind=MochiKit.Base.bind;
|
926
|
-
var _187=MochiKit.Base.partial;
|
927
|
-
for(var i=0;i<_186;i++){
|
928
|
-
var _188=_185[i];
|
929
|
-
var _189=_184[i%_183];
|
930
|
-
var _190=this.options.strokeColorTransform;
|
931
|
-
_182.save();
|
932
|
-
_182.fillStyle=_189.toRGBString();
|
933
|
-
if(this.options.strokeColor){
|
934
|
-
_182.strokeStyle=this.options.strokeColor.toRGBString();
|
935
|
-
}else{
|
936
|
-
if(this.options.strokeColorTransform){
|
937
|
-
_182.strokeStyle=_189[_190]().toRGBString();
|
938
|
-
}
|
939
|
-
}
|
940
|
-
_182.lineWidth=this.options.strokeWidth;
|
941
|
-
var _191=function(ctx){
|
942
|
-
ctx.beginPath();
|
943
|
-
ctx.moveTo(this.area.x,this.area.y+this.area.h);
|
944
|
-
var _193=function(ctx_,_195){
|
945
|
-
if(_195.name==_188){
|
946
|
-
ctx_.lineTo(this.area.w*_195.x+this.area.x,this.area.h*_195.y+this.area.y);
|
947
|
-
}
|
948
|
-
};
|
949
|
-
MochiKit.Iter.forEach(this.layout.points,_187(_193,ctx),this);
|
950
|
-
ctx.lineTo(this.area.w+this.area.x,this.area.h+this.area.y);
|
951
|
-
ctx.lineTo(this.area.x,this.area.y+this.area.h);
|
952
|
-
ctx.closePath();
|
953
|
-
};
|
954
|
-
if(this.options.shouldFill){
|
955
|
-
bind(_191,this)(_182);
|
956
|
-
_182.fill();
|
957
|
-
}
|
958
|
-
if(this.options.shouldStroke){
|
959
|
-
bind(_191,this)(_182);
|
960
|
-
_182.stroke();
|
961
|
-
}
|
962
|
-
_182.restore();
|
963
|
-
}
|
964
|
-
};
|
965
|
-
PlotKit.CanvasRenderer.prototype._renderPieChart=function(){
|
966
|
-
var _196=this.element.getContext("2d");
|
967
|
-
var _197=this.options.colorScheme.length;
|
968
|
-
var _198=this.layout.slices;
|
969
|
-
var _199=this.area.x+this.area.w*0.5;
|
970
|
-
var _200=this.area.y+this.area.h*0.5;
|
971
|
-
var _201=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius);
|
972
|
-
if(this.isIE){
|
973
|
-
_199=parseInt(_199);
|
974
|
-
_200=parseInt(_200);
|
975
|
-
_201=parseInt(_201);
|
976
|
-
}
|
977
|
-
for(var i=0;i<_198.length;i++){
|
978
|
-
var _202=this.options.colorScheme[i%_197];
|
979
|
-
_196.save();
|
980
|
-
_196.fillStyle=_202.toRGBString();
|
981
|
-
var _203=function(){
|
982
|
-
_196.beginPath();
|
983
|
-
_196.moveTo(_199,_200);
|
984
|
-
_196.arc(_199,_200,_201,_198[i].startAngle-Math.PI/2,_198[i].endAngle-Math.PI/2,false);
|
985
|
-
_196.lineTo(_199,_200);
|
986
|
-
_196.closePath();
|
987
|
-
};
|
988
|
-
if(Math.abs(_198[i].startAngle-_198[i].endAngle)>0.001){
|
989
|
-
if(this.options.shouldFill){
|
990
|
-
_203();
|
991
|
-
_196.fill();
|
992
|
-
}
|
993
|
-
if(this.options.shouldStroke){
|
994
|
-
_203();
|
995
|
-
_196.lineWidth=this.options.strokeWidth;
|
996
|
-
if(this.options.strokeColor){
|
997
|
-
_196.strokeStyle=this.options.strokeColor.toRGBString();
|
998
|
-
}else{
|
999
|
-
if(this.options.strokeColorTransform){
|
1000
|
-
_196.strokeStyle=_202[this.options.strokeColorTransform]().toRGBString();
|
1001
|
-
}
|
1002
|
-
}
|
1003
|
-
_196.stroke();
|
1004
|
-
}
|
1005
|
-
}
|
1006
|
-
_196.restore();
|
1007
|
-
}
|
1008
|
-
};
|
1009
|
-
PlotKit.CanvasRenderer.prototype._renderBarAxis=function(){
|
1010
|
-
this._renderAxis();
|
1011
|
-
};
|
1012
|
-
PlotKit.CanvasRenderer.prototype._renderLineAxis=function(){
|
1013
|
-
this._renderAxis();
|
1014
|
-
};
|
1015
|
-
PlotKit.CanvasRenderer.prototype._renderAxis=function(){
|
1016
|
-
if(!this.options.drawXAxis&&!this.options.drawYAxis){
|
1017
|
-
return;
|
1018
|
-
}
|
1019
|
-
var _204=this.element.getContext("2d");
|
1020
|
-
var _205={"style":{"position":"absolute","fontSize":this.options.axisLabelFontSize+"px","zIndex":10,"color":this.options.axisLabelColor.toRGBString(),"width":this.options.axisLabelWidth+"px","overflow":"hidden"}};
|
1021
|
-
_204.save();
|
1022
|
-
_204.strokeStyle=this.options.axisLineColor.toRGBString();
|
1023
|
-
_204.lineWidth=this.options.axisLineWidth;
|
1024
|
-
if(this.options.drawYAxis){
|
1025
|
-
if(this.layout.yticks){
|
1026
|
-
var _206=function(tick){
|
1027
|
-
if(typeof (tick)=="function"){
|
1028
|
-
return;
|
1029
|
-
}
|
1030
|
-
var x=this.area.x;
|
1031
|
-
var y=this.area.y+tick[0]*this.area.h;
|
1032
|
-
_204.beginPath();
|
1033
|
-
_204.moveTo(x,y);
|
1034
|
-
_204.lineTo(x-this.options.axisTickSize,y);
|
1035
|
-
_204.closePath();
|
1036
|
-
_204.stroke();
|
1037
|
-
var _207=DIV(_205,tick[1]);
|
1038
|
-
_207.style.top=(y-this.options.axisLabelFontSize)+"px";
|
1039
|
-
_207.style.left=(x-this.options.padding.left-this.options.axisTickSize)+"px";
|
1040
|
-
_207.style.textAlign="right";
|
1041
|
-
_207.style.width=(this.options.padding.left-this.options.axisTickSize*2)+"px";
|
1042
|
-
MochiKit.DOM.appendChildNodes(this.container,_207);
|
1043
|
-
this.ylabels.push(_207);
|
1044
|
-
};
|
1045
|
-
MochiKit.Iter.forEach(this.layout.yticks,bind(_206,this));
|
1046
|
-
}
|
1047
|
-
_204.beginPath();
|
1048
|
-
_204.moveTo(this.area.x,this.area.y);
|
1049
|
-
_204.lineTo(this.area.x,this.area.y+this.area.h);
|
1050
|
-
_204.closePath();
|
1051
|
-
_204.stroke();
|
1052
|
-
}
|
1053
|
-
if(this.options.drawXAxis){
|
1054
|
-
if(this.layout.xticks){
|
1055
|
-
var _206=function(tick){
|
1056
|
-
if(typeof (dataset)=="function"){
|
1057
|
-
return;
|
1058
|
-
}
|
1059
|
-
var x=this.area.x+tick[0]*this.area.w;
|
1060
|
-
var y=this.area.y+this.area.h;
|
1061
|
-
_204.beginPath();
|
1062
|
-
_204.moveTo(x,y);
|
1063
|
-
_204.lineTo(x,y+this.options.axisTickSize);
|
1064
|
-
_204.closePath();
|
1065
|
-
_204.stroke();
|
1066
|
-
var _208=DIV(_205,tick[1]);
|
1067
|
-
_208.style.top=(y+this.options.axisTickSize)+"px";
|
1068
|
-
_208.style.left=(x-this.options.axisLabelWidth/2)+"px";
|
1069
|
-
_208.style.textAlign="center";
|
1070
|
-
_208.style.width=this.options.axisLabelWidth+"px";
|
1071
|
-
MochiKit.DOM.appendChildNodes(this.container,_208);
|
1072
|
-
this.xlabels.push(_208);
|
1073
|
-
};
|
1074
|
-
MochiKit.Iter.forEach(this.layout.xticks,bind(_206,this));
|
1075
|
-
}
|
1076
|
-
_204.beginPath();
|
1077
|
-
_204.moveTo(this.area.x,this.area.y+this.area.h);
|
1078
|
-
_204.lineTo(this.area.x+this.area.w,this.area.y+this.area.h);
|
1079
|
-
_204.closePath();
|
1080
|
-
_204.stroke();
|
1081
|
-
}
|
1082
|
-
_204.restore();
|
1083
|
-
};
|
1084
|
-
PlotKit.CanvasRenderer.prototype._renderPieAxis=function(){
|
1085
|
-
if(!this.options.drawXAxis){
|
1086
|
-
return;
|
1087
|
-
}
|
1088
|
-
if(this.layout.xticks){
|
1089
|
-
var _209=new Array();
|
1090
|
-
for(var i=0;i<this.layout.slices.length;i++){
|
1091
|
-
_209[this.layout.slices[i].xval]=this.layout.slices[i];
|
1092
|
-
}
|
1093
|
-
var _210=this.area.x+this.area.w*0.5;
|
1094
|
-
var _211=this.area.y+this.area.h*0.5;
|
1095
|
-
var _212=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius);
|
1096
|
-
var _213=this.options.axisLabelWidth;
|
1097
|
-
for(var i=0;i<this.layout.xticks.length;i++){
|
1098
|
-
var _214=_209[this.layout.xticks[i][0]];
|
1099
|
-
if(MochiKit.Base.isUndefinedOrNull(_214)){
|
1100
|
-
continue;
|
1101
|
-
}
|
1102
|
-
var _215=(_214.startAngle+_214.endAngle)/2;
|
1103
|
-
var _216=_215;
|
1104
|
-
if(_216>Math.PI*2){
|
1105
|
-
_216=_216-Math.PI*2;
|
1106
|
-
}else{
|
1107
|
-
if(_216<0){
|
1108
|
-
_216=_216+Math.PI*2;
|
1109
|
-
}
|
1110
|
-
}
|
1111
|
-
var _217=_210+Math.sin(_216)*(_212+10);
|
1112
|
-
var _218=_211-Math.cos(_216)*(_212+10);
|
1113
|
-
var _219={"position":"absolute","zIndex":11,"width":_213+"px","fontSize":this.options.axisLabelFontSize+"px","overflow":"hidden","color":this.options.axisLabelColor.toHexString()};
|
1114
|
-
if(_216<=Math.PI*0.5){
|
1115
|
-
_219["textAlign"]="left";
|
1116
|
-
_219["verticalAlign"]="top";
|
1117
|
-
_219["left"]=_217+"px";
|
1118
|
-
_219["top"]=(_218-this.options.axisLabelFontSize)+"px";
|
1119
|
-
}else{
|
1120
|
-
if((_216>Math.PI*0.5)&&(_216<=Math.PI)){
|
1121
|
-
_219["textAlign"]="left";
|
1122
|
-
_219["verticalAlign"]="bottom";
|
1123
|
-
_219["left"]=_217+"px";
|
1124
|
-
_219["top"]=_218+"px";
|
1125
|
-
}else{
|
1126
|
-
if((_216>Math.PI)&&(_216<=Math.PI*1.5)){
|
1127
|
-
_219["textAlign"]="right";
|
1128
|
-
_219["verticalAlign"]="bottom";
|
1129
|
-
_219["left"]=(_217-_213)+"px";
|
1130
|
-
_219["top"]=_218+"px";
|
1131
|
-
}else{
|
1132
|
-
_219["textAlign"]="right";
|
1133
|
-
_219["verticalAlign"]="bottom";
|
1134
|
-
_219["left"]=(_217-_213)+"px";
|
1135
|
-
_219["top"]=(_218-this.options.axisLabelFontSize)+"px";
|
1136
|
-
}
|
1137
|
-
}
|
1138
|
-
}
|
1139
|
-
var _220=DIV({"style":_219},this.layout.xticks[i][1]);
|
1140
|
-
this.xlabels.push(_220);
|
1141
|
-
MochiKit.DOM.appendChildNodes(this.container,_220);
|
1142
|
-
}
|
1143
|
-
}
|
1144
|
-
};
|
1145
|
-
PlotKit.CanvasRenderer.prototype._renderBackground=function(){
|
1146
|
-
var _221=this.element.getContext("2d");
|
1147
|
-
_221.save();
|
1148
|
-
_221.fillStyle=this.options.backgroundColor.toRGBString();
|
1149
|
-
_221.fillRect(0,0,this.width,this.height);
|
1150
|
-
_221.restore();
|
1151
|
-
};
|
1152
|
-
PlotKit.CanvasRenderer.prototype.clear=function(){
|
1153
|
-
if(this.isIE){
|
1154
|
-
try{
|
1155
|
-
if(this.clearDelay){
|
1156
|
-
this.clearDelay.cancel();
|
1157
|
-
this.clearDelay=null;
|
1158
|
-
}
|
1159
|
-
var _222=this.element.getContext("2d");
|
1160
|
-
}
|
1161
|
-
catch(e){
|
1162
|
-
this.isFirstRender=false;
|
1163
|
-
this.clearDelay=MochiKit.Async.wait(this.IEDelay);
|
1164
|
-
this.clearDelay.addCallback(bind(this.clear,this));
|
1165
|
-
return;
|
1166
|
-
}
|
1167
|
-
}
|
1168
|
-
var _222=this.element.getContext("2d");
|
1169
|
-
_222.clearRect(0,0,this.width,this.height);
|
1170
|
-
MochiKit.Iter.forEach(this.xlabels,MochiKit.DOM.removeElement);
|
1171
|
-
MochiKit.Iter.forEach(this.ylabels,MochiKit.DOM.removeElement);
|
1172
|
-
this.xlabels=new Array();
|
1173
|
-
this.ylabels=new Array();
|
1174
|
-
};
|
1175
|
-
PlotKit.CanvasRenderer.prototype._initialiseEvents=function(){
|
1176
|
-
var _223=MochiKit.Signal.connect;
|
1177
|
-
var bind=MochiKit.Base.bind;
|
1178
|
-
_223(this.element,"onclick",bind(this.onclick,this));
|
1179
|
-
};
|
1180
|
-
PlotKit.CanvasRenderer.prototype._resolveObject=function(e){
|
1181
|
-
var x=(e.mouse().page.x-PlotKit.Base.findPosX(this.element)-this.area.x)/this.area.w;
|
1182
|
-
var y=(e.mouse().page.y-PlotKit.Base.findPosY(this.element)-this.area.y)/this.area.h;
|
1183
|
-
var _225=this.layout.hitTest(x,y);
|
1184
|
-
if(_225){
|
1185
|
-
return _225;
|
1186
|
-
}
|
1187
|
-
return null;
|
1188
|
-
};
|
1189
|
-
PlotKit.CanvasRenderer.prototype._createEventObject=function(_226,e){
|
1190
|
-
if(_226==null){
|
1191
|
-
return null;
|
1192
|
-
}
|
1193
|
-
e.chart=_226;
|
1194
|
-
return e;
|
1195
|
-
};
|
1196
|
-
PlotKit.CanvasRenderer.prototype.onclick=function(e){
|
1197
|
-
var _227=this._resolveObject(e);
|
1198
|
-
var _228=this._createEventObject(_227,e);
|
1199
|
-
if(_228!=null){
|
1200
|
-
MochiKit.Signal.signal(this,"onclick",_228);
|
1201
|
-
}
|
1202
|
-
};
|
1203
|
-
PlotKit.CanvasRenderer.prototype.onmouseover=function(e){
|
1204
|
-
var _229=this._resolveObject(e);
|
1205
|
-
var _230=this._createEventObject(_229,e);
|
1206
|
-
if(_230!=null){
|
1207
|
-
signal(this,"onmouseover",_230);
|
1208
|
-
}
|
1209
|
-
};
|
1210
|
-
PlotKit.CanvasRenderer.prototype.onmouseout=function(e){
|
1211
|
-
var _231=this._resolveObject(e);
|
1212
|
-
var _232=this._createEventObject(_231,e);
|
1213
|
-
if(_232==null){
|
1214
|
-
signal(this,"onmouseout",e);
|
1215
|
-
}else{
|
1216
|
-
signal(this,"onmouseout",_232);
|
1217
|
-
}
|
1218
|
-
};
|
1219
|
-
PlotKit.CanvasRenderer.prototype.onmousemove=function(e){
|
1220
|
-
var _233=this._resolveObject(e);
|
1221
|
-
var _234=this._createEventObject(_233,e);
|
1222
|
-
if((_233==null)&&(this.event_isinside==null)){
|
1223
|
-
return;
|
1224
|
-
}
|
1225
|
-
if((_233!=null)&&(this.event_isinside==null)){
|
1226
|
-
signal(this,"onmouseover",_234);
|
1227
|
-
}
|
1228
|
-
if((_233==null)&&(this.event_isinside!=null)){
|
1229
|
-
signal(this,"onmouseout",_234);
|
1230
|
-
}
|
1231
|
-
if((_233!=null)&&(this.event_isinside!=null)){
|
1232
|
-
signal(this,"onmousemove",_234);
|
1233
|
-
}
|
1234
|
-
this.event_isinside=_233;
|
1235
|
-
};
|
1236
|
-
PlotKit.CanvasRenderer.isSupported=function(_235){
|
1237
|
-
var _236=null;
|
1238
|
-
try{
|
1239
|
-
if(MochiKit.Base.isUndefinedOrNull(_235)){
|
1240
|
-
_236=MochiKit.DOM.CANVAS({});
|
1241
|
-
}else{
|
1242
|
-
_236=MochiKit.DOM.getElement(_235);
|
1243
|
-
}
|
1244
|
-
var _237=_236.getContext("2d");
|
1245
|
-
}
|
1246
|
-
catch(e){
|
1247
|
-
var ie=navigator.appVersion.match(/MSIE (\d\.\d)/);
|
1248
|
-
var _239=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
|
1249
|
-
if((!ie)||(ie[1]<6)||(_239)){
|
1250
|
-
return false;
|
1251
|
-
}
|
1252
|
-
return true;
|
1253
|
-
}
|
1254
|
-
return true;
|
1255
|
-
};
|
1256
|
-
PlotKit.Canvas={};
|
1257
|
-
PlotKit.Canvas.CanvasRenderer=PlotKit.CanvasRenderer;
|
1258
|
-
PlotKit.Canvas.EXPORT=["CanvasRenderer"];
|
1259
|
-
PlotKit.Canvas.EXPORT_OK=["CanvasRenderer"];
|
1260
|
-
PlotKit.Canvas.__new__=function(){
|
1261
|
-
var m=MochiKit.Base;
|
1262
|
-
m.nameFunctions(this);
|
1263
|
-
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
|
1264
|
-
};
|
1265
|
-
PlotKit.Canvas.__new__();
|
1266
|
-
MochiKit.Base._exportSymbols(this,PlotKit.Canvas);
|
1267
|
-
try{
|
1268
|
-
if(typeof (PlotKit.Layout)=="undefined"){
|
1269
|
-
throw "";
|
1270
|
-
}
|
1271
|
-
}
|
1272
|
-
catch(e){
|
1273
|
-
throw "PlotKit depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.Layout";
|
1274
|
-
}
|
1275
|
-
PlotKit.SVGRenderer=function(_240,_241,_242){
|
1276
|
-
if(arguments.length>0){
|
1277
|
-
this.__init__(_240,_241,_242);
|
1278
|
-
}
|
1279
|
-
};
|
1280
|
-
PlotKit.SVGRenderer.NAME="PlotKit.SVGRenderer";
|
1281
|
-
PlotKit.SVGRenderer.VERSION=PlotKit.VERSION;
|
1282
|
-
PlotKit.SVGRenderer.__repr__=function(){
|
1283
|
-
return "["+this.NAME+" "+this.VERSION+"]";
|
1284
|
-
};
|
1285
|
-
PlotKit.SVGRenderer.toString=function(){
|
1286
|
-
return this.__repr__();
|
1287
|
-
};
|
1288
|
-
PlotKit.SVGRenderer.SVGNS="http://www.w3.org/2000/svg";
|
1289
|
-
PlotKit.SVGRenderer.prototype.__init__=function(_243,_244,_245){
|
1290
|
-
var _246=MochiKit.Base.isUndefinedOrNull;
|
1291
|
-
this.options={"drawBackground":true,"backgroundColor":Color.whiteColor(),"padding":{left:30,right:30,top:5,bottom:10},"colorScheme":PlotKit.Base.palette(PlotKit.Base.baseColors()[1]),"strokeColor":Color.whiteColor(),"strokeColorTransform":"asStrokeColor","strokeWidth":0.5,"shouldFill":true,"shouldStroke":true,"drawXAxis":true,"drawYAxis":true,"axisLineColor":Color.blackColor(),"axisLineWidth":0.5,"axisTickSize":3,"axisLabelColor":Color.blackColor(),"axisLabelFont":"Arial","axisLabelFontSize":9,"axisLabelWidth":50,"axisLabelUseDiv":true,"pieRadius":0.4,"enableEvents":true};
|
1292
|
-
MochiKit.Base.update(this.options,_245?_245:{});
|
1293
|
-
this.layout=_244;
|
1294
|
-
this.element=MochiKit.DOM.getElement(_243);
|
1295
|
-
this.container=this.element.parentNode;
|
1296
|
-
this.height=parseInt(this.element.getAttribute("height"));
|
1297
|
-
this.width=parseInt(this.element.getAttribute("width"));
|
1298
|
-
this.document=document;
|
1299
|
-
this.root=this.element;
|
1300
|
-
try{
|
1301
|
-
this.document=this.element.getSVGDocument();
|
1302
|
-
this.root=_246(this.document.documentElement)?this.element:this.document.documentElement;
|
1303
|
-
}
|
1304
|
-
catch(e){
|
1305
|
-
}
|
1306
|
-
this.element.style.zIndex=1;
|
1307
|
-
if(_246(this.element)){
|
1308
|
-
throw "SVGRenderer() - passed SVG object is not found";
|
1309
|
-
}
|
1310
|
-
if(_246(this.container)||this.container.nodeName.toLowerCase()!="div"){
|
1311
|
-
throw "SVGRenderer() - No DIV's around the SVG.";
|
1312
|
-
}
|
1313
|
-
this.xlabels=new Array();
|
1314
|
-
this.ylabels=new Array();
|
1315
|
-
this.defs=this.createSVGElement("defs");
|
1316
|
-
this.area={x:this.options.padding.left,y:this.options.padding.top,w:this.width-this.options.padding.left-this.options.padding.right,h:this.height-this.options.padding.top-this.options.padding.bottom};
|
1317
|
-
MochiKit.DOM.updateNodeAttributes(this.container,{"style":{"position":"relative","width":this.width+"px"}});
|
1318
|
-
};
|
1319
|
-
PlotKit.SVGRenderer.prototype.render=function(){
|
1320
|
-
if(this.options.drawBackground){
|
1321
|
-
this._renderBackground();
|
1322
|
-
}
|
1323
|
-
if(this.layout.style=="bar"){
|
1324
|
-
this._renderBarChart();
|
1325
|
-
this._renderBarAxis();
|
1326
|
-
}else{
|
1327
|
-
if(this.layout.style=="pie"){
|
1328
|
-
this._renderPieChart();
|
1329
|
-
this._renderPieAxis();
|
1330
|
-
}else{
|
1331
|
-
if(this.layout.style=="line"){
|
1332
|
-
this._renderLineChart();
|
1333
|
-
this._renderLineAxis();
|
1334
|
-
}
|
1335
|
-
}
|
1336
|
-
}
|
1337
|
-
};
|
1338
|
-
PlotKit.SVGRenderer.prototype._renderBarOrLine=function(data,_247,_248,_249){
|
1339
|
-
var _250=this.options.colorScheme.length;
|
1340
|
-
var _251=this.options.colorScheme;
|
1341
|
-
var _252=MochiKit.Base.keys(this.layout.datasets);
|
1342
|
-
var _253=_252.length;
|
1343
|
-
for(var i=0;i<_253;i++){
|
1344
|
-
var _254=_252[i];
|
1345
|
-
var _255=new Array();
|
1346
|
-
var _256=_251[i%_250];
|
1347
|
-
if(this.options.shouldFill){
|
1348
|
-
_255["fill"]=_256.toRGBString();
|
1349
|
-
}else{
|
1350
|
-
_255["fill"]="none";
|
1351
|
-
}
|
1352
|
-
if(this.options.shouldStroke&&(this.options.strokeColor||this.options.strokeColorTransform)){
|
1353
|
-
if(this.options.strokeColor){
|
1354
|
-
_255["stroke"]=this.options.strokeColor.toRGBString();
|
1355
|
-
}else{
|
1356
|
-
if(this.options.strokeColorTransform){
|
1357
|
-
_255["stroke"]=_256[this.options.strokeColorTransform]().toRGBString();
|
1358
|
-
}
|
1359
|
-
}
|
1360
|
-
_255["strokeWidth"]=this.options.strokeWidth;
|
1361
|
-
}
|
1362
|
-
if(_248){
|
1363
|
-
_248(_255);
|
1364
|
-
}
|
1365
|
-
var _257=function(obj){
|
1366
|
-
if(obj.name==_254){
|
1367
|
-
_247(_255,obj);
|
1368
|
-
}
|
1369
|
-
};
|
1370
|
-
MochiKit.Iter.forEach(data,bind(_257,this));
|
1371
|
-
if(_249){
|
1372
|
-
_249(_255);
|
1373
|
-
}
|
1374
|
-
}
|
1375
|
-
};
|
1376
|
-
PlotKit.SVGRenderer.prototype._renderBarChart=function(){
|
1377
|
-
var bind=MochiKit.Base.bind;
|
1378
|
-
var _258=function(_259,bar){
|
1379
|
-
var x=this.area.w*bar.x+this.area.x;
|
1380
|
-
var y=this.area.h*bar.y+this.area.y;
|
1381
|
-
var w=this.area.w*bar.w;
|
1382
|
-
var h=this.area.h*bar.h;
|
1383
|
-
this._drawRect(x,y,w,h,_259);
|
1384
|
-
};
|
1385
|
-
this._renderBarOrLine(this.layout.bars,bind(_258,this));
|
1386
|
-
};
|
1387
|
-
PlotKit.SVGRenderer.prototype._renderLineChart=function(){
|
1388
|
-
var bind=MochiKit.Base.bind;
|
1389
|
-
var _260=function(_261,_262){
|
1390
|
-
this._tempPointsBuffer+=(this.area.w*_262.x+this.area.x)+","+(this.area.h*_262.y+this.area.y)+" ";
|
1391
|
-
};
|
1392
|
-
var _263=function(_264){
|
1393
|
-
this._tempPointsBuffer="";
|
1394
|
-
this._tempPointsBuffer+=(this.area.x)+","+(this.area.y+this.area.h)+" ";
|
1395
|
-
};
|
1396
|
-
var _265=function(_266){
|
1397
|
-
this._tempPointsBuffer+=(this.area.w+this.area.x)+","+(this.area.h+this.area.y);
|
1398
|
-
_266["points"]=this._tempPointsBuffer;
|
1399
|
-
var elem=this.createSVGElement("polygon",_266);
|
1400
|
-
this.root.appendChild(elem);
|
1401
|
-
};
|
1402
|
-
this._renderBarOrLine(this.layout.points,bind(_260,this),bind(_263,this),bind(_265,this));
|
1403
|
-
};
|
1404
|
-
PlotKit.SVGRenderer.prototype._renderPieChart=function(){
|
1405
|
-
var _268=this.options.colorScheme.length;
|
1406
|
-
var _269=this.layout.slices;
|
1407
|
-
var _270=this.area.x+this.area.w*0.5;
|
1408
|
-
var _271=this.area.y+this.area.h*0.5;
|
1409
|
-
var _272=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius);
|
1410
|
-
if(_269.length==1&&(Math.abs(_269[0].startAngle)-Math.abs(_269[0].endAngle)<0.1)){
|
1411
|
-
var _273={"cx":_270,"cy":_271,"r":_272};
|
1412
|
-
var _274=this.options.colorScheme[0];
|
1413
|
-
if(this.options.shouldFill){
|
1414
|
-
_273["fill"]=_274.toRGBString();
|
1415
|
-
}else{
|
1416
|
-
_273["fill"]="none";
|
1417
|
-
}
|
1418
|
-
if(this.options.shouldStroke&&(this.options.strokeColor||this.options.strokeColorTransform)){
|
1419
|
-
if(this.options.strokeColor){
|
1420
|
-
_273["stroke"]=this.options.strokeColor.toRGBString();
|
1421
|
-
}else{
|
1422
|
-
if(this.options.strokeColorTransform){
|
1423
|
-
_273["stroke"]=_274[this.options.strokeColorTransform]().toRGBString();
|
1424
|
-
}
|
1425
|
-
}
|
1426
|
-
_273["style"]="stroke-width: "+this.options.strokeWidth;
|
1427
|
-
}
|
1428
|
-
this.root.appendChild(this.createSVGElement("circle",_273));
|
1429
|
-
return;
|
1430
|
-
}
|
1431
|
-
for(var i=0;i<_269.length;i++){
|
1432
|
-
var _273=new Array();
|
1433
|
-
var _274=this.options.colorScheme[i%_268];
|
1434
|
-
if(this.options.shouldFill){
|
1435
|
-
_273["fill"]=_274.toRGBString();
|
1436
|
-
}else{
|
1437
|
-
_273["fill"]="none";
|
1438
|
-
}
|
1439
|
-
if(this.options.shouldStroke&&(this.options.strokeColor||this.options.strokeColorTransform)){
|
1440
|
-
if(this.options.strokeColor){
|
1441
|
-
_273["stroke"]=this.options.strokeColor.toRGBString();
|
1442
|
-
}else{
|
1443
|
-
if(this.options.strokeColorTransform){
|
1444
|
-
_273["stroke"]=_274[this.options.strokeColorTransform]().toRGBString();
|
1445
|
-
}
|
1446
|
-
}
|
1447
|
-
_273["style"]="stroke-width:"+this.options.strokeWidth;
|
1448
|
-
}
|
1449
|
-
var _275=0;
|
1450
|
-
if(Math.abs(_269[i].endAngle-_269[i].startAngle)>Math.PI){
|
1451
|
-
_275=1;
|
1452
|
-
}
|
1453
|
-
var x1=Math.cos(_269[i].startAngle-Math.PI/2)*_272;
|
1454
|
-
var y1=Math.sin(_269[i].startAngle-Math.PI/2)*_272;
|
1455
|
-
var x2=Math.cos(_269[i].endAngle-Math.PI/2)*_272;
|
1456
|
-
var y2=Math.sin(_269[i].endAngle-Math.PI/2)*_272;
|
1457
|
-
var rx=x2-x1;
|
1458
|
-
var ry=y2-y1;
|
1459
|
-
var _282="M"+_270+","+_271+" ";
|
1460
|
-
_282+="l"+x1+","+y1+" ";
|
1461
|
-
_282+="a"+_272+","+_272+" 0 "+_275+",1 "+rx+","+ry+" z";
|
1462
|
-
_273["d"]=_282;
|
1463
|
-
var elem=this.createSVGElement("path",_273);
|
1464
|
-
this.root.appendChild(elem);
|
1465
|
-
}
|
1466
|
-
};
|
1467
|
-
PlotKit.SVGRenderer.prototype._renderBarAxis=function(){
|
1468
|
-
this._renderAxis();
|
1469
|
-
};
|
1470
|
-
PlotKit.SVGRenderer.prototype._renderLineAxis=function(){
|
1471
|
-
this._renderAxis();
|
1472
|
-
};
|
1473
|
-
PlotKit.SVGRenderer.prototype._renderAxis=function(){
|
1474
|
-
if(!this.options.drawXAxis&&!this.options.drawYAxis){
|
1475
|
-
return;
|
1476
|
-
}
|
1477
|
-
var _283={"style":{"position":"absolute","textAlign":"center","fontSize":this.options.axisLabelFontSize+"px","zIndex":10,"color":this.options.axisLabelColor.toRGBString(),"width":this.options.axisLabelWidth+"px","overflow":"hidden"}};
|
1478
|
-
var _284={"stroke":this.options.axisLineColor.toRGBString(),"strokeWidth":this.options.axisLineWidth};
|
1479
|
-
if(this.options.drawYAxis){
|
1480
|
-
if(this.layout.yticks){
|
1481
|
-
var _285=function(tick){
|
1482
|
-
var x=this.area.x;
|
1483
|
-
var y=this.area.y+tick[0]*this.area.h;
|
1484
|
-
this._drawLine(x,y,x-3,y,_284);
|
1485
|
-
if(this.options.axisLabelUseDiv){
|
1486
|
-
var _286=DIV(_283,tick[1]);
|
1487
|
-
_286.style.top=(y-this.options.axisLabelFontSize)+"px";
|
1488
|
-
_286.style.left=(x-this.options.padding.left+this.options.axisTickSize)+"px";
|
1489
|
-
_286.style.textAlign="left";
|
1490
|
-
_286.style.width=(this.options.padding.left-3)+"px";
|
1491
|
-
MochiKit.DOM.appendChildNodes(this.container,_286);
|
1492
|
-
this.ylabels.push(_286);
|
1493
|
-
}else{
|
1494
|
-
var _287={y:y+3,x:(x-this.options.padding.left+3),width:(this.options.padding.left-this.options.axisTickSize)+"px",height:(this.options.axisLabelFontSize+3)+"px",fontFamily:"Arial",fontSize:this.options.axisLabelFontSize+"px",fill:this.options.axisLabelColor.toRGBString()};
|
1495
|
-
var _286=this.createSVGElement("text",_287);
|
1496
|
-
_286.appendChild(this.document.createTextNode(tick[1]));
|
1497
|
-
this.root.appendChild(_286);
|
1498
|
-
}
|
1499
|
-
};
|
1500
|
-
MochiKit.Iter.forEach(this.layout.yticks,bind(_285,this));
|
1501
|
-
}
|
1502
|
-
this._drawLine(this.area.x,this.area.y,this.area.x,this.area.y+this.area.h,_284);
|
1503
|
-
}
|
1504
|
-
if(this.options.drawXAxis){
|
1505
|
-
if(this.layout.xticks){
|
1506
|
-
var _285=function(tick){
|
1507
|
-
var x=this.area.x+tick[0]*this.area.w;
|
1508
|
-
var y=this.area.y+this.area.h;
|
1509
|
-
this._drawLine(x,y,x,y+this.options.axisTickSize,_284);
|
1510
|
-
if(this.options.axisLabelUseDiv){
|
1511
|
-
var _288=DIV(_283,tick[1]);
|
1512
|
-
_288.style.top=(y+this.options.axisTickSize)+"px";
|
1513
|
-
_288.style.left=(x-this.options.axisLabelWidth/2)+"px";
|
1514
|
-
_288.style.textAlign="center";
|
1515
|
-
_288.style.width=this.options.axisLabelWidth+"px";
|
1516
|
-
MochiKit.DOM.appendChildNodes(this.container,_288);
|
1517
|
-
this.xlabels.push(_288);
|
1518
|
-
}else{
|
1519
|
-
var _289={y:(y+this.options.axisTickSize+this.options.axisLabelFontSize),x:x-3,width:this.options.axisLabelWidth+"px",height:(this.options.axisLabelFontSize+3)+"px",fontFamily:"Arial",fontSize:this.options.axisLabelFontSize+"px",fill:this.options.axisLabelColor.toRGBString(),textAnchor:"middle"};
|
1520
|
-
var _288=this.createSVGElement("text",_289);
|
1521
|
-
_288.appendChild(this.document.createTextNode(tick[1]));
|
1522
|
-
this.root.appendChild(_288);
|
1523
|
-
}
|
1524
|
-
};
|
1525
|
-
MochiKit.Iter.forEach(this.layout.xticks,bind(_285,this));
|
1526
|
-
}
|
1527
|
-
this._drawLine(this.area.x,this.area.y+this.area.h,this.area.x+this.area.w,this.area.y+this.area.h,_284);
|
1528
|
-
}
|
1529
|
-
};
|
1530
|
-
PlotKit.SVGRenderer.prototype._renderPieAxis=function(){
|
1531
|
-
if(this.layout.xticks){
|
1532
|
-
var _290=new Array();
|
1533
|
-
for(var i=0;i<this.layout.slices.length;i++){
|
1534
|
-
_290[this.layout.slices[i].xval]=this.layout.slices[i];
|
1535
|
-
}
|
1536
|
-
var _291=this.area.x+this.area.w*0.5;
|
1537
|
-
var _292=this.area.y+this.area.h*0.5;
|
1538
|
-
var _293=Math.min(this.area.w*this.options.pieRadius+10,this.area.h*this.options.pieRadius+10);
|
1539
|
-
var _294=this.options.axisLabelWidth;
|
1540
|
-
for(var i=0;i<this.layout.xticks.length;i++){
|
1541
|
-
var _295=_290[this.layout.xticks[i][0]];
|
1542
|
-
if(MochiKit.Base.isUndefinedOrNull(_295)){
|
1543
|
-
continue;
|
1544
|
-
}
|
1545
|
-
var _296=(_295.startAngle+_295.endAngle)/2;
|
1546
|
-
var _297=_296;
|
1547
|
-
if(_297>Math.PI*2){
|
1548
|
-
_297=_297-Math.PI*2;
|
1549
|
-
}else{
|
1550
|
-
if(_297<0){
|
1551
|
-
_297=_297+Math.PI*2;
|
1552
|
-
}
|
1553
|
-
}
|
1554
|
-
var _298=_291+Math.sin(_297)*(_293+10);
|
1555
|
-
var _299=_292-Math.cos(_297)*(_293+10);
|
1556
|
-
var _300={"position":"absolute","zIndex":11,"width":_294+"px","fontSize":this.options.axisLabelFontSize+"px","overflow":"hidden","color":this.options.axisLabelColor.toHexString()};
|
1557
|
-
var _301={"width":_294+"px","fontSize":this.options.axisLabelFontSize+"px","height":(this.options.axisLabelFontSize+3)+"px","fill":this.options.axisLabelColor.toRGBString()};
|
1558
|
-
if(_297<=Math.PI*0.5){
|
1559
|
-
MochiKit.Base.update(_300,{"textAlign":"left","verticalAlign":"top","left":_298+"px","top":(_299-this.options.axisLabelFontSize)+"px"});
|
1560
|
-
MochiKit.Base.update(_301,{"x":_298,"y":(_299-this.options.axisLabelFontSize),"textAnchor":"left"});
|
1561
|
-
}else{
|
1562
|
-
if((_297>Math.PI*0.5)&&(_297<=Math.PI)){
|
1563
|
-
MochiKit.Base.update(_300,{"textAlign":"left","verticalAlign":"bottom","left":_298+"px","top":_299+"px"});
|
1564
|
-
MochiKit.Base.update(_301,{"textAnchor":"left","x":_298,"y":_299});
|
1565
|
-
}else{
|
1566
|
-
if((_297>Math.PI)&&(_297<=Math.PI*1.5)){
|
1567
|
-
MochiKit.Base.update(_300,{"textAlign":"right","verticalAlign":"bottom","left":_298+"px","top":_299+"px"});
|
1568
|
-
MochiKit.Base.update(_301,{"textAnchor":"right","x":_298-_294,"y":_299});
|
1569
|
-
}else{
|
1570
|
-
MochiKit.Base.update(_300,{"textAlign":"left","verticalAlign":"bottom","left":_298+"px","top":_299+"px"});
|
1571
|
-
MochiKit.Base.update(_301,{"textAnchor":"left","x":_298-_294,"y":_299-this.options.axisLabelFontSize});
|
1572
|
-
}
|
1573
|
-
}
|
1574
|
-
}
|
1575
|
-
if(this.options.axisLabelUseDiv){
|
1576
|
-
var _302=DIV({"style":_300},this.layout.xticks[i][1]);
|
1577
|
-
this.xlabels.push(_302);
|
1578
|
-
MochiKit.DOM.appendChildNodes(this.container,_302);
|
1579
|
-
}else{
|
1580
|
-
var _302=this.createSVGElement("text",_301);
|
1581
|
-
_302.appendChild(this.document.createTextNode(this.layout.xticks[i][1]));
|
1582
|
-
this.root.appendChild(_302);
|
1583
|
-
}
|
1584
|
-
}
|
1585
|
-
}
|
1586
|
-
};
|
1587
|
-
PlotKit.SVGRenderer.prototype._renderBackground=function(){
|
1588
|
-
var opts={"stroke":"none","fill":this.options.backgroundColor.toRGBString()};
|
1589
|
-
this._drawRect(0,0,this.width,this.height,opts);
|
1590
|
-
};
|
1591
|
-
PlotKit.SVGRenderer.prototype._drawRect=function(x,y,w,h,_304){
|
1592
|
-
var _305={x:x+"px",y:y+"px",width:w+"px",height:h+"px"};
|
1593
|
-
if(_304){
|
1594
|
-
MochiKit.Base.update(_305,_304);
|
1595
|
-
}
|
1596
|
-
var elem=this.createSVGElement("rect",_305);
|
1597
|
-
this.root.appendChild(elem);
|
1598
|
-
};
|
1599
|
-
PlotKit.SVGRenderer.prototype._drawLine=function(x1,y1,x2,y2,_306){
|
1600
|
-
var _307={x1:x1+"px",y1:y1+"px",x2:x2+"px",y2:y2+"px"};
|
1601
|
-
if(_306){
|
1602
|
-
MochiKit.Base.update(_307,_306);
|
1603
|
-
}
|
1604
|
-
var elem=this.createSVGElement("line",_307);
|
1605
|
-
this.root.appendChild(elem);
|
1606
|
-
};
|
1607
|
-
PlotKit.SVGRenderer.prototype.clear=function(){
|
1608
|
-
while(this.element.firstChild){
|
1609
|
-
this.element.removeChild(this.element.firstChild);
|
1610
|
-
}
|
1611
|
-
if(this.options.axisLabelUseDiv){
|
1612
|
-
for(var i=0;i<this.xlabels.length;i++){
|
1613
|
-
MochiKit.DOM.removeElement(this.xlabels[i]);
|
1614
|
-
}
|
1615
|
-
for(var i=0;i<this.ylabels.length;i++){
|
1616
|
-
MochiKit.DOM.removeElement(this.ylabels[i]);
|
1617
|
-
}
|
1618
|
-
}
|
1619
|
-
this.xlabels=new Array();
|
1620
|
-
this.ylabels=new Array();
|
1621
|
-
};
|
1622
|
-
PlotKit.SVGRenderer.prototype.createSVGElement=function(name,_309){
|
1623
|
-
var _310=MochiKit.Base.isUndefinedOrNull;
|
1624
|
-
var elem;
|
1625
|
-
var doc=_310(this.document)?document:this.document;
|
1626
|
-
try{
|
1627
|
-
elem=doc.createElementNS(PlotKit.SVGRenderer.SVGNS,name);
|
1628
|
-
}
|
1629
|
-
catch(e){
|
1630
|
-
elem=doc.createElement(name);
|
1631
|
-
elem.setAttribute("xmlns",PlotKit.SVGRenderer.SVGNS);
|
1632
|
-
}
|
1633
|
-
if(_309){
|
1634
|
-
MochiKit.DOM.updateNodeAttributes(elem,_309);
|
1635
|
-
}
|
1636
|
-
return elem;
|
1637
|
-
};
|
1638
|
-
PlotKit.SVGRenderer.SVG=function(_312){
|
1639
|
-
var ie=navigator.appVersion.match(/MSIE (\d\.\d)/);
|
1640
|
-
var _313=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
|
1641
|
-
if(ie&&(ie[1]>=6)&&(!_313)){
|
1642
|
-
var _314=_312["width"]?_312["width"]:"100";
|
1643
|
-
var _315=_312["height"]?_312["height"]:"100";
|
1644
|
-
var eid=_312["id"]?_312["id"]:"notunique";
|
1645
|
-
var html="<svg:svg width=\""+_314+"\" height=\""+_315+"\" ";
|
1646
|
-
html+="id=\""+eid+"\" version=\"1.1\" baseProfile=\"full\" />";
|
1647
|
-
var _318=document.createElement(html);
|
1648
|
-
var _319=_318.getSVGDocument().createElementNS(PlotKit.SVGRenderer.SVGNS,"svg");
|
1649
|
-
_319.setAttribute("width",_314);
|
1650
|
-
_319.setAttribute("height",_315);
|
1651
|
-
_318.getSVGDocument().appendChild(_319);
|
1652
|
-
return _318;
|
1653
|
-
}else{
|
1654
|
-
return PlotKit.SVGRenderer.prototype.createSVGElement("svg",_312);
|
1655
|
-
}
|
1656
|
-
};
|
1657
|
-
PlotKit.SVGRenderer.isSupported=function(){
|
1658
|
-
var _320=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
|
1659
|
-
var _321=navigator.appVersion.match(/MSIE (\d\.\d)/);
|
1660
|
-
var _322=navigator.userAgent.match(/AppleWebKit\/(\d+)/);
|
1661
|
-
var _323=navigator.userAgent.match(/Opera\/(\d*\.\d*)/);
|
1662
|
-
var _324=navigator.userAgent.match(/rv:(\d*\.\d*).*Gecko/);
|
1663
|
-
var _325="http://www.w3.org/TR/SVG11/feature#SVG";
|
1664
|
-
if(_321&&(_321[1]>=6)&&!_320){
|
1665
|
-
return document.implementation.hasFeature(_325,"1.1");
|
1666
|
-
}
|
1667
|
-
if(_323&&(_323[1]>8.9)){
|
1668
|
-
return true;
|
1669
|
-
}
|
1670
|
-
if(_324&&(_324>1.7)){
|
1671
|
-
return true;
|
1672
|
-
}
|
1673
|
-
return false;
|
1674
|
-
};
|
1675
|
-
PlotKit.SVG={};
|
1676
|
-
PlotKit.SVG.SVGRenderer=PlotKit.SVGRenderer;
|
1677
|
-
PlotKit.SVG.EXPORT=["SVGRenderer"];
|
1678
|
-
PlotKit.SVG.EXPORT_OK=["SVGRenderer"];
|
1679
|
-
PlotKit.SVG.__new__=function(){
|
1680
|
-
var m=MochiKit.Base;
|
1681
|
-
m.nameFunctions(this);
|
1682
|
-
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
|
1683
|
-
};
|
1684
|
-
PlotKit.SVG.__new__();
|
1685
|
-
MochiKit.Base._exportSymbols(this,PlotKit.SVG);
|
1686
|
-
try{
|
1687
|
-
if(typeof (PlotKit.CanvasRenderer)=="undefined"){
|
1688
|
-
throw "";
|
1689
|
-
}
|
1690
|
-
}
|
1691
|
-
catch(e){
|
1692
|
-
throw "SweetCanvas depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, Canvas}";
|
1693
|
-
}
|
1694
|
-
if(typeof (PlotKit.SweetCanvasRenderer)=="undefined"){
|
1695
|
-
PlotKit.SweetCanvasRenderer={};
|
1696
|
-
}
|
1697
|
-
PlotKit.SweetCanvasRenderer=function(_326,_327,_328){
|
1698
|
-
if(arguments.length>0){
|
1699
|
-
this.__init__(_326,_327,_328);
|
1700
|
-
}
|
1701
|
-
};
|
1702
|
-
PlotKit.SweetCanvasRenderer.NAME="PlotKit.SweetCanvasRenderer";
|
1703
|
-
PlotKit.SweetCanvasRenderer.VERSION=PlotKit.VERSION;
|
1704
|
-
PlotKit.SweetCanvasRenderer.__repr__=function(){
|
1705
|
-
return "["+this.NAME+" "+this.VERSION+"]";
|
1706
|
-
};
|
1707
|
-
PlotKit.SweetCanvasRenderer.toString=function(){
|
1708
|
-
return this.__repr__();
|
1709
|
-
};
|
1710
|
-
PlotKit.SweetCanvasRenderer.prototype=new PlotKit.CanvasRenderer();
|
1711
|
-
PlotKit.SweetCanvasRenderer.prototype.constructor=PlotKit.SweetCanvasRenderer;
|
1712
|
-
PlotKit.SweetCanvasRenderer.__super__=PlotKit.CanvasRenderer.prototype;
|
1713
|
-
PlotKit.SweetCanvasRenderer.prototype.__init__=function(el,_330,opts){
|
1714
|
-
var _331=PlotKit.Base.officeBlue();
|
1715
|
-
MochiKit.Base.update(_331,opts);
|
1716
|
-
PlotKit.SweetCanvasRenderer.__super__.__init__.call(this,el,_330,_331);
|
1717
|
-
};
|
1718
|
-
PlotKit.SweetCanvasRenderer.prototype._renderBarChart=function(){
|
1719
|
-
var bind=MochiKit.Base.bind;
|
1720
|
-
var _332=Color.blackColor().colorWithAlpha(0.1).toRGBString();
|
1721
|
-
var _333=function(_334,x,y,w,h){
|
1722
|
-
_334.fillStyle=_332;
|
1723
|
-
_334.fillRect(x-2,y-2,w+4,h+2);
|
1724
|
-
_334.fillStyle=_332;
|
1725
|
-
_334.fillRect(x-1,y-1,w+2,h+1);
|
1726
|
-
};
|
1727
|
-
var _335=this.options.colorScheme.length;
|
1728
|
-
var _336=this.options.colorScheme;
|
1729
|
-
var _337=PlotKit.Base.keys(this.layout.datasets);
|
1730
|
-
var _338=_337.length;
|
1731
|
-
var _339=function(name){
|
1732
|
-
for(var i=0;i<_338;i++){
|
1733
|
-
if(name==_337[i]){
|
1734
|
-
return _336[i%_335];
|
1735
|
-
}
|
1736
|
-
}
|
1737
|
-
return _336[0];
|
1738
|
-
};
|
1739
|
-
var _340=function(_341,bar){
|
1740
|
-
var x=this.area.w*bar.x+this.area.x;
|
1741
|
-
var y=this.area.h*bar.y+this.area.y;
|
1742
|
-
var w=this.area.w*bar.w;
|
1743
|
-
var h=this.area.h*bar.h;
|
1744
|
-
if((w<1)||(h<1)){
|
1745
|
-
return;
|
1746
|
-
}
|
1747
|
-
_341.save();
|
1748
|
-
_341.shadowBlur=5;
|
1749
|
-
_341.shadowColor=Color.fromHexString("#888888").toRGBString();
|
1750
|
-
if(this.isIE){
|
1751
|
-
_341.save();
|
1752
|
-
_341.fillStyle="#cccccc";
|
1753
|
-
_341.fillRect(x-2,y-2,w+4,h+2);
|
1754
|
-
_341.restore();
|
1755
|
-
}else{
|
1756
|
-
_333(_341,x,y,w,h);
|
1757
|
-
}
|
1758
|
-
if(this.options.shouldFill){
|
1759
|
-
_341.fillStyle=_339(bar.name).toRGBString();
|
1760
|
-
_341.fillRect(x,y,w,h);
|
1761
|
-
}
|
1762
|
-
_341.shadowBlur=0;
|
1763
|
-
_341.strokeStyle=Color.whiteColor().toRGBString();
|
1764
|
-
_341.lineWidth=2;
|
1765
|
-
if(this.options.shouldStroke){
|
1766
|
-
_341.strokeRect(x,y,w,h);
|
1767
|
-
}
|
1768
|
-
_341.restore();
|
1769
|
-
};
|
1770
|
-
this._renderBarChartWrap(this.layout.bars,bind(_340,this));
|
1771
|
-
};
|
1772
|
-
PlotKit.SweetCanvasRenderer.prototype._renderLineChart=function(){
|
1773
|
-
var _342=this.element.getContext("2d");
|
1774
|
-
var _343=this.options.colorScheme.length;
|
1775
|
-
var _344=this.options.colorScheme;
|
1776
|
-
var _345=PlotKit.Base.keys(this.layout.datasets);
|
1777
|
-
var _346=_345.length;
|
1778
|
-
var bind=MochiKit.Base.bind;
|
1779
|
-
for(var i=0;i<_346;i++){
|
1780
|
-
var _347=_345[i];
|
1781
|
-
var _348=_344[i%_343];
|
1782
|
-
var _349=this.options.strokeColorTransform;
|
1783
|
-
_342.save();
|
1784
|
-
var _350=function(ctx){
|
1785
|
-
ctx.beginPath();
|
1786
|
-
ctx.moveTo(this.area.x,this.area.y+this.area.h);
|
1787
|
-
var _351=function(ctx_,_352){
|
1788
|
-
if(_352.name==_347){
|
1789
|
-
ctx_.lineTo(this.area.w*_352.x+this.area.x,this.area.h*_352.y+this.area.y);
|
1790
|
-
}
|
1791
|
-
};
|
1792
|
-
MochiKit.Iter.forEach(this.layout.points,partial(_351,ctx),this);
|
1793
|
-
ctx.lineTo(this.area.w+this.area.x,this.area.h+this.area.y);
|
1794
|
-
ctx.lineTo(this.area.x,this.area.y+this.area.h);
|
1795
|
-
ctx.closePath();
|
1796
|
-
};
|
1797
|
-
if(this.options.shouldFill){
|
1798
|
-
_342.save();
|
1799
|
-
if(this.isIE){
|
1800
|
-
_342.fillStyle="#cccccc";
|
1801
|
-
}else{
|
1802
|
-
_342.fillStyle=Color.blackColor().colorWithAlpha(0.2).toRGBString();
|
1803
|
-
}
|
1804
|
-
_342.translate(-1,-2);
|
1805
|
-
bind(_350,this)(_342);
|
1806
|
-
if(this.options.shouldFill){
|
1807
|
-
_342.fill();
|
1808
|
-
}
|
1809
|
-
_342.restore();
|
1810
|
-
}
|
1811
|
-
_342.shadowBlur=5;
|
1812
|
-
_342.shadowColor=Color.fromHexString("#888888").toRGBString();
|
1813
|
-
_342.fillStyle=_348.toRGBString();
|
1814
|
-
_342.lineWidth=2;
|
1815
|
-
_342.strokeStyle=Color.whiteColor().toRGBString();
|
1816
|
-
if(this.options.shouldFill){
|
1817
|
-
bind(_350,this)(_342);
|
1818
|
-
_342.fill();
|
1819
|
-
}
|
1820
|
-
if(this.options.shouldStroke){
|
1821
|
-
bind(_350,this)(_342);
|
1822
|
-
_342.stroke();
|
1823
|
-
}
|
1824
|
-
_342.restore();
|
1825
|
-
}
|
1826
|
-
};
|
1827
|
-
PlotKit.SweetCanvasRenderer.prototype._renderPieChart=function(){
|
1828
|
-
var _353=this.element.getContext("2d");
|
1829
|
-
var _354=this.options.colorScheme.length;
|
1830
|
-
var _355=this.layout.slices;
|
1831
|
-
var _356=this.area.x+this.area.w*0.5;
|
1832
|
-
var _357=this.area.y+this.area.h*0.5;
|
1833
|
-
var _358=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius);
|
1834
|
-
if(this.isIE){
|
1835
|
-
_356=parseInt(_356);
|
1836
|
-
_357=parseInt(_357);
|
1837
|
-
_358=parseInt(_358);
|
1838
|
-
}
|
1839
|
-
if(!this.isIE){
|
1840
|
-
_353.save();
|
1841
|
-
var _359=Color.blackColor().colorWithAlpha(0.2);
|
1842
|
-
_353.fillStyle=_359.toRGBString();
|
1843
|
-
_353.shadowBlur=5;
|
1844
|
-
_353.shadowColor=Color.fromHexString("#888888").toRGBString();
|
1845
|
-
_353.translate(1,1);
|
1846
|
-
_353.beginPath();
|
1847
|
-
_353.moveTo(_356,_357);
|
1848
|
-
_353.arc(_356,_357,_358+2,0,Math.PI*2,false);
|
1849
|
-
_353.closePath();
|
1850
|
-
_353.fill();
|
1851
|
-
_353.restore();
|
1852
|
-
}
|
1853
|
-
_353.save();
|
1854
|
-
_353.strokeStyle=Color.whiteColor().toRGBString();
|
1855
|
-
_353.lineWidth=2;
|
1856
|
-
for(var i=0;i<_355.length;i++){
|
1857
|
-
var _360=this.options.colorScheme[i%_354];
|
1858
|
-
_353.fillStyle=_360.toRGBString();
|
1859
|
-
var _361=function(){
|
1860
|
-
_353.beginPath();
|
1861
|
-
_353.moveTo(_356,_357);
|
1862
|
-
_353.arc(_356,_357,_358,_355[i].startAngle-Math.PI/2,_355[i].endAngle-Math.PI/2,false);
|
1863
|
-
_353.lineTo(_356,_357);
|
1864
|
-
_353.closePath();
|
1865
|
-
};
|
1866
|
-
if(Math.abs(_355[i].startAngle-_355[i].endAngle)>0.0001){
|
1867
|
-
if(this.options.shouldFill){
|
1868
|
-
_361();
|
1869
|
-
_353.fill();
|
1870
|
-
}
|
1871
|
-
if(this.options.shouldStroke){
|
1872
|
-
_361();
|
1873
|
-
_353.stroke();
|
1874
|
-
}
|
1875
|
-
}
|
1876
|
-
}
|
1877
|
-
_353.restore();
|
1878
|
-
};
|
1879
|
-
PlotKit.SweetCanvasRenderer.prototype._renderBackground=function(){
|
1880
|
-
var _362=this.element.getContext("2d");
|
1881
|
-
if(this.layout.style=="bar"||this.layout.style=="line"){
|
1882
|
-
_362.save();
|
1883
|
-
_362.fillStyle=this.options.backgroundColor.toRGBString();
|
1884
|
-
_362.fillRect(this.area.x,this.area.y,this.area.w,this.area.h);
|
1885
|
-
_362.strokeStyle=this.options.axisLineColor.toRGBString();
|
1886
|
-
_362.lineWidth=1;
|
1887
|
-
var _363=this.layout.yticks;
|
1888
|
-
var _364=false;
|
1889
|
-
if(this.layout.style=="bar"&&this.layout.options.barOrientation=="horizontal"){
|
1890
|
-
_363=this.layout.xticks;
|
1891
|
-
_364=true;
|
1892
|
-
}
|
1893
|
-
for(var i=0;i<_363.length;i++){
|
1894
|
-
var x1=0;
|
1895
|
-
var y1=0;
|
1896
|
-
var x2=0;
|
1897
|
-
var y2=0;
|
1898
|
-
if(_364){
|
1899
|
-
x1=_363[i][0]*this.area.w+this.area.x;
|
1900
|
-
y1=this.area.y;
|
1901
|
-
x2=x1;
|
1902
|
-
y2=y1+this.area.h;
|
1903
|
-
}else{
|
1904
|
-
x1=this.area.x;
|
1905
|
-
y1=_363[i][0]*this.area.h+this.area.y;
|
1906
|
-
x2=x1+this.area.w;
|
1907
|
-
y2=y1;
|
1908
|
-
}
|
1909
|
-
_362.beginPath();
|
1910
|
-
_362.moveTo(x1,y1);
|
1911
|
-
_362.lineTo(x2,y2);
|
1912
|
-
_362.closePath();
|
1913
|
-
_362.stroke();
|
1914
|
-
}
|
1915
|
-
_362.restore();
|
1916
|
-
}else{
|
1917
|
-
PlotKit.SweetCanvasRenderer.__super__._renderBackground.call(this);
|
1918
|
-
}
|
1919
|
-
};
|
1920
|
-
PlotKit.SweetCanvas={};
|
1921
|
-
PlotKit.SweetCanvas.SweetCanvasRenderer=PlotKit.SweetCanvasRenderer;
|
1922
|
-
PlotKit.SweetCanvas.EXPORT=["SweetCanvasRenderer"];
|
1923
|
-
PlotKit.SweetCanvas.EXPORT_OK=["SweetCanvasRenderer"];
|
1924
|
-
PlotKit.SweetCanvas.__new__=function(){
|
1925
|
-
var m=MochiKit.Base;
|
1926
|
-
m.nameFunctions(this);
|
1927
|
-
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
|
1928
|
-
};
|
1929
|
-
PlotKit.SweetCanvas.__new__();
|
1930
|
-
MochiKit.Base._exportSymbols(this,PlotKit.SweetCanvas);
|
1931
|
-
try{
|
1932
|
-
if(typeof (PlotKit.SVGRenderer)=="undefined"){
|
1933
|
-
throw "";
|
1934
|
-
}
|
1935
|
-
}
|
1936
|
-
catch(e){
|
1937
|
-
throw "SweetSVG depends on MochiKit.{Base,Color,DOM,Format} and PlotKit.{Layout, SVG}";
|
1938
|
-
}
|
1939
|
-
if(typeof (PlotKit.SweetSVGRenderer)=="undefined"){
|
1940
|
-
PlotKit.SweetSVGRenderer={};
|
1941
|
-
}
|
1942
|
-
PlotKit.SweetSVGRenderer=function(_365,_366,_367){
|
1943
|
-
if(arguments.length>0){
|
1944
|
-
this.__init__(_365,_366,_367);
|
1945
|
-
}
|
1946
|
-
};
|
1947
|
-
PlotKit.SweetSVGRenderer.NAME="PlotKit.SweetSVGRenderer";
|
1948
|
-
PlotKit.SweetSVGRenderer.VERSION=PlotKit.VERSION;
|
1949
|
-
PlotKit.SweetSVGRenderer.__repr__=function(){
|
1950
|
-
return "["+this.NAME+" "+this.VERSION+"]";
|
1951
|
-
};
|
1952
|
-
PlotKit.SweetSVGRenderer.toString=function(){
|
1953
|
-
return this.__repr__();
|
1954
|
-
};
|
1955
|
-
PlotKit.SweetSVGRenderer.prototype=new PlotKit.SVGRenderer();
|
1956
|
-
PlotKit.SweetSVGRenderer.prototype.constructor=PlotKit.SweetSVGRenderer;
|
1957
|
-
PlotKit.SweetSVGRenderer.__super__=PlotKit.SVGRenderer.prototype;
|
1958
|
-
PlotKit.SweetSVGRenderer.prototype.__init__=function(_368,_369,_370){
|
1959
|
-
var _371=PlotKit.Base.officeBlue();
|
1960
|
-
MochiKit.Base.update(_371,_370);
|
1961
|
-
PlotKit.SweetSVGRenderer.__super__.__init__.call(this,_368,_369,_371);
|
1962
|
-
};
|
1963
|
-
PlotKit.SweetSVGRenderer.prototype._addDropShadowFilter=function(){
|
1964
|
-
var _372=this.createSVGElement("filter",{x:0,y:0,"id":"dropShadow"});
|
1965
|
-
var _373=this.createSVGElement("feOffset",{"in":"SourceGraphic","dx":0,"dy":0,"result":"topCopy"});
|
1966
|
-
var blur=this.createSVGElement("feGaussianBlur",{"in":"SourceAlpha","StdDeviation":2,"result":"shadow"});
|
1967
|
-
var _375=this.createSVGElement("feOffset",{"in":"shadow","dx":-1,"dy":-2,"result":"movedShadow"});
|
1968
|
-
var _376=this.createSVGElement("feMerge");
|
1969
|
-
var _377=this.createSVGElement("feMergeNode",{"in":"topCopy"});
|
1970
|
-
var _378=this.createSVGElement("feMergeNode",{"in":"movedShadow"});
|
1971
|
-
_376.appendChild(_377);
|
1972
|
-
_376.appendChild(_378);
|
1973
|
-
_372.appendChild(_373);
|
1974
|
-
_372.appendChild(blur);
|
1975
|
-
_372.appendChild(_375);
|
1976
|
-
_372.appendChild(_376);
|
1977
|
-
this.defs.appendChild(_372);
|
1978
|
-
};
|
1979
|
-
PlotKit.SweetSVGRenderer.prototype._renderBarChart=function(){
|
1980
|
-
var bind=MochiKit.Base.bind;
|
1981
|
-
var _379=Color.blackColor().toRGBString();
|
1982
|
-
var _380="fill:"+_379+";fill-opacity:0.15";
|
1983
|
-
var _381="stroke-width: 2.0; stroke:"+Color.whiteColor().toRGBString();
|
1984
|
-
var _382=function(_383,bar){
|
1985
|
-
var x=this.area.w*bar.x+this.area.x;
|
1986
|
-
var y=this.area.h*bar.y+this.area.y;
|
1987
|
-
var w=this.area.w*bar.w;
|
1988
|
-
var h=this.area.h*bar.h;
|
1989
|
-
if((w<1)||(h<1)){
|
1990
|
-
return;
|
1991
|
-
}
|
1992
|
-
_383["style"]=_381;
|
1993
|
-
this._drawRect(x-2,y-1,w+4,h+2,{"style":_380});
|
1994
|
-
this._drawRect(x,y,w,h,_383);
|
1995
|
-
};
|
1996
|
-
this._renderBarOrLine(this.layout.bars,bind(_382,this));
|
1997
|
-
};
|
1998
|
-
PlotKit.SweetSVGRenderer.prototype._renderLineChart=function(){
|
1999
|
-
var bind=MochiKit.Base.bind;
|
2000
|
-
var _384=Color.blackColor().toRGBString();
|
2001
|
-
var _385="fill:"+_384+";fill-opacity:0.15";
|
2002
|
-
var _386="stroke-width: 2.0; stroke:"+Color.whiteColor().toRGBString();
|
2003
|
-
var _387=function(_388,_389){
|
2004
|
-
this._tempPointsBuffer+=(this.area.w*_389.x+this.area.x)+","+(this.area.h*_389.y+this.area.y)+" ";
|
2005
|
-
};
|
2006
|
-
var _390=function(_391){
|
2007
|
-
this._tempPointsBuffer="";
|
2008
|
-
this._tempPointsBuffer+=(this.area.x)+","+(this.area.y+this.area.h)+" ";
|
2009
|
-
};
|
2010
|
-
var _392=function(_393){
|
2011
|
-
this._tempPointsBuffer+=(this.area.w+this.area.x)+","+(this.area.h+this.area.y);
|
2012
|
-
_393["points"]=this._tempPointsBuffer;
|
2013
|
-
_393["stroke"]="none";
|
2014
|
-
_393["transform"]="translate(-2, -1)";
|
2015
|
-
_393["style"]=_385;
|
2016
|
-
var _394=this.createSVGElement("polygon",_393);
|
2017
|
-
this.root.appendChild(_394);
|
2018
|
-
_393["transform"]="";
|
2019
|
-
_393["style"]=_386;
|
2020
|
-
var elem=this.createSVGElement("polygon",_393);
|
2021
|
-
this.root.appendChild(elem);
|
2022
|
-
};
|
2023
|
-
this._renderBarOrLine(this.layout.points,bind(_387,this),bind(_390,this),bind(_392,this));
|
2024
|
-
};
|
2025
|
-
PlotKit.SweetSVGRenderer.prototype._renderPieChart=function(){
|
2026
|
-
var _395=this.area.x+this.area.w*0.5;
|
2027
|
-
var _396=this.area.y+this.area.h*0.5;
|
2028
|
-
var _397=Color.blackColor().toRGBString();
|
2029
|
-
var _398=Math.min(this.area.w*this.options.pieRadius,this.area.h*this.options.pieRadius);
|
2030
|
-
var _399="fill:"+_397+";fill-opacity:0.15";
|
2031
|
-
var _400=this.createSVGElement("circle",{"style":_399,"cx":_395+1,"cy":_396+1,"r":_398+1});
|
2032
|
-
this.root.appendChild(_400);
|
2033
|
-
PlotKit.SweetSVGRenderer.__super__._renderPieChart.call(this);
|
2034
|
-
};
|
2035
|
-
PlotKit.SweetSVGRenderer.prototype._renderBackground=function(){
|
2036
|
-
var _401={"fill":this.options.backgroundColor.toRGBString(),"stroke":"none"};
|
2037
|
-
if(this.layout.style=="bar"||this.layout.style=="line"){
|
2038
|
-
this._drawRect(this.area.x,this.area.y,this.area.w,this.area.h,_401);
|
2039
|
-
var _402=this.layout.yticks;
|
2040
|
-
var _403=false;
|
2041
|
-
if(this.layout.style=="bar"&&this.layout.options.barOrientation=="horizontal"){
|
2042
|
-
_402=this.layout.xticks;
|
2043
|
-
_403=true;
|
2044
|
-
}
|
2045
|
-
for(var i=0;i<_402.length;i++){
|
2046
|
-
var x=0;
|
2047
|
-
var y=0;
|
2048
|
-
var w=0;
|
2049
|
-
var h=0;
|
2050
|
-
if(_403){
|
2051
|
-
x=_402[i][0]*this.area.w+this.area.x;
|
2052
|
-
y=this.area.y;
|
2053
|
-
w=1;
|
2054
|
-
h=this.area.w;
|
2055
|
-
}else{
|
2056
|
-
x=this.area.x;
|
2057
|
-
y=_402[i][0]*this.area.h+this.area.y;
|
2058
|
-
w=this.area.w;
|
2059
|
-
h=1;
|
2060
|
-
}
|
2061
|
-
this._drawRect(x,y,w,h,{"fill":this.options.axisLineColor.toRGBString()});
|
2062
|
-
}
|
2063
|
-
}else{
|
2064
|
-
PlotKit.SweetSVGRenderer.__super__._renderBackground.call(this);
|
2065
|
-
}
|
2066
|
-
};
|
2067
|
-
PlotKit.SweetSVG={};
|
2068
|
-
PlotKit.SweetSVG.SweetSVGRenderer=PlotKit.SweetSVGRenderer;
|
2069
|
-
PlotKit.SweetSVG.EXPORT=["SweetSVGRenderer"];
|
2070
|
-
PlotKit.SweetSVG.EXPORT_OK=["SweetSVGRenderer"];
|
2071
|
-
PlotKit.SweetSVG.__new__=function(){
|
2072
|
-
var m=MochiKit.Base;
|
2073
|
-
m.nameFunctions(this);
|
2074
|
-
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
|
2075
|
-
};
|
2076
|
-
PlotKit.SweetSVG.__new__();
|
2077
|
-
MochiKit.Base._exportSymbols(this,PlotKit.SweetSVG);
|
2078
|
-
try{
|
2079
|
-
if(typeof (PlotKit.CanvasRenderer)=="undefined"){
|
2080
|
-
throw "";
|
2081
|
-
}
|
2082
|
-
}
|
2083
|
-
catch(e){
|
2084
|
-
throw "PlotKit.EasyPlot depends on all of PlotKit's components";
|
2085
|
-
}
|
2086
|
-
if(typeof (PlotKit.EasyPlot)=="undefined"){
|
2087
|
-
PlotKit.EasyPlot={};
|
2088
|
-
}
|
2089
|
-
PlotKit.EasyPlot.NAME="PlotKit.EasyPlot";
|
2090
|
-
PlotKit.EasyPlot.VERSION=PlotKit.VERSION;
|
2091
|
-
PlotKit.EasyPlot.__repr__=function(){
|
2092
|
-
return "["+this.NAME+" "+this.VERSION+"]";
|
2093
|
-
};
|
2094
|
-
PlotKit.EasyPlot.toString=function(){
|
2095
|
-
return this.__repr__();
|
2096
|
-
};
|
2097
|
-
PlotKit.EasyPlot=function(_404,_405,_406,_407){
|
2098
|
-
this.layout=new Layout(_404,_405);
|
2099
|
-
this.divElem=_406;
|
2100
|
-
this.width=parseInt(_406.getAttribute("width"));
|
2101
|
-
this.height=parseInt(_406.getAttribute("height"));
|
2102
|
-
this.deferredCount=0;
|
2103
|
-
if(this.width<1){
|
2104
|
-
this.width=this.divElem.width?this.divElem.width:300;
|
2105
|
-
}
|
2106
|
-
if(this.height<1){
|
2107
|
-
this.height=this.divElem.height?this.divElem.height:300;
|
2108
|
-
}
|
2109
|
-
if(isArrayLike(_407)){
|
2110
|
-
for(var i=0;i<_407.length;i++){
|
2111
|
-
if(typeof (_407[i])=="string"){
|
2112
|
-
this.deferredCount++;
|
2113
|
-
var d=MochiKit.Async.doSimpleXMLHttpRequest(_407[i]);
|
2114
|
-
d.addCallback(MochiKit.Base.bind(PlotKit.EasyPlot.onDataLoaded,this));
|
2115
|
-
}else{
|
2116
|
-
if(isArrayLike(_407[i])){
|
2117
|
-
this.layout.addDataset("data-"+i,_407[i]);
|
2118
|
-
}
|
2119
|
-
}
|
2120
|
-
}
|
2121
|
-
}else{
|
2122
|
-
if(!isUndefinedOrNull(_407)){
|
2123
|
-
throw "Passed datasources are not Array like";
|
2124
|
-
}
|
2125
|
-
}
|
2126
|
-
if(CanvasRenderer.isSupported()){
|
2127
|
-
this.element=CANVAS({"id":this.divElem.getAttribute("id")+"-canvas","width":this.width,"height":this.height},"");
|
2128
|
-
this.divElem.appendChild(this.element);
|
2129
|
-
this.renderer=new SweetCanvasRenderer(this.element,this.layout,_405);
|
2130
|
-
}else{
|
2131
|
-
if(SVGRenderer.isSupported()){
|
2132
|
-
this.element=SVGRenderer.SVG({"id":this.divElem.getAttribute("id")+"-svg","width":this.width,"height":this.height,"version":"1.1","baseProfile":"full"},"");
|
2133
|
-
this.divElem.appendChild(this.element);
|
2134
|
-
this.renderer=new SweetSVGRenderer(this.element,this.layout,_405);
|
2135
|
-
}
|
2136
|
-
}
|
2137
|
-
if((this.deferredCount==0)&&(PlotKit.Base.keys(this.layout.datasets).length>0)){
|
2138
|
-
this.layout.evaluate();
|
2139
|
-
this.renderer.clear();
|
2140
|
-
this.renderer.render();
|
2141
|
-
}
|
2142
|
-
};
|
2143
|
-
PlotKit.EasyPlot.onDataLoaded=function(_409){
|
2144
|
-
var _410=new Array();
|
2145
|
-
var _411=_409.responseText.split("\n");
|
2146
|
-
for(var i=0;i<_411.length;i++){
|
2147
|
-
var _412=MochiKit.Format.strip(_411[i]);
|
2148
|
-
if((_412.length>1)&&(_412.charAt(0)!="#")){
|
2149
|
-
_410.push(_412.split(","));
|
2150
|
-
}
|
2151
|
-
}
|
2152
|
-
this.layout.addDataset("data-ajax-"+this.deferredCount,_410);
|
2153
|
-
this.deferredCount--;
|
2154
|
-
if((this.deferredCount==0)&&(PlotKit.Base.keys(this.layout.datasets).length>0)){
|
2155
|
-
this.layout.evaluate();
|
2156
|
-
this.renderer.clear();
|
2157
|
-
this.renderer.render();
|
2158
|
-
}
|
2159
|
-
};
|
2160
|
-
PlotKit.EasyPlot.prototype.reload=function(){
|
2161
|
-
this.layout.evaluate();
|
2162
|
-
this.renderer.clear();
|
2163
|
-
this.renderer.render();
|
2164
|
-
};
|
2165
|
-
PlotKit.EasyPlotModule={};
|
2166
|
-
PlotKit.EasyPlotModule.EasyPlot=PlotKit.EasyPlot;
|
2167
|
-
PlotKit.EasyPlotModule.EXPORT=["EasyPlot"];
|
2168
|
-
PlotKit.EasyPlotModule.EXPORT_OK=[];
|
2169
|
-
PlotKit.EasyPlotModule.__new__=function(){
|
2170
|
-
var m=MochiKit.Base;
|
2171
|
-
m.nameFunctions(this);
|
2172
|
-
this.EXPORT_TAGS={":common":this.EXPORT,":all":m.concat(this.EXPORT,this.EXPORT_OK)};
|
2173
|
-
};
|
2174
|
-
PlotKit.EasyPlotModule.__new__();
|
2175
|
-
MochiKit.Base._exportSymbols(this,PlotKit.EasyPlotModule);
|
2176
|
-
|
2177
|
-
|