rhoconnect 3.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +208 -0
- data/CREDITS +38 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +97 -0
- data/LICENSE +75 -0
- data/README.md +10 -0
- data/Rakefile +82 -0
- data/bench/bench +7 -0
- data/bench/bench_runner.rb +112 -0
- data/bench/benchapp/Gemfile +21 -0
- data/bench/benchapp/Gemfile.lock +76 -0
- data/bench/benchapp/Rakefile +22 -0
- data/bench/benchapp/application.rb +39 -0
- data/bench/benchapp/config.ru +36 -0
- data/bench/benchapp/settings/license.key +1 -0
- data/bench/benchapp/settings/settings.yml +20 -0
- data/bench/benchapp/sources/mock_adapter.rb +55 -0
- data/bench/benchapp/sources/queue_mock_adapter.rb +2 -0
- data/bench/benchapp/spec/sources/mock_adapter_spec.rb +25 -0
- data/bench/benchapp/spec/sources/queue_mock_adapter_spec.rb +25 -0
- data/bench/benchapp/spec/spec_helper.rb +42 -0
- data/bench/blobapp/Gemfile +31 -0
- data/bench/blobapp/Gemfile.lock +103 -0
- data/bench/blobapp/Rakefile +25 -0
- data/bench/blobapp/application.rb +44 -0
- data/bench/blobapp/config.ru +36 -0
- data/bench/blobapp/settings/license.key +1 -0
- data/bench/blobapp/settings/settings.yml +16 -0
- data/bench/blobapp/sources/blob_adapter.rb +71 -0
- data/bench/blobapp/spec/sources/blob_adapter_spec.rb +25 -0
- data/bench/blobapp/spec/spec_helper.rb +42 -0
- data/bench/lib/bench/cli.rb +16 -0
- data/bench/lib/bench/logging.rb +13 -0
- data/bench/lib/bench/mock_client.rb +41 -0
- data/bench/lib/bench/result.rb +50 -0
- data/bench/lib/bench/runner.rb +107 -0
- data/bench/lib/bench/session.rb +67 -0
- data/bench/lib/bench/statistics.rb +56 -0
- data/bench/lib/bench/test_data.rb +98 -0
- data/bench/lib/bench/timer.rb +10 -0
- data/bench/lib/bench/utils.rb +49 -0
- data/bench/lib/bench.rb +129 -0
- data/bench/lib/testdata/100-data.txt +148 -0
- data/bench/lib/testdata/5-data.txt +9 -0
- data/bench/lib/testdata/images/icon.ico +0 -0
- data/bench/lib/testdata/images/icon.png +0 -0
- data/bench/lib/testdata/images/loading-Landscape.png +0 -0
- data/bench/lib/testdata/images/loading-LandscapeLeft.png +0 -0
- data/bench/lib/testdata/images/loading-LandscapeRight.png +0 -0
- data/bench/lib/testdata/images/loading-Portrait.png +0 -0
- data/bench/lib/testdata/images/loading-PortraitUpsideDown.png +0 -0
- data/bench/lib/testdata/images/loading.png +0 -0
- data/bench/lib/testdata/images/loading@2x.png +0 -0
- data/bench/run_bench.sh +42 -0
- data/bench/run_blob_script.sh +3 -0
- data/bench/run_cud_script.sh +3 -0
- data/bench/run_query_md_script.sh +3 -0
- data/bench/run_query_only_script.sh +3 -0
- data/bench/run_query_script.sh +3 -0
- data/bench/scripts/blob_cud_script.rb +98 -0
- data/bench/scripts/cud_script.rb +92 -0
- data/bench/scripts/helpers.rb +101 -0
- data/bench/scripts/query_md_script.rb +45 -0
- data/bench/scripts/query_only_script.rb +51 -0
- data/bench/scripts/query_script.rb +45 -0
- data/bench/spec/bench_spec_helper.rb +33 -0
- data/bench/spec/logging_spec.rb +15 -0
- data/bench/spec/mock_adapter_spec.rb +61 -0
- data/bench/spec/mock_client_spec.rb +65 -0
- data/bench/spec/result_spec.rb +61 -0
- data/bench/spec/utils_spec.rb +36 -0
- data/bin/rhoconnect +34 -0
- data/bin/rhoconnect-setup +84 -0
- data/doc/async-jobs.txt +69 -0
- data/doc/authentication.txt +76 -0
- data/doc/benchmarks.txt +168 -0
- data/doc/blob-sync.txt +130 -0
- data/doc/bulk-sync.txt +102 -0
- data/doc/client.txt +432 -0
- data/doc/command-line.txt +210 -0
- data/doc/contributing.txt +60 -0
- data/doc/deploying.txt +82 -0
- data/doc/install.txt +28 -0
- data/doc/introduction.txt +20 -0
- data/doc/licensing.txt +18 -0
- data/doc/metadata.txt +458 -0
- data/doc/migration.txt +182 -0
- data/doc/public/css/print.css +29 -0
- data/doc/public/css/screen.css +257 -0
- data/doc/public/css/style.css +20 -0
- data/doc/push.txt +135 -0
- data/doc/release.txt +41 -0
- data/doc/rest-api.txt +367 -0
- data/doc/source-adapters.txt +325 -0
- data/doc/stats-middleware.txt +69 -0
- data/doc/testing.txt +222 -0
- data/doc/tutorial.txt +315 -0
- data/doc/web-console.txt +35 -0
- data/examples/simple/Rakefile +14 -0
- data/examples/simple/application.rb +27 -0
- data/examples/simple/config.ru +49 -0
- data/examples/simple/settings/license.key +1 -0
- data/examples/simple/settings/settings.yml +23 -0
- data/examples/simple/sources/sample_adapter.rb +5 -0
- data/examples/simple/sources/simple_adapter.rb +5 -0
- data/generators/rhoconnect.rb +119 -0
- data/generators/templates/application/Gemfile +21 -0
- data/generators/templates/application/Rakefile +22 -0
- data/generators/templates/application/application.rb +39 -0
- data/generators/templates/application/config.ru +36 -0
- data/generators/templates/application/settings/license.key +1 -0
- data/generators/templates/application/settings/settings.yml +14 -0
- data/generators/templates/application/spec/spec_helper.rb +42 -0
- data/generators/templates/source/source_adapter.rb +47 -0
- data/generators/templates/source/source_spec.rb +25 -0
- data/install.sh +408 -0
- data/installer/unix-like/rho_connect_install_checkers.rb +140 -0
- data/installer/unix-like/rho_connect_install_constants.rb +51 -0
- data/installer/unix-like/rho_connect_install_debian.rb +63 -0
- data/installer/unix-like/rho_connect_install_dnd.rb +58 -0
- data/installer/unix-like/rho_connect_install_get_params.rb +30 -0
- data/installer/unix-like/rho_connect_install_installers.rb +142 -0
- data/installer/unix-like/rho_connect_install_utilities.rb +85 -0
- data/installer/unix-like/rho_connect_install_yum.rb +63 -0
- data/installer/unix-like/rhoinstaller.rb +89 -0
- data/installer/utils/create_texts.rb +366 -0
- data/installer/utils/install_test.rb +140 -0
- data/installer/windows/EnvVarUpdate.nsh +328 -0
- data/installer/windows/ServiceLib.nsh +369 -0
- data/installer/windows/configUi.ini +44 -0
- data/installer/windows/icon.ico +0 -0
- data/installer/windows/rhosync.nsi +418 -0
- data/installer/windows/uninstall.bat +7 -0
- data/lib/rhoconnect/api/admin/get_api_token.rb +14 -0
- data/lib/rhoconnect/api/admin/get_license_info.rb +8 -0
- data/lib/rhoconnect/api/admin/login.rb +6 -0
- data/lib/rhoconnect/api/admin/reset.rb +10 -0
- data/lib/rhoconnect/api/admin/stats.rb +21 -0
- data/lib/rhoconnect/api/application/bulk_data.rb +7 -0
- data/lib/rhoconnect/api/application/clientcreate.rb +8 -0
- data/lib/rhoconnect/api/application/clientlogin.rb +6 -0
- data/lib/rhoconnect/api/application/clientregister.rb +6 -0
- data/lib/rhoconnect/api/application/clientreset.rb +6 -0
- data/lib/rhoconnect/api/application/query.rb +7 -0
- data/lib/rhoconnect/api/application/queue_updates.rb +6 -0
- data/lib/rhoconnect/api/application/search.rb +6 -0
- data/lib/rhoconnect/api/client/create_client.rb +3 -0
- data/lib/rhoconnect/api/client/delete_client.rb +5 -0
- data/lib/rhoconnect/api/client/get_client_params.rb +3 -0
- data/lib/rhoconnect/api/client/list_client_docs.rb +12 -0
- data/lib/rhoconnect/api/client/list_clients.rb +3 -0
- data/lib/rhoconnect/api/client/ping.rb +7 -0
- data/lib/rhoconnect/api/source/get_adapter.rb +3 -0
- data/lib/rhoconnect/api/source/get_db_doc.rb +7 -0
- data/lib/rhoconnect/api/source/get_source_params.rb +3 -0
- data/lib/rhoconnect/api/source/list_source_docs.rb +10 -0
- data/lib/rhoconnect/api/source/list_sources.rb +15 -0
- data/lib/rhoconnect/api/source/push_deletes.rb +8 -0
- data/lib/rhoconnect/api/source/push_objects.rb +8 -0
- data/lib/rhoconnect/api/source/save_adapter.rb +3 -0
- data/lib/rhoconnect/api/source/set_db_doc.rb +8 -0
- data/lib/rhoconnect/api/source/set_refresh_time.rb +8 -0
- data/lib/rhoconnect/api/source/upload_file.rb +4 -0
- data/lib/rhoconnect/api/user/create_user.rb +7 -0
- data/lib/rhoconnect/api/user/delete_user.rb +9 -0
- data/lib/rhoconnect/api/user/list_users.rb +3 -0
- data/lib/rhoconnect/api/user/update_user.rb +4 -0
- data/lib/rhoconnect/api_token.rb +19 -0
- data/lib/rhoconnect/app.rb +76 -0
- data/lib/rhoconnect/bulk_data/bulk_data.rb +88 -0
- data/lib/rhoconnect/bulk_data/syncdb.index.schema +4 -0
- data/lib/rhoconnect/bulk_data/syncdb.schema +41 -0
- data/lib/rhoconnect/bulk_data.rb +2 -0
- data/lib/rhoconnect/client.rb +96 -0
- data/lib/rhoconnect/client_sync.rb +412 -0
- data/lib/rhoconnect/console/app/helpers/auth_helper.rb +22 -0
- data/lib/rhoconnect/console/app/helpers/extensions.rb +19 -0
- data/lib/rhoconnect/console/app/helpers/helpers.rb +57 -0
- data/lib/rhoconnect/console/app/public/ThickBox.css +649 -0
- data/lib/rhoconnect/console/app/public/home.css +438 -0
- data/lib/rhoconnect/console/app/public/images/foot_logo_rhoconnect.png +0 -0
- data/lib/rhoconnect/console/app/public/images/header_halo.jpg +0 -0
- data/lib/rhoconnect/console/app/public/images/land_separator.gif +0 -0
- data/lib/rhoconnect/console/app/public/images/landing_header.jpg +0 -0
- data/lib/rhoconnect/console/app/public/images/logo_rhoconnect.png +0 -0
- data/lib/rhoconnect/console/app/public/images/rhomobile_rhohub_logo.png +0 -0
- data/lib/rhoconnect/console/app/public/images/tabs_separator.png +0 -0
- data/lib/rhoconnect/console/app/public/jqplot/excanvas.min.js +35 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.barRenderer.min.js +34 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasAxisLabelRenderer.js +187 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasAxisTickRenderer.js +226 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasTextRenderer.js +408 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.categoryAxisRenderer.min.js +34 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.cursor.js +952 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.dateAxisRenderer.js +313 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.dateAxisRenderer.min.js +34 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.pointLabels.min.js +34 -0
- data/lib/rhoconnect/console/app/public/jqplot/jquery-1.4.2.min.js +154 -0
- data/lib/rhoconnect/console/app/public/jqplot/jquery.jqplot.min.css +1 -0
- data/lib/rhoconnect/console/app/public/jqplot/jquery.jqplot.min.js +34 -0
- data/lib/rhoconnect/console/app/public/main.css +7 -0
- data/lib/rhoconnect/console/app/public/reset.css +76 -0
- data/lib/rhoconnect/console/app/public/style.css +2201 -0
- data/lib/rhoconnect/console/app/public/text.txt +0 -0
- data/lib/rhoconnect/console/app/routes/adapter.rb +28 -0
- data/lib/rhoconnect/console/app/routes/auth.rb +29 -0
- data/lib/rhoconnect/console/app/routes/client.rb +31 -0
- data/lib/rhoconnect/console/app/routes/docs.rb +145 -0
- data/lib/rhoconnect/console/app/routes/heroku.rb +19 -0
- data/lib/rhoconnect/console/app/routes/home.rb +63 -0
- data/lib/rhoconnect/console/app/routes/timing.rb +242 -0
- data/lib/rhoconnect/console/app/routes/user.rb +117 -0
- data/lib/rhoconnect/console/app/views/adapter.erb +16 -0
- data/lib/rhoconnect/console/app/views/client.erb +30 -0
- data/lib/rhoconnect/console/app/views/content.erb +14 -0
- data/lib/rhoconnect/console/app/views/doc.erb +8 -0
- data/lib/rhoconnect/console/app/views/docdata.erb +28 -0
- data/lib/rhoconnect/console/app/views/docs.erb +30 -0
- data/lib/rhoconnect/console/app/views/edituser.erb +13 -0
- data/lib/rhoconnect/console/app/views/headermenu.erb +40 -0
- data/lib/rhoconnect/console/app/views/home.erb +24 -0
- data/lib/rhoconnect/console/app/views/index.erb +58 -0
- data/lib/rhoconnect/console/app/views/jqplot.erb +52 -0
- data/lib/rhoconnect/console/app/views/layout.erb +165 -0
- data/lib/rhoconnect/console/app/views/login.erb +26 -0
- data/lib/rhoconnect/console/app/views/newuser.erb +17 -0
- data/lib/rhoconnect/console/app/views/ping.erb +28 -0
- data/lib/rhoconnect/console/app/views/result.erb +11 -0
- data/lib/rhoconnect/console/app/views/rightboxlinks.erb +15 -0
- data/lib/rhoconnect/console/app/views/select_doc.erb +17 -0
- data/lib/rhoconnect/console/app/views/upload_doc.erb +23 -0
- data/lib/rhoconnect/console/app/views/user.erb +29 -0
- data/lib/rhoconnect/console/app/views/users.erb +12 -0
- data/lib/rhoconnect/console/rhoconnect_api.rb +245 -0
- data/lib/rhoconnect/console/server.rb +32 -0
- data/lib/rhoconnect/console.rb +3 -0
- data/lib/rhoconnect/cors.rb +229 -0
- data/lib/rhoconnect/credential.rb +9 -0
- data/lib/rhoconnect/db_adapter.rb +46 -0
- data/lib/rhoconnect/document.rb +49 -0
- data/lib/rhoconnect/dynamic_adapter.rb +91 -0
- data/lib/rhoconnect/generator.rb +1 -0
- data/lib/rhoconnect/jobs/bulk_data_job.rb +203 -0
- data/lib/rhoconnect/jobs/ping_job.rb +46 -0
- data/lib/rhoconnect/jobs/source_job.rb +16 -0
- data/lib/rhoconnect/license.rb +86 -0
- data/lib/rhoconnect/lock_ops.rb +11 -0
- data/lib/rhoconnect/model.rb +414 -0
- data/lib/rhoconnect/ping/android.rb +56 -0
- data/lib/rhoconnect/ping/apple.rb +52 -0
- data/lib/rhoconnect/ping/blackberry.rb +56 -0
- data/lib/rhoconnect/ping.rb +3 -0
- data/lib/rhoconnect/read_state.rb +31 -0
- data/lib/rhoconnect/rho_indifferent_access.rb +88 -0
- data/lib/rhoconnect/server/views/index.erb +13 -0
- data/lib/rhoconnect/server.rb +286 -0
- data/lib/rhoconnect/source.rb +289 -0
- data/lib/rhoconnect/source_adapter.rb +123 -0
- data/lib/rhoconnect/source_sync.rb +302 -0
- data/lib/rhoconnect/stats/middleware.rb +20 -0
- data/lib/rhoconnect/stats/record.rb +108 -0
- data/lib/rhoconnect/store.rb +232 -0
- data/lib/rhoconnect/tasks.rb +350 -0
- data/lib/rhoconnect/test_methods.rb +220 -0
- data/lib/rhoconnect/user.rb +95 -0
- data/lib/rhoconnect/version.rb +3 -0
- data/lib/rhoconnect/x_domain_session_wrapper.rb +53 -0
- data/lib/rhoconnect.rb +285 -0
- data/rhoconnect.gemspec +67 -0
- data/spec/api/admin/api_token_spec.rb +14 -0
- data/spec/api/admin/get_api_token_spec.rb +36 -0
- data/spec/api/admin/get_license_info_spec.rb +38 -0
- data/spec/api/admin/reset_spec.rb +22 -0
- data/spec/api/admin/stats_spec.rb +66 -0
- data/spec/api/api_helper.rb +21 -0
- data/spec/api/application/rhoconnect_api_spec.rb +548 -0
- data/spec/api/client/create_client_spec.rb +13 -0
- data/spec/api/client/delete_client_spec.rb +13 -0
- data/spec/api/client/get_client_params_spec.rb +18 -0
- data/spec/api/client/list_client_docs_spec.rb +32 -0
- data/spec/api/client/list_clients_spec.rb +22 -0
- data/spec/api/client/ping_spec.rb +23 -0
- data/spec/api/rhosync_api_spec.rb.orig +606 -0
- data/spec/api/source/adapter_spec.rb +29 -0
- data/spec/api/source/get_db_doc_spec.rb +21 -0
- data/spec/api/source/get_source_params_spec.rb +32 -0
- data/spec/api/source/list_source_docs_spec.rb +25 -0
- data/spec/api/source/list_sources_spec.rb +26 -0
- data/spec/api/source/push_deletes_spec.rb +18 -0
- data/spec/api/source/push_objects_spec.rb +27 -0
- data/spec/api/source/set_db_doc_spec.rb +19 -0
- data/spec/api/source/set_refresh_time_spec.rb +43 -0
- data/spec/api/source/upload_file_spec.rb +26 -0
- data/spec/api/user/create_user_spec.rb +16 -0
- data/spec/api/user/delete_user_spec.rb +36 -0
- data/spec/api/user/list_users_spec.rb +30 -0
- data/spec/api/user/update_user_spec.rb +31 -0
- data/spec/api_token_spec.rb +14 -0
- data/spec/app_spec.rb +18 -0
- data/spec/apps/emptyapp/application.rb +27 -0
- data/spec/apps/emptyapp/settings/license.key +1 -0
- data/spec/apps/emptyapp/settings/settings.yml +14 -0
- data/spec/apps/rhotestapp/Rakefile +1 -0
- data/spec/apps/rhotestapp/application.rb +19 -0
- data/spec/apps/rhotestapp/config.ru +1 -0
- data/spec/apps/rhotestapp/settings/apple_fake_cert.pem +1 -0
- data/spec/apps/rhotestapp/settings/license.key +1 -0
- data/spec/apps/rhotestapp/settings/settings.yml +36 -0
- data/spec/apps/rhotestapp/sources/base_adapter.rb +9 -0
- data/spec/apps/rhotestapp/sources/fixed_schema_adapter.rb +28 -0
- data/spec/apps/rhotestapp/sources/sample_adapter.rb +71 -0
- data/spec/apps/rhotestapp/sources/simple_adapter.rb +41 -0
- data/spec/apps/rhotestapp/sources/sub_adapter.rb +7 -0
- data/spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem/mygem.rb +8 -0
- data/spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem.rb +1 -0
- data/spec/bulk_data/bulk_data_spec.rb +97 -0
- data/spec/client_spec.rb +124 -0
- data/spec/client_sync_spec.rb +774 -0
- data/spec/doc/base.html +72 -0
- data/spec/doc/doc_spec.rb +376 -0
- data/spec/doc/footer.html +4 -0
- data/spec/doc/header.html +30 -0
- data/spec/document_spec.rb +31 -0
- data/spec/dynamic_adapter_spec.rb +43 -0
- data/spec/factories/factories.rb +17 -0
- data/spec/generator/generator_spec.rb +58 -0
- data/spec/generator/generator_spec_helper.rb +9 -0
- data/spec/jobs/bulk_data_job_spec.rb +125 -0
- data/spec/jobs/ping_job_spec.rb +102 -0
- data/spec/jobs/source_job_spec.rb +29 -0
- data/spec/license_spec.rb +66 -0
- data/spec/model_spec.rb +273 -0
- data/spec/perf/bulk_data_perf_spec.rb +32 -0
- data/spec/perf/perf_spec_helper.rb +50 -0
- data/spec/perf/store_perf_spec.rb +27 -0
- data/spec/ping/android_spec.rb +91 -0
- data/spec/ping/apple_spec.rb +70 -0
- data/spec/ping/blackberry_spec.rb +62 -0
- data/spec/read_state_spec.rb +35 -0
- data/spec/rhosync_spec.rb +75 -0
- data/spec/server/cors_spec.rb +287 -0
- data/spec/server/server_spec.rb +470 -0
- data/spec/server/x_domain_session_wrapper_spec.rb +150 -0
- data/spec/source_adapter_spec.rb +125 -0
- data/spec/source_spec.rb +114 -0
- data/spec/source_sync_spec.rb +328 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +231 -0
- data/spec/stats/middleware_spec.rb +53 -0
- data/spec/stats/record_spec.rb +92 -0
- data/spec/store_spec.rb +251 -0
- data/spec/support/shared_examples.rb +168 -0
- data/spec/sync_states_spec.rb +72 -0
- data/spec/test_methods_spec.rb +134 -0
- data/spec/testdata/1000-data.txt +1414 -0
- data/spec/testdata/compressed/compress-data.txt +1 -0
- data/spec/testdata/upload1.txt +1 -0
- data/spec/testdata/upload2.txt +1 -0
- data/spec/user_spec.rb +139 -0
- data/tasks/redis.rake +206 -0
- metadata +706 -0
@@ -0,0 +1,313 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2009 - 2010 Chris Leonello
|
3
|
+
* jqPlot is currently available for use in all personal or commercial projects
|
4
|
+
* under both the MIT and GPL version 2.0 licenses. This means that you can
|
5
|
+
* choose the license that best suits your project and use it accordingly.
|
6
|
+
*
|
7
|
+
* The author would appreciate an email letting him know of any substantial
|
8
|
+
* use of jqPlot. You can reach the author at: chris at jqplot dot com
|
9
|
+
* or see http://www.jqplot.com/info.php . This is, of course,
|
10
|
+
* not required.
|
11
|
+
*
|
12
|
+
* If you are feeling kind and generous, consider supporting the project by
|
13
|
+
* making a donation at: http://www.jqplot.com/donate.php .
|
14
|
+
*
|
15
|
+
* Thanks for using jqPlot!
|
16
|
+
*
|
17
|
+
*/
|
18
|
+
(function($) {
|
19
|
+
/**
|
20
|
+
* Class: $.jqplot.DateAxisRenderer
|
21
|
+
* A plugin for a jqPlot to render an axis as a series of date values.
|
22
|
+
* This renderer has no options beyond those supplied by the <Axis> class.
|
23
|
+
* It supplies it's own tick formatter, so the tickOptions.formatter option
|
24
|
+
* should not be overridden.
|
25
|
+
*
|
26
|
+
* Thanks to Ken Synder for his enhanced Date instance methods which are
|
27
|
+
* included with this code <http://kendsnyder.com/sandbox/date/>.
|
28
|
+
*
|
29
|
+
* To use this renderer, include the plugin in your source
|
30
|
+
* > <script type="text/javascript" language="javascript" src="plugins/jqplot.dateAxisRenderer.js"></script>
|
31
|
+
*
|
32
|
+
* and supply the appropriate options to your plot
|
33
|
+
*
|
34
|
+
* > {axes:{xaxis:{renderer:$.jqplot.DateAxisRenderer}}}
|
35
|
+
*
|
36
|
+
* Dates can be passed into the axis in almost any recognizable value and
|
37
|
+
* will be parsed. They will be rendered on the axis in the format
|
38
|
+
* specified by tickOptions.formatString. e.g. tickOptions.formatString = '%Y-%m-%d'.
|
39
|
+
*
|
40
|
+
* Accecptable format codes
|
41
|
+
* are:
|
42
|
+
*
|
43
|
+
* > Code Result Description
|
44
|
+
* > == Years ==
|
45
|
+
* > %Y 2008 Four-digit year
|
46
|
+
* > %y 08 Two-digit year
|
47
|
+
* > == Months ==
|
48
|
+
* > %m 09 Two-digit month
|
49
|
+
* > %#m 9 One or two-digit month
|
50
|
+
* > %B September Full month name
|
51
|
+
* > %b Sep Abbreviated month name
|
52
|
+
* > == Days ==
|
53
|
+
* > %d 05 Two-digit day of month
|
54
|
+
* > %#d 5 One or two-digit day of month
|
55
|
+
* > %e 5 One or two-digit day of month
|
56
|
+
* > %A Sunday Full name of the day of the week
|
57
|
+
* > %a Sun Abbreviated name of the day of the week
|
58
|
+
* > %w 0 Number of the day of the week (0 = Sunday, 6 = Saturday)
|
59
|
+
* > %o th The ordinal suffix string following the day of the month
|
60
|
+
* > == Hours ==
|
61
|
+
* > %H 23 Hours in 24-hour format (two digits)
|
62
|
+
* > %#H 3 Hours in 24-hour integer format (one or two digits)
|
63
|
+
* > %I 11 Hours in 12-hour format (two digits)
|
64
|
+
* > %#I 3 Hours in 12-hour integer format (one or two digits)
|
65
|
+
* > %p PM AM or PM
|
66
|
+
* > == Minutes ==
|
67
|
+
* > %M 09 Minutes (two digits)
|
68
|
+
* > %#M 9 Minutes (one or two digits)
|
69
|
+
* > == Seconds ==
|
70
|
+
* > %S 02 Seconds (two digits)
|
71
|
+
* > %#S 2 Seconds (one or two digits)
|
72
|
+
* > %s 1206567625723 Unix timestamp (Seconds past 1970-01-01 00:00:00)
|
73
|
+
* > == Milliseconds ==
|
74
|
+
* > %N 008 Milliseconds (three digits)
|
75
|
+
* > %#N 8 Milliseconds (one to three digits)
|
76
|
+
* > == Timezone ==
|
77
|
+
* > %O 360 difference in minutes between local time and GMT
|
78
|
+
* > %Z Mountain Standard Time Name of timezone as reported by browser
|
79
|
+
* > %G -06:00 Hours and minutes between GMT
|
80
|
+
* > == Shortcuts ==
|
81
|
+
* > %F 2008-03-26 %Y-%m-%d
|
82
|
+
* > %T 05:06:30 %H:%M:%S
|
83
|
+
* > %X 05:06:30 %H:%M:%S
|
84
|
+
* > %x 03/26/08 %m/%d/%y
|
85
|
+
* > %D 03/26/08 %m/%d/%y
|
86
|
+
* > %#c Wed Mar 26 15:31:00 2008 %a %b %e %H:%M:%S %Y
|
87
|
+
* > %v 3-Sep-2008 %e-%b-%Y
|
88
|
+
* > %R 15:31 %H:%M
|
89
|
+
* > %r 3:31:00 PM %I:%M:%S %p
|
90
|
+
* > == Characters ==
|
91
|
+
* > %n \n Newline
|
92
|
+
* > %t \t Tab
|
93
|
+
* > %% % Percent Symbol
|
94
|
+
*/
|
95
|
+
$.jqplot.DateAxisRenderer = function() {
|
96
|
+
$.jqplot.LinearAxisRenderer.call(this);
|
97
|
+
};
|
98
|
+
|
99
|
+
$.jqplot.DateAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
|
100
|
+
$.jqplot.DateAxisRenderer.prototype.constructor = $.jqplot.DateAxisRenderer;
|
101
|
+
|
102
|
+
$.jqplot.DateTickFormatter = function(format, val) {
|
103
|
+
if (!format) {
|
104
|
+
format = '%Y/%m/%d';
|
105
|
+
}
|
106
|
+
return Date.create(val).strftime(format);
|
107
|
+
};
|
108
|
+
|
109
|
+
$.jqplot.DateAxisRenderer.prototype.init = function(options){
|
110
|
+
// prop: tickRenderer
|
111
|
+
// A class of a rendering engine for creating the ticks labels displayed on the plot,
|
112
|
+
// See <$.jqplot.AxisTickRenderer>.
|
113
|
+
// this.tickRenderer = $.jqplot.AxisTickRenderer;
|
114
|
+
// this.labelRenderer = $.jqplot.AxisLabelRenderer;
|
115
|
+
this.tickOptions.formatter = $.jqplot.DateTickFormatter;
|
116
|
+
this.daTickInterval = null;
|
117
|
+
this._daTickInterval = null;
|
118
|
+
$.extend(true, this, options);
|
119
|
+
var db = this._dataBounds;
|
120
|
+
// Go through all the series attached to this axis and find
|
121
|
+
// the min/max bounds for this axis.
|
122
|
+
for (var i=0; i<this._series.length; i++) {
|
123
|
+
var s = this._series[i];
|
124
|
+
var d = s.data;
|
125
|
+
var pd = s._plotData;
|
126
|
+
var sd = s._stackData;
|
127
|
+
|
128
|
+
for (var j=0; j<d.length; j++) {
|
129
|
+
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
130
|
+
d[j][0] = Date.create(d[j][0]).getTime();
|
131
|
+
pd[j][0] = Date.create(d[j][0]).getTime();
|
132
|
+
sd[j][0] = Date.create(d[j][0]).getTime();
|
133
|
+
if (d[j][0] < db.min || db.min == null) {
|
134
|
+
db.min = d[j][0];
|
135
|
+
}
|
136
|
+
if (d[j][0] > db.max || db.max == null) {
|
137
|
+
db.max = d[j][0];
|
138
|
+
}
|
139
|
+
}
|
140
|
+
else {
|
141
|
+
d[j][1] = Date.create(d[j][1]).getTime();
|
142
|
+
pd[j][1] = Date.create(d[j][1]).getTime();
|
143
|
+
sd[j][1] = Date.create(d[j][1]).getTime();
|
144
|
+
if (d[j][1] < db.min || db.min == null) {
|
145
|
+
db.min = d[j][1];
|
146
|
+
}
|
147
|
+
if (d[j][1] > db.max || db.max == null) {
|
148
|
+
db.max = d[j][1];
|
149
|
+
}
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
};
|
154
|
+
|
155
|
+
// called with scope of an axis
|
156
|
+
$.jqplot.DateAxisRenderer.prototype.reset = function() {
|
157
|
+
this.min = this._min;
|
158
|
+
this.max = this._max;
|
159
|
+
this.tickInterval = this._tickInterval;
|
160
|
+
this.numberTicks = this._numberTicks;
|
161
|
+
this.daTickInterval = this._daTickInterval;
|
162
|
+
// this._ticks = this.__ticks;
|
163
|
+
};
|
164
|
+
|
165
|
+
$.jqplot.DateAxisRenderer.prototype.createTicks = function() {
|
166
|
+
// we're are operating on an axis here
|
167
|
+
var ticks = this._ticks;
|
168
|
+
var userTicks = this.ticks;
|
169
|
+
var name = this.name;
|
170
|
+
// databounds were set on axis initialization.
|
171
|
+
var db = this._dataBounds;
|
172
|
+
var dim, interval;
|
173
|
+
var min, max;
|
174
|
+
var pos1, pos2;
|
175
|
+
var tt, i;
|
176
|
+
|
177
|
+
// if we already have ticks, use them.
|
178
|
+
// ticks must be in order of increasing value.
|
179
|
+
|
180
|
+
if (userTicks.length) {
|
181
|
+
// ticks could be 1D or 2D array of [val, val, ,,,] or [[val, label], [val, label], ...] or mixed
|
182
|
+
for (i=0; i<userTicks.length; i++){
|
183
|
+
var ut = userTicks[i];
|
184
|
+
var t = new this.tickRenderer(this.tickOptions);
|
185
|
+
if (ut.constructor == Array) {
|
186
|
+
t.value = Date.create(ut[0]).getTime();
|
187
|
+
t.label = ut[1];
|
188
|
+
if (!this.showTicks) {
|
189
|
+
t.showLabel = false;
|
190
|
+
t.showMark = false;
|
191
|
+
}
|
192
|
+
else if (!this.showTickMarks) {
|
193
|
+
t.showMark = false;
|
194
|
+
}
|
195
|
+
t.setTick(t.value, this.name);
|
196
|
+
this._ticks.push(t);
|
197
|
+
}
|
198
|
+
|
199
|
+
else {
|
200
|
+
t.value = Date.create(ut).getTime();
|
201
|
+
if (!this.showTicks) {
|
202
|
+
t.showLabel = false;
|
203
|
+
t.showMark = false;
|
204
|
+
}
|
205
|
+
else if (!this.showTickMarks) {
|
206
|
+
t.showMark = false;
|
207
|
+
}
|
208
|
+
t.setTick(t.value, this.name);
|
209
|
+
this._ticks.push(t);
|
210
|
+
}
|
211
|
+
}
|
212
|
+
this.numberTicks = userTicks.length;
|
213
|
+
this.min = this._ticks[0].value;
|
214
|
+
this.max = this._ticks[this.numberTicks-1].value;
|
215
|
+
this.daTickInterval = [(this.max - this.min) / (this.numberTicks - 1)/1000, 'seconds'];
|
216
|
+
}
|
217
|
+
|
218
|
+
// we don't have any ticks yet, let's make some!
|
219
|
+
else {
|
220
|
+
if (name == 'xaxis' || name == 'x2axis') {
|
221
|
+
dim = this._plotDimensions.width;
|
222
|
+
}
|
223
|
+
else {
|
224
|
+
dim = this._plotDimensions.height;
|
225
|
+
}
|
226
|
+
|
227
|
+
// if min, max and number of ticks specified, user can't specify interval.
|
228
|
+
if (this.min != null && this.max != null && this.numberTicks != null) {
|
229
|
+
this.tickInterval = null;
|
230
|
+
}
|
231
|
+
|
232
|
+
// if user specified a tick interval, convert to usable.
|
233
|
+
if (this.tickInterval != null)
|
234
|
+
{
|
235
|
+
// if interval is a number or can be converted to one, use it.
|
236
|
+
// Assume it is in SECONDS!!!
|
237
|
+
if (Number(this.tickInterval)) {
|
238
|
+
this.daTickInterval = [Number(this.tickInterval), 'seconds'];
|
239
|
+
}
|
240
|
+
// else, parse out something we can build from.
|
241
|
+
else if (typeof this.tickInterval == "string") {
|
242
|
+
var parts = this.tickInterval.split(' ');
|
243
|
+
if (parts.length == 1) {
|
244
|
+
this.daTickInterval = [1, parts[0]];
|
245
|
+
}
|
246
|
+
else if (parts.length == 2) {
|
247
|
+
this.daTickInterval = [parts[0], parts[1]];
|
248
|
+
}
|
249
|
+
}
|
250
|
+
}
|
251
|
+
|
252
|
+
min = ((this.min != null) ? Date.create(this.min).getTime() : db.min);
|
253
|
+
max = ((this.max != null) ? Date.create(this.max).getTime() : db.max);
|
254
|
+
|
255
|
+
// if min and max are same, space them out a bit
|
256
|
+
if (min == max) {
|
257
|
+
var adj = 24*60*60*500; // 1/2 day
|
258
|
+
min -= adj;
|
259
|
+
max += adj;
|
260
|
+
}
|
261
|
+
|
262
|
+
var range = max - min;
|
263
|
+
var rmin, rmax;
|
264
|
+
|
265
|
+
rmin = (this.min != null) ? Date.create(this.min).getTime() : min - range/2*(this.padMin - 1);
|
266
|
+
rmax = (this.max != null) ? Date.create(this.max).getTime() : max + range/2*(this.padMax - 1);
|
267
|
+
this.min = rmin;
|
268
|
+
this.max = rmax;
|
269
|
+
range = this.max - this.min;
|
270
|
+
|
271
|
+
if (this.numberTicks == null){
|
272
|
+
// if tickInterval is specified by user, we will ignore computed maximum.
|
273
|
+
// max will be equal or greater to fit even # of ticks.
|
274
|
+
if (this.daTickInterval != null) {
|
275
|
+
var nc = Date.create(this.max).diff(this.min, this.daTickInterval[1], true);
|
276
|
+
this.numberTicks = Math.ceil(nc/this.daTickInterval[0]) +1;
|
277
|
+
// this.max = Date.create(this.min).add(this.numberTicks-1, this.daTickInterval[1]).getTime();
|
278
|
+
this.max = Date.create(this.min).add((this.numberTicks-1) * this.daTickInterval[0], this.daTickInterval[1]).getTime();
|
279
|
+
}
|
280
|
+
else if (dim > 200) {
|
281
|
+
this.numberTicks = parseInt(3+(dim-200)/100, 10);
|
282
|
+
}
|
283
|
+
else {
|
284
|
+
this.numberTicks = 2;
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
if (this.daTickInterval == null) {
|
289
|
+
this.daTickInterval = [range / (this.numberTicks-1)/1000, 'seconds'];
|
290
|
+
}
|
291
|
+
for (var i=0; i<this.numberTicks; i++){
|
292
|
+
var min = Date.create(this.min);
|
293
|
+
tt = min.add(i*this.daTickInterval[0], this.daTickInterval[1]).getTime();
|
294
|
+
var t = new this.tickRenderer(this.tickOptions);
|
295
|
+
// var t = new $.jqplot.AxisTickRenderer(this.tickOptions);
|
296
|
+
if (!this.showTicks) {
|
297
|
+
t.showLabel = false;
|
298
|
+
t.showMark = false;
|
299
|
+
}
|
300
|
+
else if (!this.showTickMarks) {
|
301
|
+
t.showMark = false;
|
302
|
+
}
|
303
|
+
t.setTick(tt, this.name);
|
304
|
+
this._ticks.push(t);
|
305
|
+
}
|
306
|
+
}
|
307
|
+
if (this._daTickInterval == null) {
|
308
|
+
this._daTickInterval = this.daTickInterval;
|
309
|
+
}
|
310
|
+
};
|
311
|
+
|
312
|
+
})(jQuery);
|
313
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2009 - 2010 Chris Leonello
|
3
|
+
* jqPlot is currently available for use in all personal or commercial projects
|
4
|
+
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
5
|
+
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
6
|
+
* choose the license that best suits your project and use it accordingly.
|
7
|
+
*
|
8
|
+
* Although not required, the author would appreciate an email letting him
|
9
|
+
* know of any substantial use of jqPlot. You can reach the author at:
|
10
|
+
* chris at jqplot or see http://www.jqplot.com/info.php .
|
11
|
+
*
|
12
|
+
* If you are feeling kind and generous, consider supporting the project by
|
13
|
+
* making a donation at: http://www.jqplot.com/donate.php .
|
14
|
+
*
|
15
|
+
* jqPlot includes date instance methods and printf/sprintf functions by other authors:
|
16
|
+
*
|
17
|
+
* Date instance methods contained in jqplot.dateMethods.js:
|
18
|
+
*
|
19
|
+
* author Ken Snyder (ken d snyder at gmail dot com)
|
20
|
+
* date 2008-09-10
|
21
|
+
* version 2.0.2 (http://kendsnyder.com/sandbox/date/)
|
22
|
+
* license Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
|
23
|
+
*
|
24
|
+
* JavaScript printf/sprintf functions contained in jqplot.sprintf.js:
|
25
|
+
*
|
26
|
+
* version 2007.04.27
|
27
|
+
* author Ash Searle
|
28
|
+
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
29
|
+
* http://hexmen.com/js/sprintf.js
|
30
|
+
* The author (Ash Searle) has placed this code in the public domain:
|
31
|
+
* "This code is unrestricted: you are free to use it however you like."
|
32
|
+
*
|
33
|
+
*/
|
34
|
+
(function(a){a.jqplot.DateAxisRenderer=function(){a.jqplot.LinearAxisRenderer.call(this)};a.jqplot.DateAxisRenderer.prototype=new a.jqplot.LinearAxisRenderer();a.jqplot.DateAxisRenderer.prototype.constructor=a.jqplot.DateAxisRenderer;a.jqplot.DateTickFormatter=function(b,c){if(!b){b="%Y/%m/%d"}return Date.create(c).strftime(b)};a.jqplot.DateAxisRenderer.prototype.init=function(f){this.tickOptions.formatter=a.jqplot.DateTickFormatter;this.daTickInterval=null;this._daTickInterval=null;a.extend(true,this,f);var c=this._dataBounds;for(var g=0;g<this._series.length;g++){var h=this._series[g];var l=h.data;var b=h._plotData;var k=h._stackData;for(var e=0;e<l.length;e++){if(this.name=="xaxis"||this.name=="x2axis"){l[e][0]=Date.create(l[e][0]).getTime();b[e][0]=Date.create(l[e][0]).getTime();k[e][0]=Date.create(l[e][0]).getTime();if(l[e][0]<c.min||c.min==null){c.min=l[e][0]}if(l[e][0]>c.max||c.max==null){c.max=l[e][0]}}else{l[e][1]=Date.create(l[e][1]).getTime();b[e][1]=Date.create(l[e][1]).getTime();k[e][1]=Date.create(l[e][1]).getTime();if(l[e][1]<c.min||c.min==null){c.min=l[e][1]}if(l[e][1]>c.max||c.max==null){c.max=l[e][1]}}}}};a.jqplot.DateAxisRenderer.prototype.reset=function(){this.min=this._min;this.max=this._max;this.tickInterval=this._tickInterval;this.numberTicks=this._numberTicks;this.daTickInterval=this._daTickInterval};a.jqplot.DateAxisRenderer.prototype.createTicks=function(){var v=this._ticks;var r=this.ticks;var w=this.name;var u=this._dataBounds;var o,s;var m,p;var d,c;var b,q;if(r.length){for(q=0;q<r.length;q++){var f=r[q];var h=new this.tickRenderer(this.tickOptions);if(f.constructor==Array){h.value=Date.create(f[0]).getTime();h.label=f[1];if(!this.showTicks){h.showLabel=false;h.showMark=false}else{if(!this.showTickMarks){h.showMark=false}}h.setTick(h.value,this.name);this._ticks.push(h)}else{h.value=Date.create(f).getTime();if(!this.showTicks){h.showLabel=false;h.showMark=false}else{if(!this.showTickMarks){h.showMark=false}}h.setTick(h.value,this.name);this._ticks.push(h)}}this.numberTicks=r.length;this.min=this._ticks[0].value;this.max=this._ticks[this.numberTicks-1].value;this.daTickInterval=[(this.max-this.min)/(this.numberTicks-1)/1000,"seconds"]}else{if(w=="xaxis"||w=="x2axis"){o=this._plotDimensions.width}else{o=this._plotDimensions.height}if(this.min!=null&&this.max!=null&&this.numberTicks!=null){this.tickInterval=null}if(this.tickInterval!=null){if(Number(this.tickInterval)){this.daTickInterval=[Number(this.tickInterval),"seconds"]}else{if(typeof this.tickInterval=="string"){var k=this.tickInterval.split(" ");if(k.length==1){this.daTickInterval=[1,k[0]]}else{if(k.length==2){this.daTickInterval=[k[0],k[1]]}}}}}m=((this.min!=null)?Date.create(this.min).getTime():u.min);p=((this.max!=null)?Date.create(this.max).getTime():u.max);if(m==p){var g=24*60*60*500;m-=g;p+=g}var j=p-m;var l,n;l=(this.min!=null)?Date.create(this.min).getTime():m-j/2*(this.padMin-1);n=(this.max!=null)?Date.create(this.max).getTime():p+j/2*(this.padMax-1);this.min=l;this.max=n;j=this.max-this.min;if(this.numberTicks==null){if(this.daTickInterval!=null){var e=Date.create(this.max).diff(this.min,this.daTickInterval[1],true);this.numberTicks=Math.ceil(e/this.daTickInterval[0])+1;this.max=Date.create(this.min).add((this.numberTicks-1)*this.daTickInterval[0],this.daTickInterval[1]).getTime()}else{if(o>200){this.numberTicks=parseInt(3+(o-200)/100,10)}else{this.numberTicks=2}}}if(this.daTickInterval==null){this.daTickInterval=[j/(this.numberTicks-1)/1000,"seconds"]}for(var q=0;q<this.numberTicks;q++){var m=Date.create(this.min);b=m.add(q*this.daTickInterval[0],this.daTickInterval[1]).getTime();var h=new this.tickRenderer(this.tickOptions);if(!this.showTicks){h.showLabel=false;h.showMark=false}else{if(!this.showTickMarks){h.showMark=false}}h.setTick(b,this.name);this._ticks.push(h)}}if(this._daTickInterval==null){this._daTickInterval=this.daTickInterval}}})(jQuery);
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2009 - 2010 Chris Leonello
|
3
|
+
* jqPlot is currently available for use in all personal or commercial projects
|
4
|
+
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
5
|
+
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
6
|
+
* choose the license that best suits your project and use it accordingly.
|
7
|
+
*
|
8
|
+
* Although not required, the author would appreciate an email letting him
|
9
|
+
* know of any substantial use of jqPlot. You can reach the author at:
|
10
|
+
* chris at jqplot or see http://www.jqplot.com/info.php .
|
11
|
+
*
|
12
|
+
* If you are feeling kind and generous, consider supporting the project by
|
13
|
+
* making a donation at: http://www.jqplot.com/donate.php .
|
14
|
+
*
|
15
|
+
* jqPlot includes date instance methods and printf/sprintf functions by other authors:
|
16
|
+
*
|
17
|
+
* Date instance methods contained in jqplot.dateMethods.js:
|
18
|
+
*
|
19
|
+
* author Ken Snyder (ken d snyder at gmail dot com)
|
20
|
+
* date 2008-09-10
|
21
|
+
* version 2.0.2 (http://kendsnyder.com/sandbox/date/)
|
22
|
+
* license Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
|
23
|
+
*
|
24
|
+
* JavaScript printf/sprintf functions contained in jqplot.sprintf.js:
|
25
|
+
*
|
26
|
+
* version 2007.04.27
|
27
|
+
* author Ash Searle
|
28
|
+
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
29
|
+
* http://hexmen.com/js/sprintf.js
|
30
|
+
* The author (Ash Searle) has placed this code in the public domain:
|
31
|
+
* "This code is unrestricted: you are free to use it however you like."
|
32
|
+
*
|
33
|
+
*/
|
34
|
+
(function(c){c.jqplot.PointLabels=function(e){this.show=c.jqplot.config.enablePlugins;this.location="n";this.labelsFromSeries=false;this.seriesLabelIndex=null;this.labels=[];this._labels=[];this.stackedValue=false;this.ypadding=6;this.xpadding=6;this.escapeHTML=true;this.edgeTolerance=-5;this.formatter=c.jqplot.DefaultTickFormatter;this.formatString="";this.hideZeros=false;this._elems=[];c.extend(true,this,e)};var a=["nw","n","ne","e","se","s","sw","w"];var d={nw:0,n:1,ne:2,e:3,se:4,s:5,sw:6,w:7};var b=["se","s","sw","w","nw","n","ne","e"];c.jqplot.PointLabels.init=function(i,h,f,g){var e=c.extend(true,{},f,g);e.pointLabels=e.pointLabels||{};if(this.renderer.constructor==c.jqplot.BarRenderer&&this.barDirection=="horizontal"&&!e.pointLabels.location){e.pointLabels.location="e"}this.plugins.pointLabels=new c.jqplot.PointLabels(e.pointLabels);this.plugins.pointLabels.setLabels.call(this)};c.jqplot.PointLabels.prototype.setLabels=function(){var f=this.plugins.pointLabels;var h;if(f.seriesLabelIndex!=null){h=f.seriesLabelIndex}else{if(this.renderer.constructor==c.jqplot.BarRenderer&&this.barDirection=="horizontal"){h=0}else{h=this._plotData[0].length-1}}f._labels=[];if(f.labels.length==0||f.labelsFromSeries){if(f.stackedValue){if(this._plotData.length&&this._plotData[0].length){for(var e=0;e<this._plotData.length;e++){f._labels.push(this._plotData[e][h])}}}else{var g=this.data;if(this.renderer.constructor==c.jqplot.BarRenderer&&this.waterfall){g=this._data}if(g.length&&g[0].length){for(var e=0;e<g.length;e++){f._labels.push(g[e][h])}}}}else{if(f.labels.length){f._labels=f.labels}}};c.jqplot.PointLabels.prototype.xOffset=function(f,e,g){e=e||this.location;g=g||this.xpadding;var h;switch(e){case"nw":h=-f.outerWidth(true)-this.xpadding;break;case"n":h=-f.outerWidth(true)/2;break;case"ne":h=this.xpadding;break;case"e":h=this.xpadding;break;case"se":h=this.xpadding;break;case"s":h=-f.outerWidth(true)/2;break;case"sw":h=-f.outerWidth(true)-this.xpadding;break;case"w":h=-f.outerWidth(true)-this.xpadding;break;default:h=-f.outerWidth(true)-this.xpadding;break}return h};c.jqplot.PointLabels.prototype.yOffset=function(f,e,g){e=e||this.location;g=g||this.xpadding;var h;switch(e){case"nw":h=-f.outerHeight(true)-this.ypadding;break;case"n":h=-f.outerHeight(true)-this.ypadding;break;case"ne":h=-f.outerHeight(true)-this.ypadding;break;case"e":h=-f.outerHeight(true)/2;break;case"se":h=this.ypadding;break;case"s":h=this.ypadding;break;case"sw":h=this.ypadding;break;case"w":h=-f.outerHeight(true)/2;break;default:h=-f.outerHeight(true)-this.ypadding;break}return h};c.jqplot.PointLabels.draw=function(t,h){var r=this.plugins.pointLabels;r.setLabels.call(this);for(var s=0;s<r._elems.length;s++){r._elems[s].remove()}if(r.show){var o="_"+this._stackAxis+"axis";if(!r.formatString){r.formatString=this[o]._ticks[0].formatString;r.formatter=this[o]._ticks[0].formatter}var z=this._plotData;var w=this._xaxis;var n=this._yaxis;for(var s=r._labels.length-1;s>=0;s--){var m=r._labels[s];if(r.hideZeros&&parseInt(r._labels[s],10)==0){m=""}if(m!=null){m=r.formatter(r.formatString,m)}var v=c('<div class="jqplot-point-label jqplot-series-'+this.index+" jqplot-point-"+s+'" style="position:absolute"></div>');v.insertAfter(t.canvas);r._elems.push(v);if(r.escapeHTML){v.text(m)}else{v.html(m)}var f=r.location;if(this.waterfall&&parseInt(m,10)<0){f=b[d[f]]}var l=w.u2p(z[s][0])+r.xOffset(v,f);var g=n.u2p(z[s][1])+r.yOffset(v,f);if(this.renderer.constructor==c.jqplot.BarRenderer){if(this.barDirection=="vertical"){l+=this._barNudge}else{g-=this._barNudge}}v.css("left",l);v.css("top",g);var j=l+c(v).width();var q=g+c(v).height();var y=r.edgeTolerance;var e=c(t.canvas).position().left;var u=c(t.canvas).position().top;var x=t.canvas.width+e;var k=t.canvas.height+u;if(l-y<e||g-y<u||j+y>x||q+y>k){c(v).detach()}}}};c.jqplot.postSeriesInitHooks.push(c.jqplot.PointLabels.init);c.jqplot.postDrawSeriesHooks.push(c.jqplot.PointLabels.draw)})(jQuery);
|