Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Side by Side Diff: third_party/flot/jquery.flot.js

Issue 2959503002: Enable Polymer.Settings.useNativeShadow on the dashboard. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « dashboard/dashboard/tests.html ('k') | third_party/flot/jquery.flot.min.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Javascript plotting library for jQuery, version 0.8.3. 1 /* Javascript plotting library for jQuery, version 0.8.3.
2 2
3 Copyright (c) 2007-2014 IOLA and Ole Laursen. 3 Copyright (c) 2007-2014 IOLA and Ole Laursen.
4 Licensed under the MIT license. 4 Licensed under the MIT license.
5 5
6 */ 6 */
7 7
8 // first an inline dependency, jquery.colorhelpers.js, we inline it here 8 // first an inline dependency, jquery.colorhelpers.js, we inline it here
9 // for convenience 9 // for convenience
10 10
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 // public functions 638 // public functions
639 plot.setData = setData; 639 plot.setData = setData;
640 plot.setupGrid = setupGrid; 640 plot.setupGrid = setupGrid;
641 plot.draw = draw; 641 plot.draw = draw;
642 plot.getPlaceholder = function() { return placeholder; }; 642 plot.getPlaceholder = function() { return placeholder; };
643 plot.getCanvas = function() { return surface.element; }; 643 plot.getCanvas = function() { return surface.element; };
644 plot.getPlotOffset = function() { return plotOffset; }; 644 plot.getPlotOffset = function() { return plotOffset; };
645 plot.width = function () { return plotWidth; }; 645 plot.width = function () { return plotWidth; };
646 plot.height = function () { return plotHeight; }; 646 plot.height = function () { return plotHeight; };
647 plot.offset = function () { 647 plot.offset = function () {
648 var o = eventHolder.offset(); 648 var o = eventHolder[0].getBoundingClientRect();
649 o.left += plotOffset.left; 649 o.left += plotOffset.left;
650 o.top += plotOffset.top; 650 o.top += plotOffset.top;
651 return o; 651 return o;
652 }; 652 };
653 plot.getData = function () { return series; }; 653 plot.getData = function () { return series; };
654 plot.getAxes = function () { 654 plot.getAxes = function () {
655 var res = {}, i; 655 var res = {}, i;
656 $.each(xaxes.concat(yaxes), function (_, axis) { 656 $.each(xaxes.concat(yaxes), function (_, axis) {
657 if (axis) 657 if (axis)
658 res[axis.direction + (axis.n != 1 ? axis.n : "") + "axis"] = axis; 658 res[axis.direction + (axis.n != 1 ? axis.n : "") + "axis"] = axis;
(...skipping 2280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2939 } 2939 }
2940 2940
2941 function onClick(e) { 2941 function onClick(e) {
2942 triggerClickHoverEvent("plotclick", e, 2942 triggerClickHoverEvent("plotclick", e,
2943 function (s) { return s["clickable"] != false ; }); 2943 function (s) { return s["clickable"] != false ; });
2944 } 2944 }
2945 2945
2946 // trigger click or hover event (they send the same parameters 2946 // trigger click or hover event (they send the same parameters
2947 // so we share their code) 2947 // so we share their code)
2948 function triggerClickHoverEvent(eventname, event, seriesFilter) { 2948 function triggerClickHoverEvent(eventname, event, seriesFilter) {
2949 var offset = eventHolder.offset(), 2949 // When Polymer.useNativeShadow is false, eventHolder.offset() works
2950 canvasX = event.pageX - offset.left - plotOffset.left, 2950 // because $.contains(document.documentElement, eventHolder[0]) is
2951 canvasY = event.pageY - offset.top - plotOffset.top, 2951 // true. When Polymer.useNativeShadow is true, $.contains() is false
2952 // when there is a shadow root between document.documentElement and
2953 // eventHolder[0].
2954 var offset = eventHolder[0].getBoundingClientRect();
2955 var canvasX = event.pageX - offset.left - plotOffset.left;
2956 var canvasY = event.pageY - offset.top - plotOffset.top;
2952 pos = canvasToAxisCoords({ left: canvasX, top: canvasY }); 2957 pos = canvasToAxisCoords({ left: canvasX, top: canvasY });
2953 2958
2954 pos.pageX = event.pageX; 2959 pos.pageX = event.pageX;
2955 pos.pageY = event.pageY; 2960 pos.pageY = event.pageY;
2956 2961
2957 var item = findNearbyItem(canvasX, canvasY, seriesFilter); 2962 var item = findNearbyItem(canvasX, canvasY, seriesFilter);
2958 2963
2959 if (item) { 2964 if (item) {
2960 // fill in mouse pos for any listeners out there 2965 // fill in mouse pos for any listeners out there
2961 item.pageX = parseInt(item.series.xaxis.p2c(item.datapoint[0]) + offset.left + plotOffset.left, 10); 2966 item.pageX = parseInt(item.series.xaxis.p2c(item.datapoint[0]) + offset.left + plotOffset.left, 10);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
3159 $.plot(this, data, options); 3164 $.plot(this, data, options);
3160 }); 3165 });
3161 }; 3166 };
3162 3167
3163 // round to nearby lower multiple of base 3168 // round to nearby lower multiple of base
3164 function floorInBase(n, base) { 3169 function floorInBase(n, base) {
3165 return base * Math.floor(n / base); 3170 return base * Math.floor(n / base);
3166 } 3171 }
3167 3172
3168 })(jQuery); 3173 })(jQuery);
OLDNEW
« no previous file with comments | « dashboard/dashboard/tests.html ('k') | third_party/flot/jquery.flot.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698