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

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

Issue 4123001: Modified chrome pageload extension (Closed) Base URL: http://src.chromium.org/svn/trunk/src/chrome/common/extensions/docs/examples/extensions/benchmark/
Patch Set: '' Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « jquery/jquery.flot.navigate.js ('k') | options.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* Value Labels Plugin for flot.
2 * Homepage:
3 * http://sites.google.com/site/petrsstuff/projects/flotvallab
4 *
5 * Released under the MIT license by Petr Blahos, December 2009.
6 *
7 */
8 (function ($) {
9 var options = {
10 valueLabels: {
11 show: false
12 }
13 };
14
15 function init(plot) {
16 plot.hooks.draw.push(function (plot, ctx) {
17 if (!plot.getOptions().valueLabels.show) {
18 return
19 }
20 $.each(plot.getData(), function(ii, series) {
21 plot.getPlaceholder().find("#valueLabels"+ii).remove();
22 var html = '<div id="valueLabels' + series.seriesIndex + '" class="v alueLabels">';
23 var last_val = null;
24 var last_x = -1000;
25 var last_y = -1000;
26 for (var i = 0; i < series.data.length; ++i) {
27 if (series.data[i] == null)
28 continue;
29
30 var x = series.data[i][0], y = series.data[i][1];
31 if (x < series.xaxis.min || x > series.xaxis.max || y < series.ya xis.min || y > series.yaxis.max)
32 continue;
33 var val = y;
34 if (series.valueLabelFunc) {
35 val = series.valueLabelFunc({
36 series: series,
37 seriesIndex: ii,
38 index: i
39 });
40 }
41 val = ""+val;
42 if (val!=last_val || i==series.data.length-1) {
43 var xx = series.xaxis.p2c(x)+plot.getPlotOffset().left;
44 var yy = series.yaxis.p2c(y)-12+plot.getPlotOffset().top;
45 if (Math.abs(yy-last_y)>20 || last_x<xx) {
46 last_val = val;
47 last_x = xx + val.length*8;
48 last_y = yy;
49 var head = '<div style="left:' + xx + 'px;top:' + yy + 'px; " class="valueLabel';
50 var tail;
51 /*Used for correct output of labels */
52 var $tabs = $('#tabs').tabs();
53 var active = $("#local-services input[type=radio]:checked") .val();
54 if(active == 'local-tracert-div')
55 tail = '">' + Conetserv.Plot.localTraceData.labels[i] + '</div>';
56 else
57 tail = '">' + Conetserv.Plot.localTrace6Data.labels[i] + '</div>';
58 html+= head + "Light" + tail + head + tail;
59 }
60 }
61 }
62 html+= "</div>";
63 plot.getPlaceholder().append(html);
64 });
65 });
66 }
67
68 $.plot.plugins.push({
69 init: init,
70 options: options,
71 name: 'valueLabels',
72 version: '1.0'
73 });
74 })(jQuery);
75
OLDNEW
« no previous file with comments | « jquery/jquery.flot.navigate.js ('k') | options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698