alchemy 1.0.2 → 8.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +24 -17
- data/README.md +538 -4
- data/lib/alchemy.rb +3 -6
- metadata +61 -266
- data/Rakefile +0 -21
- data/app/assets/fonts/alchemy/LiberationSans-Bold-webfont.eot +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Bold-webfont.svg +0 -154
- data/app/assets/fonts/alchemy/LiberationSans-Bold-webfont.ttf +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Bold-webfont.woff +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-BoldItalic-webfont.eot +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-BoldItalic-webfont.svg +0 -154
- data/app/assets/fonts/alchemy/LiberationSans-BoldItalic-webfont.ttf +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-BoldItalic-webfont.woff +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Italic-webfont.eot +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Italic-webfont.svg +0 -154
- data/app/assets/fonts/alchemy/LiberationSans-Italic-webfont.ttf +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Italic-webfont.woff +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Regular-webfont.eot +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Regular-webfont.svg +0 -154
- data/app/assets/fonts/alchemy/LiberationSans-Regular-webfont.ttf +0 -0
- data/app/assets/fonts/alchemy/LiberationSans-Regular-webfont.woff +0 -0
- data/app/assets/fonts/alchemy/Red Hat Liberation License.txt +0 -78
- data/app/assets/fonts/alchemy/overpass_bold-web.eot +0 -0
- data/app/assets/fonts/alchemy/overpass_bold-web.svg +0 -470
- data/app/assets/fonts/alchemy/overpass_bold-web.ttf +0 -0
- data/app/assets/fonts/alchemy/overpass_bold-web.woff +0 -0
- data/app/assets/fonts/alchemy/overpass_regular-web.eot +0 -0
- data/app/assets/fonts/alchemy/overpass_regular-web.svg +0 -470
- data/app/assets/fonts/alchemy/overpass_regular-web.ttf +0 -0
- data/app/assets/fonts/alchemy/overpass_regular-web.woff +0 -0
- data/app/assets/images/alchemy/icons/action-icons.png +0 -0
- data/app/assets/images/alchemy/icons/arrow_icon.png +0 -0
- data/app/assets/images/alchemy/icons/chosen-sprite.png +0 -0
- data/app/assets/images/alchemy/icons/error_icon.png +0 -0
- data/app/assets/images/alchemy/icons/objects.png +0 -0
- data/app/assets/images/alchemy/icons/spinner.gif +0 -0
- data/app/assets/images/alchemy/icons/spinner_head.gif +0 -0
- data/app/assets/images/alchemy/icons/success_icon.png +0 -0
- data/app/assets/images/alchemy/icons/warning_icon.png +0 -0
- data/app/assets/javascripts/alchemy/flash_messages.js +0 -12
- data/app/assets/javascripts/alchemy/forms.js +0 -25
- data/app/assets/javascripts/alchemy/i18n.js +0 -36
- data/app/assets/javascripts/alchemy/login.js +0 -130
- data/app/assets/javascripts/alchemy/password.js +0 -99
- data/app/assets/stylesheets/alchemy/components/_chosen.scss +0 -423
- data/app/assets/stylesheets/alchemy/components/_content.scss +0 -58
- data/app/assets/stylesheets/alchemy/components/_helpers.scss +0 -38
- data/app/assets/stylesheets/alchemy/components/_media.scss +0 -49
- data/app/assets/stylesheets/alchemy/components/_media_object.scss +0 -22
- data/app/assets/stylesheets/alchemy/components/_normalize.scss +0 -448
- data/app/assets/stylesheets/alchemy/components/_shared.scss +0 -18
- data/app/assets/stylesheets/alchemy/components/buttons/_buttons.scss +0 -241
- data/app/assets/stylesheets/alchemy/components/buttons/_buttons_vars.scss +0 -10
- data/app/assets/stylesheets/alchemy/components/flash_messages/_flash_messages.scss +0 -93
- data/app/assets/stylesheets/alchemy/components/flash_messages/_flash_messages_vars.scss +0 -3
- data/app/assets/stylesheets/alchemy/components/fonts/_liberation.scss +0 -44
- data/app/assets/stylesheets/alchemy/components/fonts/_overpass.scss +0 -24
- data/app/assets/stylesheets/alchemy/components/footer/_footer.scss +0 -53
- data/app/assets/stylesheets/alchemy/components/footer/_footer_vars.scss +0 -4
- data/app/assets/stylesheets/alchemy/components/forms/_forms.scss +0 -536
- data/app/assets/stylesheets/alchemy/components/forms/_forms_ie.scss +0 -45
- data/app/assets/stylesheets/alchemy/components/forms/_forms_mixins.scss +0 -18
- data/app/assets/stylesheets/alchemy/components/forms/_forms_responsive.scss +0 -161
- data/app/assets/stylesheets/alchemy/components/forms/_forms_vars.scss +0 -25
- data/app/assets/stylesheets/alchemy/components/header/_header.scss +0 -214
- data/app/assets/stylesheets/alchemy/components/header/_header_vars.scss +0 -11
- data/app/assets/stylesheets/alchemy/components/login/_login.scss +0 -169
- data/app/assets/stylesheets/alchemy/components/login/_login_mixins.scss +0 -7
- data/app/assets/stylesheets/alchemy/components/login/_login_vars.scss +0 -19
- data/app/assets/stylesheets/alchemy/components/sprites/_sprites.scss +0 -110
- data/app/assets/stylesheets/alchemy/components/sprites/_sprites_mixins.scss +0 -9
- data/app/assets/stylesheets/alchemy/components/text/_text.scss +0 -30
- data/app/assets/stylesheets/alchemy/components/text/_text_vars.scss +0 -1
- data/app/assets/stylesheets/alchemy/composites/content_elements.scss +0 -6
- data/app/assets/stylesheets/alchemy/composites/login.scss +0 -9
- data/app/assets/stylesheets/alchemy/composites/shell.scss +0 -4
- data/app/assets/stylesheets/alchemy/partials/_base.scss +0 -8
- data/app/assets/stylesheets/alchemy/partials/_colors.scss +0 -99
- data/app/assets/stylesheets/alchemy/partials/_mixins.scss +0 -24
- data/app/assets/stylesheets/alchemy/partials/_vars.scss +0 -31
- data/app/helpers/alchemy/gettext_translations.rb +0 -28
- data/app/helpers/alchemy/layout_helper.rb +0 -19
- data/app/helpers/alchemy/rails_translations.rb +0 -21
- data/app/helpers/alchemy/translation_helper.rb +0 -19
- data/app/views/alchemy/layouts/_change_password_layout.html.haml +0 -20
- data/app/views/alchemy/layouts/_common_i18n.haml +0 -4
- data/app/views/alchemy/layouts/_header_layout.haml +0 -13
- data/app/views/alchemy/layouts/_login_layout.html.haml +0 -58
- data/app/views/alchemy/layouts/_user_session_layout.haml +0 -17
- data/app/views/alchemy/layouts/base.html.haml +0 -20
- data/app/views/alchemy/layouts/shell_layout.haml +0 -10
- data/lib/alchemy/version.rb +0 -3
- data/test/alchemy_test.rb +0 -7
- data/test/test_helper.rb +0 -9
- data/vendor/assets/javascripts/alchemy/html5shiv.js +0 -298
- data/vendor/assets/javascripts/alchemy/jquery/jquery-1.6.2.js +0 -8981
- data/vendor/assets/javascripts/alchemy/jquery/plugins/chosen.jquery.js +0 -1003
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/API.txt +0 -1201
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/FAQ.txt +0 -76
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/LICENSE.txt +0 -22
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/Makefile +0 -9
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/NEWS.txt +0 -508
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/PLUGINS.txt +0 -137
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/README.txt +0 -90
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/ajax.html +0 -143
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/annotating.html +0 -75
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/arrow-down.gif +0 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/arrow-left.gif +0 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/arrow-right.gif +0 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/arrow-up.gif +0 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/basic.html +0 -38
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/data-eu-gdp-growth-1.json +0 -4
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/data-eu-gdp-growth-2.json +0 -4
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/data-eu-gdp-growth-3.json +0 -4
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/data-eu-gdp-growth-4.json +0 -4
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/data-eu-gdp-growth-5.json +0 -4
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/data-eu-gdp-growth.json +0 -4
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/data-japan-gdp-growth.json +0 -4
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/data-usa-gdp-growth.json +0 -4
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/graph-types.html +0 -75
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/hs-2004-27-a-large_web.jpg +0 -0
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/image.html +0 -45
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/index.html +0 -44
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/interacting-axes.html +0 -97
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/interacting.html +0 -93
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/layout.css +0 -6
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/multiple-axes.html +0 -60
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/navigate.html +0 -118
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/percentiles.html +0 -57
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/pie.html +0 -756
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/realtime.html +0 -83
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/resize.html +0 -61
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/selection.html +0 -114
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/setting-options.html +0 -61
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/stacking.html +0 -77
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/symbols.html +0 -49
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/thresholding.html +0 -54
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/time.html +0 -71
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/tracking.html +0 -95
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/turning-series.html +0 -98
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/visitors.html +0 -90
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/examples/zooming.html +0 -98
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/excanvas.js +0 -1427
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/excanvas.min.js +0 -1
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.colorhelpers.js +0 -179
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.colorhelpers.min.js +0 -1
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.crosshair.js +0 -167
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.crosshair.min.js +0 -1
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.fillbetween.js +0 -183
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.fillbetween.min.js +0 -1
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.image.js +0 -238
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.image.min.js +0 -1
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.js +0 -2599
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.min.js +0 -6
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.navigate.js +0 -336
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.navigate.min.js +0 -1
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.pie.js +0 -750
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.pie.min.js +0 -1
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.resize.js +0 -60
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.resize.min.js +0 -1
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.selection.js +0 -344
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.selection.min.js +0 -1
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.stack.js +0 -184
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.stack.min.js +0 -1
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.symbol.js +0 -70
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.symbol.min.js +0 -1
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.threshold.js +0 -103
- data/vendor/assets/javascripts/alchemy/jquery/plugins/flot-0.7/jquery.flot.threshold.min.js +0 -1
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/blank.svg +0 -3
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/custom_test.js +0 -67
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svg.css +0 -9
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svg.js +0 -1101
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svg.min.js +0 -7
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svg.pack.js +0 -7
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svgfilter.js +0 -396
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svgfilter.min.js +0 -7
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svgfilter.pack.js +0 -7
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svggraph.js +0 -1337
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svggraph.min.js +0 -7
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/jquery.svggraph.pack.js +0 -7
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/lion.svg +0 -161
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery-svg/test.js +0 -714
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.ajaxfileupload.js +0 -205
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.ba-bbq.js +0 -1137
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.ba-resize.js +0 -246
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.cookie.js +0 -92
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.easing.1.3.js +0 -205
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.fancyqueries.js +0 -106
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.flash.js +0 -288
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.form.js +0 -964
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.hoverIntent.js +0 -106
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.jeditable.ajaxupload.js +0 -62
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.jeditable.js +0 -556
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.jnotify.js +0 -210
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.jscrollpane.js +0 -1390
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.jscrollpane.min.js +0 -11
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.linkHover.js +0 -89
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.loadmask.min.js +0 -10
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.mousewheel.js +0 -78
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.multiselect.filter.js +0 -176
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.multiselect.js +0 -668
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.pack.js +0 -11
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.periodicalupdater.js +0 -175
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.sortElements.js +0 -75
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.sparkline.min.js +0 -94
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.text-overflow.js +0 -60
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.timepickr.js +0 -214
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.timers.js +0 -142
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.tipsy.js +0 -358
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.treeTable.js +0 -226
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.trunk8.js +0 -203
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.ui.multiselect.js +0 -338
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.ui.totop.js +0 -58
- data/vendor/assets/javascripts/alchemy/jquery/plugins/jquery.uitablefilter.js +0 -95
- data/vendor/assets/javascripts/alchemy/jquery/plugins/ui.spinner.js +0 -683
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_highlight-hard_75_dadada_1x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_highlight-hard_75_e6e6e6_1x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_highlight-hard_95_ffffff_1x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_highlight-soft_80_e0e0e0_1x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_inset-hard_65_ffffff_1x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-bg_inset-soft_95_fef1ec_1x100.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-icons_8f8f8f_256x240.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-icons_97baed_256x240.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/css/custom-theme/jquery-ui-1.8.11.custom.css +0 -573
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/js/jquery-1.5.1.min.js +0 -16
- data/vendor/assets/javascripts/alchemy/jquery-ui-1.8.11.custom/js/jquery-ui-1.8.11.custom.min.js +0 -783
- data/vendor/assets/javascripts/alchemy/rails.js +0 -331
- data/vendor/assets/javascripts/alchemy/underscore-1.3.1.js +0 -999
|
@@ -1,714 +0,0 @@
|
|
|
1
|
-
// Demonstrate an onLoad callback to initialise a canvas
|
|
2
|
-
function drawIntro() {
|
|
3
|
-
var svg = svgManager.getSVGFor('#cool_graph');
|
|
4
|
-
svg.circle(null, 75, 75, 50, {fill: 'none', stroke: 'red', stroke_width: 3});
|
|
5
|
-
var g = svg.group(null, {stroke: 'black', stroke_width: 2});
|
|
6
|
-
svg.line(g, 15, 75, 135, 75);
|
|
7
|
-
svg.line(g, 75, 15, 75, 135);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// -----------------------------------------------------------------------------
|
|
11
|
-
|
|
12
|
-
var svgSpec = 'http://www.w3c.org/TR/SVG11/';
|
|
13
|
-
// SVG examples
|
|
14
|
-
var examples = [
|
|
15
|
-
['Basic shapes', basicShapesDemo,
|
|
16
|
-
'SVG provides for the creation of several basic shapes, including ' +
|
|
17
|
-
'rectangles, rectangles with rounded corners, circles, ellipses, ' +
|
|
18
|
-
'lines segments, polygonal lines, and closed polygons. ' +
|
|
19
|
-
'Each shape may be drawn with its own fill and border colourings. ' +
|
|
20
|
-
'Shapes may be moved and rotated via the transformation abilities of SVG. ' +
|
|
21
|
-
'Grouping elements allows common attributes to be easily applied.<br/>' +
|
|
22
|
-
'See the original documents: <a href="http://www.w3.org/TR/SVG11/images/shapes/rect01.svg" target="_blank">rectangle</a>, ' +
|
|
23
|
-
'<a href="http://www.w3.org/TR/SVG11/images/shapes/rect02.svg" target="_blank">rounded rectangle</a>, ' +
|
|
24
|
-
'<a href="http://www.w3.org/TR/SVG11/images/shapes/circle01.svg" target="_blank">circle</a>, ' +
|
|
25
|
-
'<a href="http://www.w3.org/TR/SVG11/images/shapes/ellipse01.svg" target="_blank">ellipse</a>, ' +
|
|
26
|
-
'<a href="http://www.w3.org/TR/SVG11/images/shapes/line01.svg" target="_blank">line</a>, ' +
|
|
27
|
-
'<a href="http://www.w3.org/TR/SVG11/images/shapes/polyline01.svg" target="_blank">polyline</a>, ' +
|
|
28
|
-
'and <a href="http://www.w3.org/TR/SVG11/images/shapes/polygon01.svg" target="_blank">polygon</a>.',
|
|
29
|
-
'<rect x="20" y="50" width="100" height="50"\r\n' +
|
|
30
|
-
' fill="yellow" stroke="navy" stroke-width="5" />\r\n' +
|
|
31
|
-
'<rect x="150" y="50" width="100" height="50" rx="10"\r\n' +
|
|
32
|
-
' fill="green" />\r\n' +
|
|
33
|
-
'<g transform="translate(270 80) rotate(-30)">\r\n' +
|
|
34
|
-
' <rect x="0" y="0" width="100" height="500" rx="10"\r\n' +
|
|
35
|
-
' fill="none" stroke="purple" stroke-width="3" />\r\n' +
|
|
36
|
-
'</g>\r\n' +
|
|
37
|
-
'<circle cx="70" cy="220" r="50"\r\n' +
|
|
38
|
-
' fill="red" stroke="blue" stroke-width="5" />\r\n' +
|
|
39
|
-
'<g transform="translate(175 220)">\r\n' +
|
|
40
|
-
' <ellipse rx="75" ry="50" fill="red" />\r\n' +
|
|
41
|
-
'</g>\r\n' +
|
|
42
|
-
'<ellipse transform="translate(300 220) rotate(-30)"\r\n' +
|
|
43
|
-
' rx="75" ry="50" fill="none" stroke="blue" stroke-width="10" />\r\n' +
|
|
44
|
-
'<g stroke="green" >\r\n' +
|
|
45
|
-
' <line x1="450" y1="120" x2="550" y2="20" stroke-width="5" />\r\n' +
|
|
46
|
-
' <line x1="550" y1="120" x2="650" y2="20" stroke-width="10" />\r\n' +
|
|
47
|
-
' <line x1="650" y1="120" x2="750" y2="20" stroke-width="15" />\r\n' +
|
|
48
|
-
' <line x1="750" y1="120" x2="850" y2="20" stroke-width="20" />\r\n' +
|
|
49
|
-
' <line x1="850" y1="120" x2="950" y2="20" stroke-width="25" />\r\n' +
|
|
50
|
-
'</g>\r\n' +
|
|
51
|
-
'<polyline fill="none" stroke="blue" stroke-width="5" \r\n' +
|
|
52
|
-
' points="450,250\r\n' +
|
|
53
|
-
' 475,250 475,220 500,220 500,250\r\n' +
|
|
54
|
-
' 525,250 525,200 550,200 550,250\r\n' +
|
|
55
|
-
' 575,250 575,180 600,180 600,250\r\n' +
|
|
56
|
-
' 625,250 625,160 650,160 650,250\r\n' +
|
|
57
|
-
' 675,250" />\r\n' +
|
|
58
|
-
'<polygon fill="lime" stroke="blue" stroke-width="10" \r\n' +
|
|
59
|
-
' points="800,150 900,180 900,240 800,270 700,240 700,180" />'],
|
|
60
|
-
|
|
61
|
-
['Filters', filterDemo,
|
|
62
|
-
'This example relies on the <i>filter</i> extension for the SVG plugin.<br/>' +
|
|
63
|
-
'1. Filter primitive \'feGaussianBlur\' takes input SourceAlpha, ' +
|
|
64
|
-
'which is the alpha channel of the source graphic. The result is ' +
|
|
65
|
-
'stored in a temporary buffer named "blur". Note that "blur" is ' +
|
|
66
|
-
'used as input to both filter primitives 2 and 3.<br/>' +
|
|
67
|
-
'2. Filter primitive \'feOffset\' takes buffer "blur", shifts the ' +
|
|
68
|
-
'result in a positive direction in both x and y, and creates a new ' +
|
|
69
|
-
'buffer named "offsetBlur". The effect is that of a drop shadow.<br/>' +
|
|
70
|
-
'3. Filter primitive \'feSpecularLighting\', uses buffer "blur" as a ' +
|
|
71
|
-
'model of a surface elevation and generates a lighting effect from a ' +
|
|
72
|
-
'single point source. The result is stored in buffer "specOut".<br/>' +
|
|
73
|
-
'4. Filter primitive \'feComposite\' masks out the result of filter ' +
|
|
74
|
-
'primitive 3 by the original source graphics alpha channel so that ' +
|
|
75
|
-
'the intermediate result is no bigger than the original source graphic.<br/>' +
|
|
76
|
-
'5. Filter primitive \'feComposite\' composites the result of the ' +
|
|
77
|
-
'specular lighting with the original source graphic.<br/>' +
|
|
78
|
-
'6. Filter primitive \'feMerge\' composites two layers together. ' +
|
|
79
|
-
'The lower layer consists of the drop shadow result from filter primitive 2. ' +
|
|
80
|
-
'The upper layer consists of the specular lighting result from filter primitive 5.<br/>' +
|
|
81
|
-
'See the <a href="http://www.w3.org/TR/SVG11/images/filters/filters01.svg" target="_blank">original document</a>.',
|
|
82
|
-
'<desc>An example which combines multiple filter primitives\r\n' +
|
|
83
|
-
' to produce a 3D lighting effect on a graphic consisting\r\n' +
|
|
84
|
-
' of the string "SVG" sitting on top of oval filled in red\r\n' +
|
|
85
|
-
' and surrounded by an oval outlined in red.</desc>\r\n' +
|
|
86
|
-
'<defs>\r\n' +
|
|
87
|
-
' <filter id="MyFilter" filterUnits="userSpaceOnUse" x="0" y="0" width="200" height="120">\r\n' +
|
|
88
|
-
' <feGaussianBlur in="SourceAlpha" stdDeviation="4" result="blur"/>\r\n' +
|
|
89
|
-
' <feOffset in="blur" dx="4" dy="4" result="offsetBlur"/>\r\n' +
|
|
90
|
-
' <feSpecularLighting in="blur" surfaceScale="5" specularConstant=".75" \r\n' +
|
|
91
|
-
' specularExponent="20" lighting-color="#bbbbbb" \r\n' +
|
|
92
|
-
' result="specOut">\r\n' +
|
|
93
|
-
' <fePointLight x="-5000" y="-10000" z="20000"/>\r\n' +
|
|
94
|
-
' </feSpecularLighting>\r\n' +
|
|
95
|
-
' <feComposite in="specOut" in2="SourceAlpha" operator="in" result="specOut"/>\r\n' +
|
|
96
|
-
' <feComposite in="SourceGraphic" in2="specOut" operator="arithmetic" \r\n' +
|
|
97
|
-
' k1="0" k2="1" k3="1" k4="0" result="litPaint"/>\r\n' +
|
|
98
|
-
' <feMerge>\r\n' +
|
|
99
|
-
' <feMergeNode in="offsetBlur"/>\r\n' +
|
|
100
|
-
' <feMergeNode in="litPaint"/>\r\n' +
|
|
101
|
-
' </feMerge>\r\n' +
|
|
102
|
-
' </filter>\r\n' +
|
|
103
|
-
'</defs>\r\n' +
|
|
104
|
-
'<rect x="1" y="1" width="198" height="118" fill="#888888" stroke="blue" />\r\n' +
|
|
105
|
-
'<g filter="url(#MyFilter)" >\r\n' +
|
|
106
|
-
' <g>\r\n' +
|
|
107
|
-
' <path fill="none" stroke="#D90000" stroke-width="10" \r\n' +
|
|
108
|
-
' d="M50,90 C0,90 0,30 50,30 L150,30 C200,30 200,90 150,90 z" />\r\n' +
|
|
109
|
-
' <path fill="#D90000" \r\n' +
|
|
110
|
-
' d="M60,80 C30,80 30,40 60,40 L140,40 C170,40 170,80 140,80 z" />\r\n' +
|
|
111
|
-
' <g fill="#FFFFFF" stroke="black" font-size="45" font-family="Verdana" >\r\n' +
|
|
112
|
-
' <text x="52" y="76">SVG</text>\r\n' +
|
|
113
|
-
' </g>\r\n' +
|
|
114
|
-
' </g>\r\n' +
|
|
115
|
-
'</g>'],
|
|
116
|
-
|
|
117
|
-
['Gradients and Patterns', gradientPatternDemo,
|
|
118
|
-
'Shows how to fill a rectangle by referencing a radial gradient paint server.<br/>' +
|
|
119
|
-
'Shows how to fill a rectangle by referencing a pattern paint server. ' +
|
|
120
|
-
'Note how the blue stroke of each triangle has been clipped at the top and the left. ' +
|
|
121
|
-
'This is due to SVG\'s user agent style sheet setting the \'overflow\' property ' +
|
|
122
|
-
'for \'pattern\' elements to hidden, which causes the pattern to be clipped to ' +
|
|
123
|
-
'the bounds of the pattern tile.<br/>' +
|
|
124
|
-
'See the original documents: <a href="http://www.w3.org/TR/SVG11/images/pservers/radgrad01.svg" target="_blank">gradient</a> ' +
|
|
125
|
-
'and <a href="http://www.w3.org/TR/SVG11/images/pservers/pattern01.svg" target="_blank">pattern</a>.',
|
|
126
|
-
'<desc>Example radgrad01 - fill a rectangle by referencing a\r\n' +
|
|
127
|
-
' radial gradient paint server</desc>\r\n' +
|
|
128
|
-
'<g>\r\n' +
|
|
129
|
-
' <defs>\r\n' +
|
|
130
|
-
' <radialGradient id="MyGradient" gradientUnits="userSpaceOnUse"\r\n' +
|
|
131
|
-
' cx="200" cy="100" r="150" fx="200" fy="100">\r\n' +
|
|
132
|
-
' <stop offset="0%" stop-color="red" />\r\n' +
|
|
133
|
-
' <stop offset="50%" stop-color="blue" />\r\n' +
|
|
134
|
-
' <stop offset="100%" stop-color="red" />\r\n' +
|
|
135
|
-
' </radialGradient>\r\n' +
|
|
136
|
-
' </defs>\r\n' +
|
|
137
|
-
' <!-- The rectangle is filled using a radial gradient paint server -->\r\n' +
|
|
138
|
-
' <rect fill="url(#MyGradient)" stroke="black" stroke-width="5"\r\n' +
|
|
139
|
-
' x="50" y="50" width="300" height="100"/>\r\n' +
|
|
140
|
-
'</g>\r\n' +
|
|
141
|
-
'<g>\r\n' +
|
|
142
|
-
' <defs>\r\n' +
|
|
143
|
-
' <pattern id="TrianglePattern" patternUnits="userSpaceOnUse"\r\n' +
|
|
144
|
-
' x="0" y="0" width="100" height="100" viewBox="0 0 10 10" >\r\n' +
|
|
145
|
-
' <path d="M 0 0 L 7 0 L 3.5 7 z" fill="red" stroke="blue" />\r\n' +
|
|
146
|
-
' </pattern> \r\n' +
|
|
147
|
-
' </defs>\r\n' +
|
|
148
|
-
' <!-- The ellipse is filled using a triangle pattern paint server\r\n' +
|
|
149
|
-
' and stroked with black -->\r\n' +
|
|
150
|
-
' <ellipse fill="url(#TrianglePattern)" stroke="black" stroke-width="5" \r\n' +
|
|
151
|
-
' cx="550" cy="100" rx="175" ry="75" />\r\n' +
|
|
152
|
-
'</g>'],
|
|
153
|
-
|
|
154
|
-
['Interactivity', interactiveDemo,
|
|
155
|
-
'This example defines a function <code>circle_click</code> which is called ' +
|
|
156
|
-
'by the onclick event attribute on the \'circle\' element. Each click toggles ' +
|
|
157
|
-
'the circle\'s size between small and large.<br/>' +
|
|
158
|
-
'See the <a href="http://www.w3.org/TR/SVG11/images/script/script01.svg" target="_blank">original document</a>.',
|
|
159
|
-
'<desc>Example script01 - invoke an ECMAScript function from an onclick event\r\n' +
|
|
160
|
-
'</desc>\r\n' +
|
|
161
|
-
'<!-- ECMAScript to change the radius with each click -->\r\n' +
|
|
162
|
-
'<script type="text/ecmascript"> <![CDATA[\r\n' +
|
|
163
|
-
' function circle_click(evt) {\r\n' +
|
|
164
|
-
' var circle = evt.target;\r\n' +
|
|
165
|
-
' var currentRadius = circle.getAttribute("r");\r\n' +
|
|
166
|
-
' if (currentRadius == 100)\r\n' +
|
|
167
|
-
' circle.setAttribute("r", currentRadius*2);\r\n' +
|
|
168
|
-
' else\r\n' +
|
|
169
|
-
' circle.setAttribute("r", currentRadius*0.5);\r\n' +
|
|
170
|
-
' }\r\n' +
|
|
171
|
-
']]> </script>\r\n' +
|
|
172
|
-
'<!-- Act on each click event -->\r\n' +
|
|
173
|
-
'<circle onclick="circle_click(evt)" cx="300" cy="150" r="100"\r\n' +
|
|
174
|
-
' fill="red"/>\r\n' +
|
|
175
|
-
'<text x="300" y="280" \r\n' +
|
|
176
|
-
' font-family="Verdana" font-size="35" text-anchor="middle">\r\n' +
|
|
177
|
-
' Click on circle to change its size\r\n' +
|
|
178
|
-
'</text>'],
|
|
179
|
-
|
|
180
|
-
['Masking', maskingDemo,
|
|
181
|
-
'In SVG, you can specify that any other graphics object or \'g\' element ' +
|
|
182
|
-
'can be used as an alpha mask for compositing the current object into the background.<br/>' +
|
|
183
|
-
'See the <a href="http://www.w3.org/TR/SVG11/images/masking/mask01.svg" target="_blank">original document</a>.',
|
|
184
|
-
'<desc>Example mask01 - blue text masked with gradient against red background\r\n' +
|
|
185
|
-
'</desc>\r\n' +
|
|
186
|
-
'<defs>\r\n' +
|
|
187
|
-
' <linearGradient id="Gradient" gradientUnits="userSpaceOnUse"\r\n' +
|
|
188
|
-
' x1="0" y1="0" x2="800" y2="0">\r\n' +
|
|
189
|
-
' <stop offset="0" stop-color="white" stop-opacity="0" />\r\n' +
|
|
190
|
-
' <stop offset="1" stop-color="white" stop-opacity="1" />\r\n' +
|
|
191
|
-
' </linearGradient>\r\n' +
|
|
192
|
-
' <mask id="Mask" maskUnits="userSpaceOnUse"\r\n' +
|
|
193
|
-
' x="0" y="0" width="800" height="300">\r\n' +
|
|
194
|
-
' <rect x="0" y="0" width="800" height="300" fill="url(#Gradient)" />\r\n' +
|
|
195
|
-
' </mask>\r\n' +
|
|
196
|
-
' <text id="Text" x="400" y="200" \r\n' +
|
|
197
|
-
' font-family="Verdana" font-size="100" text-anchor="middle" >\r\n' +
|
|
198
|
-
' Masked text\r\n' +
|
|
199
|
-
' </text>\r\n' +
|
|
200
|
-
'</defs>\r\n' +
|
|
201
|
-
'<!-- Draw a pale red rectangle in the background -->\r\n' +
|
|
202
|
-
'<rect x="0" y="0" width="800" height="300" fill="#FF8080" />\r\n' +
|
|
203
|
-
'<!-- Draw the text string twice. First, filled blue, with the mask applied.\r\n' +
|
|
204
|
-
' Second, outlined in black without the mask. -->\r\n' +
|
|
205
|
-
'<use xlink:href="#Text" fill="blue" mask="url(#Mask)" />\r\n' +
|
|
206
|
-
'<use xlink:href="#Text" fill="none" stroke="black" stroke-width="2" />'],
|
|
207
|
-
|
|
208
|
-
['Styles and References', useStyleDemo,
|
|
209
|
-
'Illustrates a \'use\' element with various methods of applying CSS styling.<br/>' +
|
|
210
|
-
'See the <a href="http://www.w3.org/TR/SVG11/images/struct/Use04.svg" target="_blank">original document</a>.',
|
|
211
|
-
'<desc>Example Use04 - \'use\' with CSS styling</desc>\r\n' +
|
|
212
|
-
'<defs style=" /* rule 9 */ stroke-miterlimit: 10" >\r\n' +
|
|
213
|
-
' <path id="MyPath" d="M100 50 L700 50 L700 250 L100 250"\r\n' +
|
|
214
|
-
' class="MyPathClass" style=" /* rule 10 */ stroke-dasharray:300,100" />\r\n' +
|
|
215
|
-
'</defs>\r\n' +
|
|
216
|
-
'<style type="text/css">\r\n' +
|
|
217
|
-
' <![CDATA[\r\n' +
|
|
218
|
-
' /* rule 1 */ #MyUse { fill: blue }\r\n' +
|
|
219
|
-
' /* rule 2 */ #MyPath { stroke: red }\r\n' +
|
|
220
|
-
' /* rule 3 */ use { fill-opacity: .5 }\r\n' +
|
|
221
|
-
' /* rule 4 */ path { stroke-opacity: .5 }\r\n' +
|
|
222
|
-
' /* rule 5 */ .MyUseClass { stroke-linecap: round }\r\n' +
|
|
223
|
-
' /* rule 6 */ .MyPathClass { stroke-linejoin: bevel }\r\n' +
|
|
224
|
-
' /* rule 7 */ use > path { shape-rendering: optimizeQuality }\r\n' +
|
|
225
|
-
' /* rule 8 */ g > path { visibility: hidden }\r\n' +
|
|
226
|
-
' ]]>\r\n' +
|
|
227
|
-
'</style>\r\n' +
|
|
228
|
-
'<g style=" /* rule 11 */ stroke-width:40">\r\n' +
|
|
229
|
-
' <use id="MyUse" xlink:href="#MyPath" \r\n' +
|
|
230
|
-
' class="MyUseClass" style="/* rule 12 */ stroke-dashoffset:50" />\r\n' +
|
|
231
|
-
'</g>'],
|
|
232
|
-
|
|
233
|
-
['Text', textDemo,
|
|
234
|
-
'Shows how \'tspan\' elements can be included within \'textPath\' ' +
|
|
235
|
-
'elements to adjust styling attributes and adjust the current text ' +
|
|
236
|
-
'position before rendering a particular glyph. The first occurrence ' +
|
|
237
|
-
'of the word "up" is filled with the color red. Attribute dy is used ' +
|
|
238
|
-
'to lift the word "up" from the baseline.<br/>' +
|
|
239
|
-
'See the <a href="http://www.w3.org/TR/SVG11/images/text/toap02.svg" target="_blank">original document</a>.',
|
|
240
|
-
'<defs>\r\n' +
|
|
241
|
-
' <path id="MyPath"\r\n' +
|
|
242
|
-
' d="M 100 200 \r\n' +
|
|
243
|
-
' C 200 100 300 0 400 100\r\n' +
|
|
244
|
-
' C 500 200 600 300 700 200\r\n' +
|
|
245
|
-
' C 800 100 900 100 900 100" />\r\n' +
|
|
246
|
-
'</defs>\r\n' +
|
|
247
|
-
'<desc>Example toap02 - tspan within textPath</desc>\r\n' +
|
|
248
|
-
'<use xlink:href="#MyPath" fill="none" stroke="red" />\r\n' +
|
|
249
|
-
'<text font-family="Verdana" font-size="42.5" fill="blue" >\r\n' +
|
|
250
|
-
' <textPath xlink:href="#MyPath">\r\n' +
|
|
251
|
-
' We go \r\n' +
|
|
252
|
-
' <tspan dy="-30" fill="red" >\r\n' +
|
|
253
|
-
' up\r\n' +
|
|
254
|
-
' </tspan>\r\n' +
|
|
255
|
-
' <tspan dy="30">\r\n' +
|
|
256
|
-
' ,\r\n' +
|
|
257
|
-
' </tspan>\r\n' +
|
|
258
|
-
' then we go down, then up again\r\n' +
|
|
259
|
-
' </textPath>\r\n' +
|
|
260
|
-
'</text>'],
|
|
261
|
-
|
|
262
|
-
['Transformations', transformDemo,
|
|
263
|
-
'Defines two coordinate systems which are skewed ' +
|
|
264
|
-
'relative to the origin coordinate system.<br/>' +
|
|
265
|
-
'Transformations can be nested to any level. The effect of nested ' +
|
|
266
|
-
'transformations is to post-multiply (i.e., concatenate) the subsequent ' +
|
|
267
|
-
'transformation matrices onto previously defined transformations.<br/>' +
|
|
268
|
-
'See the original documents: <a href="http://www.w3.org/TR/SVG11/images/coords/Skew.svg" target="_blank">skew</a> ' +
|
|
269
|
-
'and <a href="http://www.w3.org/TR/SVG11/images/coords/Nested.svg" target="_blank">nesting</a>.',
|
|
270
|
-
'<desc>Example Skew - Show effects of skewX and skewY</desc>\r\n' +
|
|
271
|
-
'<!-- Establish a new coordinate system whose origin is at (30,100)\r\n' +
|
|
272
|
-
' in the initial coord. system and which is skewed in X by 30 degrees. -->\r\n' +
|
|
273
|
-
'<g transform="translate(30,100)">\r\n' +
|
|
274
|
-
' <g transform="skewX(30)">\r\n' +
|
|
275
|
-
' <g fill="none" stroke="red" stroke-width="3" >\r\n' +
|
|
276
|
-
' <line x1="0" y1="0" x2="50" y2="0" />\r\n' +
|
|
277
|
-
' <line x1="0" y1="0" x2="0" y2="50" />\r\n' +
|
|
278
|
-
' </g>\r\n' +
|
|
279
|
-
' <text x="0" y="0" font-size="20" font-family="Verdana" fill="blue" >\r\n' +
|
|
280
|
-
' ABC (skewX)\r\n' +
|
|
281
|
-
' </text>\r\n' +
|
|
282
|
-
' </g>\r\n' +
|
|
283
|
-
'</g>\r\n' +
|
|
284
|
-
'<!-- Establish a new coordinate system whose origin is at (200,100)\r\n' +
|
|
285
|
-
' in the initial coord. system and which is skewed in Y by 30 degrees. -->\r\n' +
|
|
286
|
-
'<g transform="translate(200,100)">\r\n' +
|
|
287
|
-
' <g transform="skewY(30)">\r\n' +
|
|
288
|
-
' <g fill="none" stroke="red" stroke-width="3" >\r\n' +
|
|
289
|
-
' <line x1="0" y1="0" x2="50" y2="0" />\r\n' +
|
|
290
|
-
' <line x1="0" y1="0" x2="0" y2="50" />\r\n' +
|
|
291
|
-
' </g>\r\n' +
|
|
292
|
-
' <text x="0" y="0" font-size="20" font-family="Verdana" fill="blue" >\r\n' +
|
|
293
|
-
' ABC (skewY)\r\n' +
|
|
294
|
-
' </text>\r\n' +
|
|
295
|
-
' </g>\r\n' +
|
|
296
|
-
'</g>\r\n' +
|
|
297
|
-
'<!-- First, a translate -->\r\n' +
|
|
298
|
-
'<g transform="translate(450,150)">\r\n' +
|
|
299
|
-
' <g fill="none" stroke="red" stroke-width="3" >\r\n' +
|
|
300
|
-
' <line x1="0" y1="0" x2="50" y2="0" />\r\n' +
|
|
301
|
-
' <line x1="0" y1="0" x2="0" y2="50" />\r\n' +
|
|
302
|
-
' </g>\r\n' +
|
|
303
|
-
' <text x="0" y="0" font-size="16" font-family="Verdana" >\r\n' +
|
|
304
|
-
' ....Translate(1)\r\n' +
|
|
305
|
-
' </text>\r\n' +
|
|
306
|
-
' <!-- Second, a rotate -->\r\n' +
|
|
307
|
-
' <g transform="rotate(-45)">\r\n' +
|
|
308
|
-
' <g fill="none" stroke="green" stroke-width="3" >\r\n' +
|
|
309
|
-
' <line x1="0" y1="0" x2="50" y2="0" />\r\n' +
|
|
310
|
-
' <line x1="0" y1="0" x2="0" y2="50" />\r\n' +
|
|
311
|
-
' </g>\r\n' +
|
|
312
|
-
' <text x="0" y="0" font-size="16" font-family="Verdana" >\r\n' +
|
|
313
|
-
' ....Rotate(2)\r\n' +
|
|
314
|
-
' </text>\r\n' +
|
|
315
|
-
' <!-- Third, another translate -->\r\n' +
|
|
316
|
-
' <g transform="translate(130,160)">\r\n' +
|
|
317
|
-
' <g fill="none" stroke="blue" stroke-width="3" >\r\n' +
|
|
318
|
-
' <line x1="0" y1="0" x2="50" y2="0" />\r\n' +
|
|
319
|
-
' <line x1="0" y1="0" x2="0" y2="50" />\r\n' +
|
|
320
|
-
' </g>\r\n' +
|
|
321
|
-
' <text x="0" y="0" font-size="16" font-family="Verdana" >\r\n' +
|
|
322
|
-
' ....Translate(3)\r\n' +
|
|
323
|
-
' </text>\r\n' +
|
|
324
|
-
' </g>\r\n' +
|
|
325
|
-
' </g>\r\n' +
|
|
326
|
-
'</g>']];
|
|
327
|
-
|
|
328
|
-
// Populate the examples drop-down
|
|
329
|
-
function initExamples() {
|
|
330
|
-
var html = '<option value=""></option>';
|
|
331
|
-
for (var i = 0; i < examples.length; i++) {
|
|
332
|
-
html += '<option value="' + i + '">' + examples[i][0] + '</option>';
|
|
333
|
-
}
|
|
334
|
-
$('#example').html(html).change(pickExample)[0].selectedIndex = 0;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
// Display the selected example
|
|
338
|
-
function pickExample() {
|
|
339
|
-
var ex = $('#example').val();
|
|
340
|
-
if (!ex) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
$('#exampledesc').html(examples[ex][2]);
|
|
344
|
-
$('#svgsource pre').text(examples[ex][3]);
|
|
345
|
-
$('#svgcode pre').text(codeFormat(examples[ex][1].toString()));
|
|
346
|
-
var svg = svgManager.getSVGFor('#svgexample');
|
|
347
|
-
svg.clear();
|
|
348
|
-
examples[ex][1](svg);
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// Format the JavaScript SVG code for display
|
|
352
|
-
function codeFormat(code) {
|
|
353
|
-
var lines = code.split('\n');
|
|
354
|
-
var formatted = '';
|
|
355
|
-
for (var i = 0; i < lines.length; i++) {
|
|
356
|
-
var line = $.trim(lines[i]);
|
|
357
|
-
if (!line || line.length == 1 || line.substring(0, 9) == 'function ') {
|
|
358
|
-
continue;
|
|
359
|
-
}
|
|
360
|
-
while (line.length > 50) {
|
|
361
|
-
var pos = line.substr(0, 50).lastIndexOf(' ');
|
|
362
|
-
if (pos == -1) {
|
|
363
|
-
break;
|
|
364
|
-
}
|
|
365
|
-
formatted += line.substr(0, pos) + '\r\n ' + ($.browser.msie ? ' ' : '');
|
|
366
|
-
line = line.substr(pos + 1);
|
|
367
|
-
}
|
|
368
|
-
formatted += line + '\r\n';
|
|
369
|
-
}
|
|
370
|
-
return formatted;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
// Demonstrate basic SVG shapes and constructs
|
|
374
|
-
function basicShapesDemo(svg) {
|
|
375
|
-
svg.rect(null, 20, 50, 100, 50,
|
|
376
|
-
{fill: 'yellow', stroke: 'navy', stroke_width: 5});
|
|
377
|
-
svg.roundrect(null, 150, 50, 100, 50, 10, 10, {fill: 'green'});
|
|
378
|
-
var g = svg.group(null, {transform: 'translate(270 80) rotate(-30)'});
|
|
379
|
-
svg.roundrect(g, 0, 0, 100, 50, 10, 10, {fill: 'none', stroke: 'purple', stroke_width: 3});
|
|
380
|
-
svg.circle(null, 70, 220, 50, {fill: 'red', stroke: 'blue', stroke_width: 5});
|
|
381
|
-
var g = svg.group(null, {transform: 'translate(175 220)'});
|
|
382
|
-
svg.ellipse(g, '', '', 75, 50, {fill: 'yellow'});
|
|
383
|
-
svg.ellipse(null, '', '', 75, 50, {transform: 'translate(300 220) rotate(-30)',
|
|
384
|
-
fill: 'none', stroke: 'blue', stroke_width: 10});
|
|
385
|
-
var g = svg.group(null, {stroke: 'green'});
|
|
386
|
-
svg.line(g, 450, 120, 550, 20, {stroke_width: 5});
|
|
387
|
-
svg.line(g, 550, 120, 650, 20, {stroke_width: 10});
|
|
388
|
-
svg.line(g, 650, 120, 750, 20, {stroke_width: 15});
|
|
389
|
-
svg.line(g, 750, 120, 850, 20, {stroke_width: 20});
|
|
390
|
-
svg.line(g, 850, 120, 950, 20, {stroke_width: 25});
|
|
391
|
-
svg.polyline(null, [[450,250],
|
|
392
|
-
[475,250],[475,220],[500,220],[500,250],
|
|
393
|
-
[525,250],[525,200],[550,200],[550,250],
|
|
394
|
-
[575,250],[575,180],[600,180],[600,250],
|
|
395
|
-
[625,250],[625,160],[650,160],[650,250],[675,250]],
|
|
396
|
-
{fill: 'none', stroke: 'blue', stroke_width: 5});
|
|
397
|
-
svg.polygon(null, [[800,150],[900,180],[900,240],[800,270],[700,240],[700,180]],
|
|
398
|
-
{fill: 'lime', stroke: 'blue', stroke_width: 10});
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
// Demonstrate SVG filter effects
|
|
402
|
-
function filterDemo(svg) {
|
|
403
|
-
svg.describe(null, 'An example which combines multiple filter primitives ' +
|
|
404
|
-
'to produce a 3D lighting effect on a graphic consisting ' +
|
|
405
|
-
'of the string "SVG" sitting on top of oval filled in red ' +
|
|
406
|
-
'and surrounded by an oval outlined in red.');
|
|
407
|
-
var defs = svg.defs();
|
|
408
|
-
var filter = svg.filter(defs, 'MyFilter', 0, 0, 200, 120,
|
|
409
|
-
{filterUnits: 'userSpaceOnUse'});
|
|
410
|
-
svg.filters.gaussianBlur(filter, 'blur', 'SourceAlpha', 4);
|
|
411
|
-
svg.filters.offset(filter, 'offsetBlur', 'blur', 4, 4);
|
|
412
|
-
var spec = svg.filters.specularLighting(filter, 'specOut', 'blur',
|
|
413
|
-
5, 0.75, 20, {lighting_color: '#bbbbbb'});
|
|
414
|
-
svg.filters.pointLight(spec, '', -5000, -10000, 20000);
|
|
415
|
-
svg.filters.composite(filter, 'specOut', 'in', 'specOut', 'SourceAlpha');
|
|
416
|
-
svg.filters.composite(filter, 'litPaint', 'arithmetic', 'SourceGraphic',
|
|
417
|
-
'specOut', 0, 1, 1, 0);
|
|
418
|
-
var merge = svg.filters.merge(filter, '', ['offsetBlur', 'litPaint']);
|
|
419
|
-
var g1 = svg.group(null, {filter: 'url(#MyFilter)'});
|
|
420
|
-
var g2 = svg.group(g1);
|
|
421
|
-
var path = svg.createPath();
|
|
422
|
-
svg.path(g2, path.moveTo(50, 90).curveCTo(0, 90, 0, 30, 50, 30).
|
|
423
|
-
lineTo(150, 30).curveCTo(200, 30, 200, 90, 150, 90).close(),
|
|
424
|
-
{fill: 'none', stroke: '#D90000', stroke_width: 10});
|
|
425
|
-
svg.path(g2, path.reset().moveTo(60, 80).curveCTo(30, 80, 30, 40, 60, 40).
|
|
426
|
-
lineTo(140, 40).curveCTo(170, 40, 170, 80, 140, 80).close(),
|
|
427
|
-
{fill: '#D90000'});
|
|
428
|
-
var g3 = svg.group(g2, {fill: '#FFFFFF', stroke: 'black',
|
|
429
|
-
font_size: 45, font_family: 'Verdana'});
|
|
430
|
-
svg.text(g3, 52, 76, 'SVG');
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// Demonstrate SVG gradient and pattern fills
|
|
434
|
-
function gradientPatternDemo(svg) {
|
|
435
|
-
svg.describe(null, 'Example radgrad01 - fill a rectangle by ' +
|
|
436
|
-
'referencing a radial gradient paint server');
|
|
437
|
-
var g = svg.group();
|
|
438
|
-
var defs = svg.defs(g);
|
|
439
|
-
svg.radialGradient(defs, 'MyGradient',
|
|
440
|
-
[['0%', 'red'], ['50%', 'blue'], ['100%', 'red']],
|
|
441
|
-
200, 100, 150, 200, 100, {gradientUnits: 'userSpaceOnUse'});
|
|
442
|
-
svg.rect(g, 50, 50, 300, 100,
|
|
443
|
-
{fill: 'url(#MyGradient)', stroke: 'black', stroke_width: 5});
|
|
444
|
-
g = svg.group();
|
|
445
|
-
defs = svg.defs(g);
|
|
446
|
-
var ptn = svg.pattern(defs, 'TrianglePattern', 0, 0, 100, 100,
|
|
447
|
-
0, 0, 10, 10, {patternUnits: 'userSpaceOnUse'});
|
|
448
|
-
var path = svg.createPath();
|
|
449
|
-
svg.path(ptn, path.moveTo(0, 0).lineTo([[7, 0], [3.5, 7]]).close(),
|
|
450
|
-
{fill: 'red', stroke: 'blue'});
|
|
451
|
-
svg.ellipse(g, 550, 100, 175, 75,
|
|
452
|
-
{fill: 'url(#TrianglePattern)', stroke: 'black', stroke_width: 5});
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
// Demonstrate SVG interactivity
|
|
456
|
-
function interactiveDemo(svg) {
|
|
457
|
-
svg.describe(null, 'Example script01 - invoke an ECMAScript function from an onclick event');
|
|
458
|
-
svg.script(null, 'function circle_click(evt) {\n' +
|
|
459
|
-
' var circle = evt.target;\n' +
|
|
460
|
-
' var currentRadius = circle.getAttribute("r");\n' +
|
|
461
|
-
' if (currentRadius == 100)\n' +
|
|
462
|
-
' circle.setAttribute("r", currentRadius*2);\n' +
|
|
463
|
-
' else\n' +
|
|
464
|
-
' circle.setAttribute("r", currentRadius*0.5);\n' +
|
|
465
|
-
'}', 'text/ecmascript');
|
|
466
|
-
svg.circle(null, 300, 150, 100, {onclick: 'circle_click(evt)', fill: 'red'});
|
|
467
|
-
svg.text(null, 300, 280, 'Click on circle to change its size',
|
|
468
|
-
{font_family: 'Verdana', font_size: 35, text_anchor: 'middle'});
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
// Demonstrate SVG masking operations
|
|
472
|
-
function maskingDemo(svg) {
|
|
473
|
-
svg.describe(null, 'Example mask01 - blue text masked with gradient against red background');
|
|
474
|
-
var defs = svg.defs();
|
|
475
|
-
svg.linearGradient(defs, 'Gradient', [[0, 'white', 0], [1, 'white', 1]],
|
|
476
|
-
0, 0, 800, 0, {gradientUnits: 'userSpaceOnUse'});
|
|
477
|
-
var mask = svg.mask(defs, 'Mask', 0, 0, 800, 300, {maskUnits: 'userSpaceOnUse'});
|
|
478
|
-
svg.rect(mask, 0, 0, 800, 300, {fill: 'url(#Gradient)'});
|
|
479
|
-
svg.text(defs, 400, 200, 'Masked text', {id: 'Text',
|
|
480
|
-
font_family: 'Verdana', font_size: 100, text_anchor: 'middle'});
|
|
481
|
-
svg.rect(null, 0, 0, 800, 300, {fill: '#FF8080'});
|
|
482
|
-
svg.use(null, '#Text', {fill: 'blue', mask: 'url(#Mask)'});
|
|
483
|
-
svg.use(null, '#Text', {fill: 'none', stroke: 'black', stroke_width: 2});
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
// Demonstrate SVG text rendering
|
|
487
|
-
function textDemo(svg) {
|
|
488
|
-
var defs = svg.defs();
|
|
489
|
-
var path = svg.createPath();
|
|
490
|
-
svg.path(defs, path.moveTo(100, 200).curveCTo([[200, 100, 300, 0, 400, 100],
|
|
491
|
-
[500, 200, 600, 300, 700, 200], [800, 100, 900, 100, 900, 100]]),
|
|
492
|
-
{id: 'MyPath'});
|
|
493
|
-
svg.describe(null, 'Example toap02 - tspan within textPath');
|
|
494
|
-
svg.use(null, '#MyPath', {fill: 'none', stroke: 'red'});
|
|
495
|
-
var text = svg.text(null, '',
|
|
496
|
-
{font_family: 'Verdana', font_size: '42.5', fill: 'blue'});
|
|
497
|
-
var texts = svg.createText();
|
|
498
|
-
svg.textpath(text, '#MyPath', texts.string('We go ').span('up', {dy: -30, fill: 'red'}).
|
|
499
|
-
span(',', {dy: 30}).string(' then we go down, then up again'));
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
// Demonstrate SVG transformation support
|
|
503
|
-
function transformDemo(svg) {
|
|
504
|
-
svg.describe(null, 'Example Skew - Show effects of skewX and skewY');
|
|
505
|
-
var g1 = svg.group(null, {transform: 'translate(30,100)'});
|
|
506
|
-
var g2 = svg.group(g1, {transform: 'skewX(30)'});
|
|
507
|
-
var g3 = svg.group(g2, {fill: 'none', stroke: 'red', stroke_width: 3});
|
|
508
|
-
svg.line(g3, 0, 0, 50, 0);
|
|
509
|
-
svg.line(g3, 0, 0, 0, 50);
|
|
510
|
-
svg.text(g2, 0, 0, 'ABC (skewX)',
|
|
511
|
-
{font_size: 20, font_family: 'Verdana', fill: 'blue'});
|
|
512
|
-
g1 = svg.group(null, {transform: 'translate(200,100)'});
|
|
513
|
-
g2 = svg.group(g1, {transform: 'skewY(30)'});
|
|
514
|
-
g3 = svg.group(g2, {fill: 'none', stroke: 'red', stroke_width: 3});
|
|
515
|
-
svg.line(g3, 0, 0, 50, 0);
|
|
516
|
-
svg.line(g3, 0, 0, 0, 50);
|
|
517
|
-
svg.text(g2, 0, 0, 'ABC (skewY)',
|
|
518
|
-
{font_size: 20, font_family: 'Verdana', fill: 'blue'});
|
|
519
|
-
|
|
520
|
-
g1 = svg.group(null, {transform: 'translate(450,150)'});
|
|
521
|
-
g2 = svg.group(g1, {fill: 'none', stroke: 'red', stroke_width: 3});
|
|
522
|
-
svg.line(g2, 0, 0, 50, 0);
|
|
523
|
-
svg.line(g2, 0, 0, 0, 50);
|
|
524
|
-
svg.text(g1, 0, 0, '....Translate(1)',
|
|
525
|
-
{font_size: 16, font_family: 'Verdana'});
|
|
526
|
-
g2 = svg.group(g1, {transform: 'rotate(-45)'});
|
|
527
|
-
g3 = svg.group(g2, {fill: 'none', stroke: 'green', stroke_width: 3});
|
|
528
|
-
svg.line(g3, 0, 0, 50, 0);
|
|
529
|
-
svg.line(g3, 0, 0, 0, 50);
|
|
530
|
-
svg.text(g2, 0, 0, '....Rotate(2)',
|
|
531
|
-
{font_size: 16, font_family: 'Verdana'});
|
|
532
|
-
g3 = svg.group(g2, {transform: 'translate(130,160)'});
|
|
533
|
-
var g4 = svg.group(g3, {fill: 'none', stroke: 'blue', stroke_width: 3});
|
|
534
|
-
svg.line(g4, 0, 0, 50, 0);
|
|
535
|
-
svg.line(g4, 0, 0, 0, 50);
|
|
536
|
-
svg.text(g3, 0, 0, '....Translate(3)',
|
|
537
|
-
{font_size: 16, font_family: 'Verdana'});
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
// Demonstrate SVG referencing and CSS styling
|
|
541
|
-
function useStyleDemo(svg) {
|
|
542
|
-
svg.describe(null, 'Example Use04 - \'use\' with CSS styling');
|
|
543
|
-
var defs = svg.defs(null, '', {style: ' /* rule 9 */ stroke-miterlimit: 10'});
|
|
544
|
-
var path = svg.createPath();
|
|
545
|
-
svg.path(defs, path.moveTo(100, 50).lineTo([[700, 50], [700, 250], [100, 250]]),
|
|
546
|
-
{id: 'MyPath', _class: 'MyPathClass', style: ' /* rule 10 */ stroke-dasharray: 300,100'});
|
|
547
|
-
svg.style(null, '/* rule 1 */ #MyUse { fill: blue } ' +
|
|
548
|
-
'/* rule 2 */ #MyPath { stroke: red } ' +
|
|
549
|
-
'/* rule 3 */ use { fill-opacity: .5 } ' +
|
|
550
|
-
'/* rule 4 */ path { stroke-opacity: .5 } ' +
|
|
551
|
-
'/* rule 5 */ .MyUseClass { stroke-linecap: round } ' +
|
|
552
|
-
'/* rule 6 */ .MyPathClass { stroke-linejoin: bevel } ' +
|
|
553
|
-
'/* rule 7 */ use > path { shape-rendering: optimizeQuality } ' +
|
|
554
|
-
'/* rule 8 */ g > path { visibility: hidden }');
|
|
555
|
-
var g = svg.group(null, {style: ' /* rule 11 */ stroke-width: 40'});
|
|
556
|
-
svg.use(g, '#MyPath', {id: 'MyUse', _class: 'MyUseClass',
|
|
557
|
-
style: '/* rule 12 */ stroke-dashoffset: 50'});
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
// -----------------------------------------------------------------------------
|
|
561
|
-
|
|
562
|
-
// Add a node defined inline
|
|
563
|
-
function addInline() {
|
|
564
|
-
var svg = svgManager.getSVGFor('#svgload');
|
|
565
|
-
svg.add(null, '#svg1');
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
// Load an external document
|
|
569
|
-
function loadExternal() {
|
|
570
|
-
var svg = svgManager.getSVGFor('#svgload');
|
|
571
|
-
svg.load($('#loadURL').val());
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
// -----------------------------------------------------------------------------
|
|
575
|
-
|
|
576
|
-
// Synchronise the drawing section with user selection
|
|
577
|
-
function setDrawOptions() {
|
|
578
|
-
showHide = function(id, show) {
|
|
579
|
-
if (show) {
|
|
580
|
-
$(id).show();
|
|
581
|
-
}
|
|
582
|
-
else {
|
|
583
|
-
$(id).hide();
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
var shape = $('#shape').val();
|
|
587
|
-
showHide('#getRect', (shape == 'rect' || shape == 'roundrect'));
|
|
588
|
-
showHide('#getRounded', shape == 'roundrect');
|
|
589
|
-
showHide('#getCentre', (shape == 'circle' || shape == 'ellipse'));
|
|
590
|
-
showHide('#getRadius', (shape == 'circle'));
|
|
591
|
-
showHide('#getRadii', (shape == 'ellipse'));
|
|
592
|
-
showHide('#getLine', (shape == 'line'));
|
|
593
|
-
showHide('#getFill', (shape != 'line'));
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
var drawNodes = [];
|
|
597
|
-
var sketchpad = null;
|
|
598
|
-
|
|
599
|
-
$(document).ready(function() {
|
|
600
|
-
sketchpad = $('#svgsketch')[0];
|
|
601
|
-
});
|
|
602
|
-
|
|
603
|
-
// Draw the selected element on the canvas
|
|
604
|
-
function draw() {
|
|
605
|
-
var svg = svgManager.getSVGFor(sketchpad);
|
|
606
|
-
var rotate = $('#rotate').val();
|
|
607
|
-
var settings = $.extend({fill: $('#fill').val(),
|
|
608
|
-
stroke: $('#stroke').val(), stroke_width: $('#swidth').val()},
|
|
609
|
-
(rotate ? {transform: 'rotate(' + rotate + ')'} : {}));
|
|
610
|
-
var shape = $('#shape').val();
|
|
611
|
-
var node = null;
|
|
612
|
-
if (shape == 'rect') {
|
|
613
|
-
node = svg.rect(null, $('#left').val(), $('#top').val(),
|
|
614
|
-
$('#width').val(), $('#height').val(), settings);
|
|
615
|
-
}
|
|
616
|
-
else if (shape == 'roundrect') {
|
|
617
|
-
node = svg.roundrect(null, $('#left').val(), $('#top').val(),
|
|
618
|
-
$('#width').val(), $('#height').val(),
|
|
619
|
-
$('#roundX').val(), $('#roundY').val(), settings);
|
|
620
|
-
}
|
|
621
|
-
else if (shape == 'circle') {
|
|
622
|
-
node = svg.circle(null, $('#centreX').val(), $('#centreY').val(),
|
|
623
|
-
$('#radius').val(), settings);
|
|
624
|
-
}
|
|
625
|
-
else if (shape == 'ellipse') {
|
|
626
|
-
node = svg.ellipse(null, $('#centreX').val(), $('#centreY').val(),
|
|
627
|
-
$('#radiusX').val(), $('#radiusY').val(), settings);
|
|
628
|
-
}
|
|
629
|
-
else if (shape == 'line') {
|
|
630
|
-
node = svg.line(null, $('#startX').val(), $('#startY').val(),
|
|
631
|
-
$('#endX').val(), $('#endY').val(), settings);
|
|
632
|
-
}
|
|
633
|
-
drawNodes[drawNodes.length] = node;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
// Remove the last drawn element
|
|
637
|
-
function undo() {
|
|
638
|
-
if (!drawNodes.length) {
|
|
639
|
-
return;
|
|
640
|
-
}
|
|
641
|
-
var svg = svgManager.getSVGFor(sketchpad);
|
|
642
|
-
svg.remove(drawNodes[drawNodes.length - 1]);
|
|
643
|
-
drawNodes.splice(drawNodes.length - 1, 1);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
// Clear the canvas
|
|
647
|
-
function erase(name) {
|
|
648
|
-
svgManager.getSVGFor($(name)).clear();
|
|
649
|
-
drawNodes = [];
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
// -----------------------------------------------------------------------------
|
|
653
|
-
|
|
654
|
-
// Initialise the graphing options
|
|
655
|
-
function setGraphOptions() {
|
|
656
|
-
var html = '';
|
|
657
|
-
var chartTypes = svgGraphing.chartTypes();
|
|
658
|
-
for (var id in chartTypes) {
|
|
659
|
-
html += '<option value="' + id + '">' + chartTypes[id].title() + '</option>';
|
|
660
|
-
}
|
|
661
|
-
$('#chartType').html(html)[0].selectedIndex = 0;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
var firstGraph = true;
|
|
665
|
-
var chartArea = [[0.1, 0.1, 0.95, 0.9], [0.2, 0.1, 0.95, 0.9],
|
|
666
|
-
[0.1, 0.1, 0.8, 0.9], [0.1, 0.25, 0.9, 0.9], [0.1, 0.1, 0.9, 0.8]];
|
|
667
|
-
var legendArea = [[0.0, 0.0, 0.0, 0.0], [0.005, 0.1, 0.125, 0.5],
|
|
668
|
-
[0.875, 0.1, 0.995, 0.5], [0.2, 0.1, 0.8, 0.2], [0.2, 0.9, 0.8, 0.995]];
|
|
669
|
-
var fills = [['lightblue', 'url(#fadeBlue)'], ['pink', 'url(#fadeRed)'],
|
|
670
|
-
['lightgreen', 'url(#fadeGreen)']];
|
|
671
|
-
|
|
672
|
-
// Draw a new graph with the selected options
|
|
673
|
-
function graphIt() {
|
|
674
|
-
var svg = svgManager.getSVGFor('#svggraph');
|
|
675
|
-
if (firstGraph) {
|
|
676
|
-
var defs = svg.defs();
|
|
677
|
-
svg.linearGradient(defs, 'fadeBlue', [[0, 'lightblue'], [1, 'blue']]);
|
|
678
|
-
svg.linearGradient(defs, 'fadeRed', [[0, 'pink'], [1, 'red']]);
|
|
679
|
-
svg.linearGradient(defs, 'fadeGreen', [[0, 'lightgreen'], [1, 'green']]);
|
|
680
|
-
svg.graph.noDraw().title('Browser Usage').
|
|
681
|
-
addSeries('IE', [95.97, 91.80, 88.16, 86.64], 'lightblue', 'blue', 3).
|
|
682
|
-
addSeries('Netscape', [3.39, 2.83, 1.61, 0.00], 'pink', 'red', 3).
|
|
683
|
-
addSeries('Firefox', [0.00, 4.06, 8.13, 9.95], 'lightgreen', 'green', 3).
|
|
684
|
-
chartFormat('lightyellow', 'gray').
|
|
685
|
-
gridlines({stroke: 'gray', stroke_dasharray: '2,2'}, 'gray').
|
|
686
|
-
status(setStatus);
|
|
687
|
-
svg.graph.xAxis.title('Year').scale(0, 3).
|
|
688
|
-
ticks(1, 0).labels(['2002', '2004', '2005', '2006']);
|
|
689
|
-
svg.graph.yAxis.title('Percentage').scale(-5, 105).ticks(10, 5);
|
|
690
|
-
svg.graph.legend.settings({fill: 'lightgoldenrodyellow', stroke: 'gray'});
|
|
691
|
-
firstGraph = false;
|
|
692
|
-
}
|
|
693
|
-
var chartType = $('#chartType').val();
|
|
694
|
-
var legendPos = $('#legendPos').val() - 0;
|
|
695
|
-
var seriesFill = ($('#seriesFill').val() == 'plain' ? 0 : 1);
|
|
696
|
-
svg.graph.legend.show(legendPos).area(legendArea[legendPos]);
|
|
697
|
-
for (var i = 0; i < 3; i++) {
|
|
698
|
-
svg.graph.series()[i].format((fills[i])[seriesFill]);
|
|
699
|
-
}
|
|
700
|
-
svg.graph.noDraw().chartArea(chartArea[legendPos]).
|
|
701
|
-
chartType(chartType, {explode: [2], explodeDist: 10}).redraw();
|
|
702
|
-
chartType = svgGraphing.chartTypes()[chartType];
|
|
703
|
-
$('#graphDesc').text(chartType.description());
|
|
704
|
-
var options = '';
|
|
705
|
-
for (var i = 0; i < chartType.options().length; i++) {
|
|
706
|
-
options += '<li>' + chartType.options()[i] + '</li>';
|
|
707
|
-
}
|
|
708
|
-
$('#graphOptions').html(options || '<li>None</li>');
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
// Show the status values in a callback from the graph
|
|
712
|
-
function setStatus(value) {
|
|
713
|
-
window.status = value;
|
|
714
|
-
}
|