alchemy 1.0.3 → 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 -2
- metadata +61 -223
- 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 -396
- data/app/assets/stylesheets/alchemy/components/_shared.scss +0 -18
- data/app/assets/stylesheets/alchemy/components/buttons/_buttons.scss +0 -278
- data/app/assets/stylesheets/alchemy/components/buttons/_buttons_vars.scss +0 -11
- 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 -552
- 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 -167
- data/app/assets/stylesheets/alchemy/components/forms/_forms_vars.scss +0 -25
- data/app/assets/stylesheets/alchemy/components/header/_header.scss +0 -216
- data/app/assets/stylesheets/alchemy/components/header/_header_vars.scss +0 -11
- data/app/assets/stylesheets/alchemy/components/login/_login.scss +0 -173
- 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 -35
- 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/engine.rb +0 -8
- 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/handlebars.js +0 -2201
- 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/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,238 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Flot plugin for plotting images, e.g. useful for putting ticks on a
|
|
3
|
-
prerendered complex visualization.
|
|
4
|
-
|
|
5
|
-
The data syntax is [[image, x1, y1, x2, y2], ...] where (x1, y1) and
|
|
6
|
-
(x2, y2) are where you intend the two opposite corners of the image to
|
|
7
|
-
end up in the plot. Image must be a fully loaded Javascript image (you
|
|
8
|
-
can make one with new Image()). If the image is not complete, it's
|
|
9
|
-
skipped when plotting.
|
|
10
|
-
|
|
11
|
-
There are two helpers included for retrieving images. The easiest work
|
|
12
|
-
the way that you put in URLs instead of images in the data (like
|
|
13
|
-
["myimage.png", 0, 0, 10, 10]), then call $.plot.image.loadData(data,
|
|
14
|
-
options, callback) where data and options are the same as you pass in
|
|
15
|
-
to $.plot. This loads the images, replaces the URLs in the data with
|
|
16
|
-
the corresponding images and calls "callback" when all images are
|
|
17
|
-
loaded (or failed loading). In the callback, you can then call $.plot
|
|
18
|
-
with the data set. See the included example.
|
|
19
|
-
|
|
20
|
-
A more low-level helper, $.plot.image.load(urls, callback) is also
|
|
21
|
-
included. Given a list of URLs, it calls callback with an object
|
|
22
|
-
mapping from URL to Image object when all images are loaded or have
|
|
23
|
-
failed loading.
|
|
24
|
-
|
|
25
|
-
Options for the plugin are
|
|
26
|
-
|
|
27
|
-
series: {
|
|
28
|
-
images: {
|
|
29
|
-
show: boolean
|
|
30
|
-
anchor: "corner" or "center"
|
|
31
|
-
alpha: [0,1]
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
which can be specified for a specific series
|
|
36
|
-
|
|
37
|
-
$.plot($("#placeholder"), [{ data: [ ... ], images: { ... } ])
|
|
38
|
-
|
|
39
|
-
Note that because the data format is different from usual data points,
|
|
40
|
-
you can't use images with anything else in a specific data series.
|
|
41
|
-
|
|
42
|
-
Setting "anchor" to "center" causes the pixels in the image to be
|
|
43
|
-
anchored at the corner pixel centers inside of at the pixel corners,
|
|
44
|
-
effectively letting half a pixel stick out to each side in the plot.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
A possible future direction could be support for tiling for large
|
|
48
|
-
images (like Google Maps).
|
|
49
|
-
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
(function ($) {
|
|
53
|
-
var options = {
|
|
54
|
-
series: {
|
|
55
|
-
images: {
|
|
56
|
-
show: false,
|
|
57
|
-
alpha: 1,
|
|
58
|
-
anchor: "corner" // or "center"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
$.plot.image = {};
|
|
64
|
-
|
|
65
|
-
$.plot.image.loadDataImages = function (series, options, callback) {
|
|
66
|
-
var urls = [], points = [];
|
|
67
|
-
|
|
68
|
-
var defaultShow = options.series.images.show;
|
|
69
|
-
|
|
70
|
-
$.each(series, function (i, s) {
|
|
71
|
-
if (!(defaultShow || s.images.show))
|
|
72
|
-
return;
|
|
73
|
-
|
|
74
|
-
if (s.data)
|
|
75
|
-
s = s.data;
|
|
76
|
-
|
|
77
|
-
$.each(s, function (i, p) {
|
|
78
|
-
if (typeof p[0] == "string") {
|
|
79
|
-
urls.push(p[0]);
|
|
80
|
-
points.push(p);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
$.plot.image.load(urls, function (loadedImages) {
|
|
86
|
-
$.each(points, function (i, p) {
|
|
87
|
-
var url = p[0];
|
|
88
|
-
if (loadedImages[url])
|
|
89
|
-
p[0] = loadedImages[url];
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
callback();
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
$.plot.image.load = function (urls, callback) {
|
|
97
|
-
var missing = urls.length, loaded = {};
|
|
98
|
-
if (missing == 0)
|
|
99
|
-
callback({});
|
|
100
|
-
|
|
101
|
-
$.each(urls, function (i, url) {
|
|
102
|
-
var handler = function () {
|
|
103
|
-
--missing;
|
|
104
|
-
|
|
105
|
-
loaded[url] = this;
|
|
106
|
-
|
|
107
|
-
if (missing == 0)
|
|
108
|
-
callback(loaded);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
$('<img />').load(handler).error(handler).attr('src', url);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function drawSeries(plot, ctx, series) {
|
|
116
|
-
var plotOffset = plot.getPlotOffset();
|
|
117
|
-
|
|
118
|
-
if (!series.images || !series.images.show)
|
|
119
|
-
return;
|
|
120
|
-
|
|
121
|
-
var points = series.datapoints.points,
|
|
122
|
-
ps = series.datapoints.pointsize;
|
|
123
|
-
|
|
124
|
-
for (var i = 0; i < points.length; i += ps) {
|
|
125
|
-
var img = points[i],
|
|
126
|
-
x1 = points[i + 1], y1 = points[i + 2],
|
|
127
|
-
x2 = points[i + 3], y2 = points[i + 4],
|
|
128
|
-
xaxis = series.xaxis, yaxis = series.yaxis,
|
|
129
|
-
tmp;
|
|
130
|
-
|
|
131
|
-
// actually we should check img.complete, but it
|
|
132
|
-
// appears to be a somewhat unreliable indicator in
|
|
133
|
-
// IE6 (false even after load event)
|
|
134
|
-
if (!img || img.width <= 0 || img.height <= 0)
|
|
135
|
-
continue;
|
|
136
|
-
|
|
137
|
-
if (x1 > x2) {
|
|
138
|
-
tmp = x2;
|
|
139
|
-
x2 = x1;
|
|
140
|
-
x1 = tmp;
|
|
141
|
-
}
|
|
142
|
-
if (y1 > y2) {
|
|
143
|
-
tmp = y2;
|
|
144
|
-
y2 = y1;
|
|
145
|
-
y1 = tmp;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// if the anchor is at the center of the pixel, expand the
|
|
149
|
-
// image by 1/2 pixel in each direction
|
|
150
|
-
if (series.images.anchor == "center") {
|
|
151
|
-
tmp = 0.5 * (x2-x1) / (img.width - 1);
|
|
152
|
-
x1 -= tmp;
|
|
153
|
-
x2 += tmp;
|
|
154
|
-
tmp = 0.5 * (y2-y1) / (img.height - 1);
|
|
155
|
-
y1 -= tmp;
|
|
156
|
-
y2 += tmp;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// clip
|
|
160
|
-
if (x1 == x2 || y1 == y2 ||
|
|
161
|
-
x1 >= xaxis.max || x2 <= xaxis.min ||
|
|
162
|
-
y1 >= yaxis.max || y2 <= yaxis.min)
|
|
163
|
-
continue;
|
|
164
|
-
|
|
165
|
-
var sx1 = 0, sy1 = 0, sx2 = img.width, sy2 = img.height;
|
|
166
|
-
if (x1 < xaxis.min) {
|
|
167
|
-
sx1 += (sx2 - sx1) * (xaxis.min - x1) / (x2 - x1);
|
|
168
|
-
x1 = xaxis.min;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (x2 > xaxis.max) {
|
|
172
|
-
sx2 += (sx2 - sx1) * (xaxis.max - x2) / (x2 - x1);
|
|
173
|
-
x2 = xaxis.max;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (y1 < yaxis.min) {
|
|
177
|
-
sy2 += (sy1 - sy2) * (yaxis.min - y1) / (y2 - y1);
|
|
178
|
-
y1 = yaxis.min;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (y2 > yaxis.max) {
|
|
182
|
-
sy1 += (sy1 - sy2) * (yaxis.max - y2) / (y2 - y1);
|
|
183
|
-
y2 = yaxis.max;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
x1 = xaxis.p2c(x1);
|
|
187
|
-
x2 = xaxis.p2c(x2);
|
|
188
|
-
y1 = yaxis.p2c(y1);
|
|
189
|
-
y2 = yaxis.p2c(y2);
|
|
190
|
-
|
|
191
|
-
// the transformation may have swapped us
|
|
192
|
-
if (x1 > x2) {
|
|
193
|
-
tmp = x2;
|
|
194
|
-
x2 = x1;
|
|
195
|
-
x1 = tmp;
|
|
196
|
-
}
|
|
197
|
-
if (y1 > y2) {
|
|
198
|
-
tmp = y2;
|
|
199
|
-
y2 = y1;
|
|
200
|
-
y1 = tmp;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
tmp = ctx.globalAlpha;
|
|
204
|
-
ctx.globalAlpha *= series.images.alpha;
|
|
205
|
-
ctx.drawImage(img,
|
|
206
|
-
sx1, sy1, sx2 - sx1, sy2 - sy1,
|
|
207
|
-
x1 + plotOffset.left, y1 + plotOffset.top,
|
|
208
|
-
x2 - x1, y2 - y1);
|
|
209
|
-
ctx.globalAlpha = tmp;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function processRawData(plot, series, data, datapoints) {
|
|
214
|
-
if (!series.images.show)
|
|
215
|
-
return;
|
|
216
|
-
|
|
217
|
-
// format is Image, x1, y1, x2, y2 (opposite corners)
|
|
218
|
-
datapoints.format = [
|
|
219
|
-
{ required: true },
|
|
220
|
-
{ x: true, number: true, required: true },
|
|
221
|
-
{ y: true, number: true, required: true },
|
|
222
|
-
{ x: true, number: true, required: true },
|
|
223
|
-
{ y: true, number: true, required: true }
|
|
224
|
-
];
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function init(plot) {
|
|
228
|
-
plot.hooks.processRawData.push(processRawData);
|
|
229
|
-
plot.hooks.drawSeries.push(drawSeries);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
$.plot.plugins.push({
|
|
233
|
-
init: init,
|
|
234
|
-
options: options,
|
|
235
|
-
name: 'image',
|
|
236
|
-
version: '1.1'
|
|
237
|
-
});
|
|
238
|
-
})(jQuery);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(c){var a={series:{images:{show:false,alpha:1,anchor:"corner"}}};c.plot.image={};c.plot.image.loadDataImages=function(g,f,k){var j=[],h=[];var i=f.series.images.show;c.each(g,function(l,m){if(!(i||m.images.show)){return}if(m.data){m=m.data}c.each(m,function(n,o){if(typeof o[0]=="string"){j.push(o[0]);h.push(o)}})});c.plot.image.load(j,function(l){c.each(h,function(n,o){var m=o[0];if(l[m]){o[0]=l[m]}});k()})};c.plot.image.load=function(h,i){var g=h.length,f={};if(g==0){i({})}c.each(h,function(k,j){var l=function(){--g;f[j]=this;if(g==0){i(f)}};c("<img />").load(l).error(l).attr("src",j)})};function d(q,o,l){var m=q.getPlotOffset();if(!l.images||!l.images.show){return}var r=l.datapoints.points,n=l.datapoints.pointsize;for(var t=0;t<r.length;t+=n){var y=r[t],w=r[t+1],g=r[t+2],v=r[t+3],f=r[t+4],h=l.xaxis,u=l.yaxis,x;if(!y||y.width<=0||y.height<=0){continue}if(w>v){x=v;v=w;w=x}if(g>f){x=f;f=g;g=x}if(l.images.anchor=="center"){x=0.5*(v-w)/(y.width-1);w-=x;v+=x;x=0.5*(f-g)/(y.height-1);g-=x;f+=x}if(w==v||g==f||w>=h.max||v<=h.min||g>=u.max||f<=u.min){continue}var k=0,s=0,j=y.width,p=y.height;if(w<h.min){k+=(j-k)*(h.min-w)/(v-w);w=h.min}if(v>h.max){j+=(j-k)*(h.max-v)/(v-w);v=h.max}if(g<u.min){p+=(s-p)*(u.min-g)/(f-g);g=u.min}if(f>u.max){s+=(s-p)*(u.max-f)/(f-g);f=u.max}w=h.p2c(w);v=h.p2c(v);g=u.p2c(g);f=u.p2c(f);if(w>v){x=v;v=w;w=x}if(g>f){x=f;f=g;g=x}x=o.globalAlpha;o.globalAlpha*=l.images.alpha;o.drawImage(y,k,s,j-k,p-s,w+m.left,g+m.top,v-w,f-g);o.globalAlpha=x}}function b(i,f,g,h){if(!f.images.show){return}h.format=[{required:true},{x:true,number:true,required:true},{y:true,number:true,required:true},{x:true,number:true,required:true},{y:true,number:true,required:true}]}function e(f){f.hooks.processRawData.push(b);f.hooks.drawSeries.push(d)}c.plot.plugins.push({init:e,options:a,name:"image",version:"1.1"})})(jQuery);
|