added the flot chart

This commit is contained in:
hyung-hwan 2015-03-29 04:47:03 +00:00
parent c3ca69b67f
commit bc60619434
18 changed files with 331 additions and 247 deletions

View File

@ -19,8 +19,13 @@
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-sql.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/prettify/lang-vb.js')?>"></script>
<!--[if lte IE 8]><script type="text/javascript" src="<?=base_url_make('/js/excanvas.min.js')?>"></script><![endif]-->
<script type="text/javascript" src="<?=base_url_make('/js/jquery.min.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery-ui.min.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery.flot.min.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery.flot.time.min.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery.flot.categories.min.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/jquery.flot.pie.min.js')?>"></script>
<script type="text/javascript" src="<?=base_url_make('/js/Chart.js')?>"></script>
@ -129,94 +134,91 @@ function show_commits_per_month_graph(log)
commits_per_month_keys = commits_per_month_keys.sort();
orig_commits_per_month_keys = commits_per_month_keys.slice (0); // clone the array
var max_value = 0;
var x_scale = Math.ceil(commits_per_month_keys.length / 12);
if (x_scale <= 0) x_scale = 1;
for (i = 0; i < commits_per_month_keys.length; i++)
{
var commits = commits_per_month[commits_per_month_keys[i]];
var committers = committers_per_month[commits_per_month_keys[i]];
if (commits > max_value) max_value = commits;
if (committers > max_value) max_value = committers;
var time = (new Date(commits_per_month_keys[i] + "-01")).getTime();
commits_per_month_values.push ([time, commits]);
committers_per_month_values.push ([time, committers]);
commits_per_month_values.push (commits);
committers_per_month_values.push (committers);
// to work around the problem of too many data points.
// chart.js doesn't provide a means to skip x-labels.
// empty some points despite the side effect to tooltip titles.
if (i % x_scale) commits_per_month_keys[i] = '';
}
var commits_per_month_data = {
labels : commits_per_month_keys,
//////////////////////////////////////////////////
// this requires HYUNG-HWAN's change to Chart.js
tooltipLabels : orig_commits_per_month_keys,
//////////////////////////////////////////////////
datasets : [
var dataset =
[
{
label: 'Commits per month',
fillColor : 'rgba(151,187,245,0.2)',
strokeColor: "rgba(151,187,245,1.0)",
pointColor: "rgba(151,187,245,1.0)",
data : commits_per_month_values
label: "Commits Per Month",
data: commits_per_month_values,
//color: "#FF0000"
},
{
label: "Commiters Per Month",
data: committers_per_month_values,
//color: "#00FF00"
}
];
var options =
{
series: {
shadowSize: 0,
lines: { show: true, fill: true /*, lineWidth: 2*/ },
points: { show: false /*,lineWidth: 1*/ }
},
grid: { hoverable: true, clickable: true },
xaxes: [
{ mode: "time" },
{ mode: "time" }
],
yaxes: { }
}
$.plot($("#graph_main_commits_per_month"), dataset, options);
var previousPoint = null;
$("#graph_main_commits_per_month").bind("plothover", function (event, pos, item) {
function show_tooltip(x, y, contents) {
$('<div id="graph_main_commits_per_month_tooltip">' + contents + '</div>').css( {
position: 'absolute',
display: 'none',
top: y + 5,
left: x + 5,
border: '1px solid #fdd',
padding: '2px',
'background-color': '#fee',
'font-size': '0.8em',
'font-family': 'inherit',
opacity: 0.80
}).appendTo("body").fadeIn(200);
}
if (item)
{
label: 'Committers per month',
fillColor: "rgba(245,187,151,0.2)",
strokeColor: "rgba(245,187,151,1.0)",
pointColor: "rgba(245,187,151,1.0)",
data : committers_per_month_values
if (previousPoint != item.datapoint)
{
previousPoint = item.datapoint;
$("#graph_main_commits_per_month_tooltip").remove();
//show_tooltip(item.pageX, item.pageY, '(' + item.datapoint[0] + ', ' + item.datapoint[1]+')');
//show_tooltip(item.pageX, item.pageY - 20, item.datapoint[1]);
show_tooltip(item.pageX, item.pageY - 20, '(' + (new Date(item.datapoint[0])).toISOString().substring(0, 7) + ', ' + item.datapoint[1]+')');
}
]
}
var scale_steps = 5;
$('#graph_main_commits_per_month_canvas').each (function() {
var canvas = $(this)[0];
var ctx = canvas.getContext('2d');
var commits_per_month_chart = new Chart(ctx).Line(commits_per_month_data, {
responsive : true,
maintainAspectRatio: true,
animation: false,
pointDot: false,
scaleShowGridLines: true,
scaleShowHorizontalLines: true,
scaleShowVerticalLines: false,
scaleFontSize: 10,
scaleFontStyle: 'normal',
scaleFontColor: 'black',
scaleOverride: true,
scaleSteps: scale_steps,
scaleStepWidth: Math.ceil(max_value / scale_steps),
scaleStartValue: 0,
showTooltips: true,
tooltipFontSize: 10,
tooltipTitleFontSize: 10,
datasetFill: true,
datasetStroke: true,
datasetStrokeWidth: 1,
bezierCurve: true,
legendTemplate : '<ul class="<%=name.toLowerCase()%>-legend"><% for (var i=0; i<datasets.length; i++){%><li><span style="background-color:<%=datasets[i].strokeColor%>"><%if(datasets[i].label){%><%=datasets[i].label%><%}%></span></li><%}%></ul>'
else
{
$("#graph_main_commits_per_month_tooltip").remove();
previousPoint = null;
}
});
var legend = commits_per_month_chart.generateLegend();
$('#graph_main_commits_per_month_legend').html(legend);
});
}
function show_commits_per_user_graph(log)
{
var commits_per_user = [], commits_per_user_keys = [], commits_per_user_values = [];
var commits_per_user = [];
var commits_per_user_data = [];
var commit_share_by_user = [];
for (var i = 0; i < log.length; i++)
@ -230,70 +232,59 @@ function show_commits_per_user_graph(log)
for (var key in commits_per_user)
{
commits_per_user_keys.push (key);
commits_per_user_values.push (commits_per_user[key]);
commit_share_by_user.push (
{
value: commits_per_user[key],
commits_per_user_data.push ([key, commits_per_user[key]]);
commit_share_by_user.push ({
label: key,
//////////////////////////////////////////////////
// this requires HYUNG-HWAN's change to Chart.js
//tooltipLabel: key,
//////////////////////////////////////////////////
color: ('#' + Math.random().toString(16).substring(2, 8)) // generate random color
}
);
data: commits_per_user[key],
});
}
var commits_per_user_data = {
labels : commits_per_user_keys,
//////////////////////////////////////////////////
// this requires HYUNG-HWAN's change to Chart.js
tooltipLabels : commits_per_user_keys,
//////////////////////////////////////////////////
datasets : [
var dataset =
[
{
label: 'Commits per user',
fillColor : 'rgba(151,187,245,0.2)',
strokeColor: "rgba(151,187,245,1.0)",
pointColor: "rgba(151,187,245,1.0)",
data : commits_per_user_values
label: "Commits Per User",
data: commits_per_user_data
//color: "#FF0000"
}
]
];
var options =
{
series: {
shadowSize: 0,
bars: {
show: true,
fill: true,
align: "center",
barWidth: 0.1
}
},
//grid: { hoverable: true, clickable: true },
xaxes: [
{ mode: "categories" },
],
yaxes: { }
};
$.plot($("#graph_main_commits_per_user"), dataset, options);
options =
{
series: {
shadowSize: 0,
pie: {
show: true,
fill: true
}
}
};
$.plot($("#graph_main_commit_share_by_user"), commit_share_by_user, options);
}
$('#graph_main_commits_per_user_canvas').each (function() {
var canvas = $(this)[0];
var ctx = canvas.getContext('2d');
var commits_per_user_chart = new Chart(ctx).Bar(commits_per_user_data, {
responsive : true,
maintainAspectRatio: true,
animation: false,
showTooltips: true,
tooltipFontSize: 10,
tooltipTitleFontSize: 10
});
});
$('#graph_main_commit_share_by_user_canvas').each (function() {
var canvas = $(this)[0];
var ctx = canvas.getContext('2d');
var commit_share_by_user_chart = new Chart(ctx).Pie(commit_share_by_user, {
responsive : true,
maintainAspectRatio: true,
animation: false
});
var legend = commit_share_by_user_chart.generateLegend();
$('#graph_main_commit_share_by_user_legend').html(legend);
});
}
function show_all_graphs (response)
{
@ -306,6 +297,10 @@ function show_all_graphs (response)
show_commits_per_month_graph (log);
show_commits_per_user_graph (log);
}
function render_graphs()
@ -377,18 +372,13 @@ $this->load->view (
<?=htmlspecialchars($project->name)?>
</div>
<div id="graph_main_commits_per_month">
<div id='graph_main_commits_per_month_legend'></div>
<canvas id='graph_main_commits_per_month_canvas'></canvas>
<div id="graph_main_commits_per_month" style="width:50%; height: 400px; margin-bottom: 1em;">
</div> <!-- graph_main_commits_per_month-->
<div id="graph_main_commits_per_user">
<canvas id='graph_main_commits_per_user_canvas'></canvas>
<div id="graph_main_commits_per_user" style="width:50%; height: 400px; margin-bottom: 1em;">
</div> <!-- graph_main_commits_per_user-->
<div id="graph_main_commit_share_by_user">
<div id='graph_main_commit_share_by_user_legend'></div>
<canvas id='graph_main_commit_share_by_user_canvas'></canvas>
<div id="graph_main_commit_share_by_user" style="width:50%; height: 400px; margin-bottom: 1em;">
</div> <!-- graph_main_commits_per_user-->
</div> <!-- graph_main_mainarea -->

View File

@ -101,18 +101,18 @@ body {
}
.content .taskbar form input[type="text"] {
height: 1.8em; // lower than line-height of taskbar
height: 1.8em; /* lower than line-height of taskbar */
vertical-align: middle;
}
.content .taskbar form input[type="password"] {
height: 1.8em; // lower than line-height of taskbar
height: 1.8em; /* lower than line-height of taskbar */
vertical-align: middle;
}
.content .taskbar form input[type="submit"] {
cursor: pointer;
height: 1.8em; // lower than line-height of taskbar
height: 1.8em; /* lower than line-height of taskbar */
vertical-align: middle;
padding-left: 5px;
padding-right: 5px;
@ -213,108 +213,46 @@ body {
background-color: #BBCCDD;
}
.content .mainarea .form_container {
padding: 0.3em 0.5em 0.3em 0.5em;
border: 1px solid #BBCCDD;
line-height: 2.2em;
margin: 0;
}
.content .mainarea form {
margin: 0;
}
.content .mainarea form label
{
.content .mainarea form fieldset {
margin: 0;
border: 1px solid #BBCCDD;
}
.content .mainarea form label {
font-style: italic;
font-weight: bold;
font-size: inherit;
}
.content .mainarea form input
{
vertical-align: middle;
border: none;
-moz-box-shadow: 0 2px 4px #bbb inset;
-webkit-box-shadow: 0 2px 4px #BBB inset;
box-shadow: 0 2px 4px #BBB inset;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
height: 1.8em;
font-size: inherit;
padding-left: 0.2em;
padding-right: 0.2em;
.content .mainarea form input[type="text"] {
border: 1px solid #BBCCDD;
}
.content .mainarea form input:focus {
background-color: #E1E1E1;
outline: 0;
.content .mainarea form input[type="password"] {
border: 1px solid #BBCCDD;
}
.content .mainarea form input[type="submit"]
{
cursor: pointer;
height: 2em;
vertical-align: middle;
padding-left: 5px;
padding-right: 5px;
text-transform: uppercase;
background: #3498db;
background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
background-image: -moz-linear-gradient(top, #3498db, #2980b9);
background-image: -ms-linear-gradient(top, #3498db, #2980b9);
background-image: -o-linear-gradient(top, #3498db, #2980b9);
background-image: linear-gradient(to bottom, #3498db, #2980b9);
-webkit-border-radius: 28;
-moz-border-radius: 28;
border-radius: 5px;
text-shadow: 1px 1px 3px #666666;
color: #ffffff;
text-decoration: none;
font-size: 1em;
border: 0 none;
}
.content .mainarea form input[type="submit"]:hover
{
background: #3cb0fd;
background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);
background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
text-decoration: none;
}
.content .mainarea form textarea
{
vertical-align: middle;
border: 1px solid #B9BDC1;
-moz-box-shadow: 0 2px 4px #bbb inset;
-webkit-box-shadow: 0 2px 4px #BBB inset;
box-shadow: 0 2px 4px #BBB inset;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
.content .mainarea form textarea {
border: 1px solid #BBCCDD;
font-family: consolas, "Andale Mono", monospace;
font-size: inherit;
padding: 0.2em 0.2em 0.2em 0.2em;
}
.content .mainarea form textarea:focus
{
background-color: #E1E1E1;
outline: 0;
.content .mainarea .form_input_label {
margin-bottom: 0.2em;
}
.content .mainarea form .ui-button
{
/* jquery-ui button inside the form */
.content .mainarea .form_input_label .ui-button {
font-size: 80%;
font-style: italic;
}
.content .mainarea .form_input_field {
margin-bottom: 0.5em;
}
.content .mainarea .form_input_preview {
@ -322,13 +260,14 @@ body {
/*border: 1px solid #DDDDDD;*/
background-color: #FFFFF0;
font-size: 90%;
padding: 0.2em 0.2em 0.2em 0.2em;
line-height: 1.2em;
}
.content .mainarea .form_input_preview pre {
/*background-color: inherit;*/
background-color: #F8F8FA;
padding: 0.2em 0.2em 0.2em 0.2em;
padding: 0.3em;
/*background-color: #FDF5D6;*/
/*border: none;*/
}
.content .mainarea .icon {
@ -685,7 +624,7 @@ pre.prettyprint li.L9 { background: #eee }
background-position: 0px 1px !important;
padding-left: 24px;
height: 1.8em; // lower than line-height of taskbar
height: 1.8em; /* lower than line-height of taskbar */
vertical-align: middle;
border: 1px solid #B9BDC1;
@ -707,7 +646,7 @@ pre.prettyprint li.L9 { background: #eee }
background-position: 0px 1px !important;
padding-left: 24px;
height: 1.8em; // lower than line-height of taskbar
height: 1.8em; /* lower than line-height of taskbar */
vertical-align: middle;
border: 1px solid #B9BDC1;
@ -726,7 +665,7 @@ pre.prettyprint li.L9 { background: #eee }
#taskbar_signin_button {
cursor: pointer;
height: 1.8em; // lower than line-height of taskbar
height: 1.8em; /* lower than line-height of taskbar */
vertical-align: middle;
padding-left: 5px;
padding-right: 5px;
@ -758,7 +697,7 @@ pre.prettyprint li.L9 { background: #eee }
#taskbar_signout_button {
cursor: pointer;
height: 1.8em; // lower than line-height of taskbar
height: 1.8em; /* lower than line-height of taskbar */
vertical-align: middle;
padding-left: 5px;
padding-right: 5px;
@ -793,48 +732,96 @@ pre.prettyprint li.L9 { background: #eee }
/* ================ login page =================== */
#login_user_name
{
#login_user_name {
background: url("images/username.png") no-repeat scroll 0% 0% rgb(234, 231, 231);
background-position: 0px 3px !important;
padding-left: 24px;
height: 2.2em;
vertical-align: middle;
border: 1px solid #B9BDC1;
-moz-box-shadow: 0 2px 4px #bbb inset;
-webkit-box-shadow: 0 2px 4px #BBB inset;
box-shadow: 0 2px 4px #BBB inset;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
font-size: 1em;
border: 0 none;
}
#login_user_name:focus
{
background-color: #E1E1E1;
#login_user_name:focus {
background-color: #E7E8E7;
outline: 0;
}
#login_user_pass
{
#login_user_pass {
background: url("images/password.png") no-repeat scroll 0% 0% rgb(234, 231, 231);
background-position: 0px 3px !important;
padding-left: 24px;
height: 2.2em;
vertical-align: middle;
border: 1px solid #B9BDC1;
-moz-box-shadow: 0 2px 4px #bbb inset;
-webkit-box-shadow: 0 2px 4px #BBB inset;
box-shadow: 0 2px 4px #BBB inset;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
font-size: 1em;
border: 0 none;
}
#login_user_pass:focus
{
background-color: #E1E1E1;
#login_user_pass:focus {
background-color: #E7E8E7;
outline: 0;
}
#login_signin_button
{
/* make it higher than the standard submit buttons */
height: 2.5em;
#login_signin_button {
cursor: pointer;
height: 2em;
vertical-align: middle;
padding-left: 5px;
padding-right: 5px;
text-transform: uppercase;
background: #3498db;
background-image: -webkit-linear-gradient(top, #3498db, #2980b9);
background-image: -moz-linear-gradient(top, #3498db, #2980b9);
background-image: -ms-linear-gradient(top, #3498db, #2980b9);
background-image: -o-linear-gradient(top, #3498db, #2980b9);
background-image: linear-gradient(to bottom, #3498db, #2980b9);
-webkit-border-radius: 28;
-moz-border-radius: 28;
border-radius: 5px;
text-shadow: 1px 1px 3px #666666;
color: #ffffff;
text-decoration: none;
font-size: 1em;
border: 0 none;
}
#login_mainarea .form_container form .form_input_field
{
/* keep it similar to taskbar and make it higher than normal form */
#login_signin_button:hover {
background: #3cb0fd;
background-image: -webkit-linear-gradient(top, #3cb0fd, #3498db);
background-image: -moz-linear-gradient(top, #3cb0fd, #3498db);
background-image: -ms-linear-gradient(top, #3cb0fd, #3498db);
background-image: -o-linear-gradient(top, #3cb0fd, #3498db);
background-image: linear-gradient(to bottom, #3cb0fd, #3498db);
text-decoration: none;
}
#login_mainarea .login_form_field_div { /* keep it similar to taskbar */
text-transform: uppercase;
padding-top: 0.3em;
padding-bottom: 0.3em;
vertical-align: middle;
font-size: 1em;
}

1
codepot/src/js/excanvas.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,7 @@
/* Javascript plotting library for jQuery, version 0.8.3.
Copyright (c) 2007-2014 IOLA and Ole Laursen.
Licensed under the MIT license.
*/
(function($){var options={canvas:true};var render,getTextInfo,addText;var hasOwnProperty=Object.prototype.hasOwnProperty;function init(plot,classes){var Canvas=classes.Canvas;if(render==null){getTextInfo=Canvas.prototype.getTextInfo,addText=Canvas.prototype.addText,render=Canvas.prototype.render}Canvas.prototype.render=function(){if(!plot.getOptions().canvas){return render.call(this)}var context=this.context,cache=this._textCache;context.save();context.textBaseline="middle";for(var layerKey in cache){if(hasOwnProperty.call(cache,layerKey)){var layerCache=cache[layerKey];for(var styleKey in layerCache){if(hasOwnProperty.call(layerCache,styleKey)){var styleCache=layerCache[styleKey],updateStyles=true;for(var key in styleCache){if(hasOwnProperty.call(styleCache,key)){var info=styleCache[key],positions=info.positions,lines=info.lines;if(updateStyles){context.fillStyle=info.font.color;context.font=info.font.definition;updateStyles=false}for(var i=0,position;position=positions[i];i++){if(position.active){for(var j=0,line;line=position.lines[j];j++){context.fillText(lines[j].text,line[0],line[1])}}else{positions.splice(i--,1)}}if(positions.length==0){delete styleCache[key]}}}}}}}context.restore()};Canvas.prototype.getTextInfo=function(layer,text,font,angle,width){if(!plot.getOptions().canvas){return getTextInfo.call(this,layer,text,font,angle,width)}var textStyle,layerCache,styleCache,info;text=""+text;if(typeof font==="object"){textStyle=font.style+" "+font.variant+" "+font.weight+" "+font.size+"px "+font.family}else{textStyle=font}layerCache=this._textCache[layer];if(layerCache==null){layerCache=this._textCache[layer]={}}styleCache=layerCache[textStyle];if(styleCache==null){styleCache=layerCache[textStyle]={}}info=styleCache[text];if(info==null){var context=this.context;if(typeof font!=="object"){var element=$("<div>&nbsp;</div>").css("position","absolute").addClass(typeof font==="string"?font:null).appendTo(this.getTextLayer(layer));font={lineHeight:element.height(),style:element.css("font-style"),variant:element.css("font-variant"),weight:element.css("font-weight"),family:element.css("font-family"),color:element.css("color")};font.size=element.css("line-height",1).height();element.remove()}textStyle=font.style+" "+font.variant+" "+font.weight+" "+font.size+"px "+font.family;info=styleCache[text]={width:0,height:0,positions:[],lines:[],font:{definition:textStyle,color:font.color}};context.save();context.font=textStyle;var lines=(text+"").replace(/<br ?\/?>|\r\n|\r/g,"\n").split("\n");for(var i=0;i<lines.length;++i){var lineText=lines[i],measured=context.measureText(lineText);info.width=Math.max(measured.width,info.width);info.height+=font.lineHeight;info.lines.push({text:lineText,width:measured.width,height:font.lineHeight})}context.restore()}return info};Canvas.prototype.addText=function(layer,x,y,text,font,angle,width,halign,valign){if(!plot.getOptions().canvas){return addText.call(this,layer,x,y,text,font,angle,width,halign,valign)}var info=this.getTextInfo(layer,text,font,angle,width),positions=info.positions,lines=info.lines;y+=info.height/lines.length/2;if(valign=="middle"){y=Math.round(y-info.height/2)}else if(valign=="bottom"){y=Math.round(y-info.height)}else{y=Math.round(y)}if(!!(window.opera&&window.opera.version().split(".")[0]<12)){y-=2}for(var i=0,position;position=positions[i];i++){if(position.x==x&&position.y==y){position.active=true;return}}position={active:true,lines:[],x:x,y:y};positions.push(position);for(var i=0,line;line=lines[i];i++){if(halign=="center"){position.lines.push([Math.round(x-line.width/2),y])}else if(halign=="right"){position.lines.push([Math.round(x-line.width),y])}else{position.lines.push([Math.round(x),y])}y+=line.height}}}$.plot.plugins.push({init:init,options:options,name:"canvas",version:"1.0"})})(jQuery);

View File

@ -0,0 +1,7 @@
/* Javascript plotting library for jQuery, version 0.8.3.
Copyright (c) 2007-2014 IOLA and Ole Laursen.
Licensed under the MIT license.
*/
(function($){var options={xaxis:{categories:null},yaxis:{categories:null}};function processRawData(plot,series,data,datapoints){var xCategories=series.xaxis.options.mode=="categories",yCategories=series.yaxis.options.mode=="categories";if(!(xCategories||yCategories))return;var format=datapoints.format;if(!format){var s=series;format=[];format.push({x:true,number:true,required:true});format.push({y:true,number:true,required:true});if(s.bars.show||s.lines.show&&s.lines.fill){var autoscale=!!(s.bars.show&&s.bars.zero||s.lines.show&&s.lines.zero);format.push({y:true,number:true,required:false,defaultValue:0,autoscale:autoscale});if(s.bars.horizontal){delete format[format.length-1].y;format[format.length-1].x=true}}datapoints.format=format}for(var m=0;m<format.length;++m){if(format[m].x&&xCategories)format[m].number=false;if(format[m].y&&yCategories)format[m].number=false}}function getNextIndex(categories){var index=-1;for(var v in categories)if(categories[v]>index)index=categories[v];return index+1}function categoriesTickGenerator(axis){var res=[];for(var label in axis.categories){var v=axis.categories[label];if(v>=axis.min&&v<=axis.max)res.push([v,label])}res.sort(function(a,b){return a[0]-b[0]});return res}function setupCategoriesForAxis(series,axis,datapoints){if(series[axis].options.mode!="categories")return;if(!series[axis].categories){var c={},o=series[axis].options.categories||{};if($.isArray(o)){for(var i=0;i<o.length;++i)c[o[i]]=i}else{for(var v in o)c[v]=o[v]}series[axis].categories=c}if(!series[axis].options.ticks)series[axis].options.ticks=categoriesTickGenerator;transformPointsOnAxis(datapoints,axis,series[axis].categories)}function transformPointsOnAxis(datapoints,axis,categories){var points=datapoints.points,ps=datapoints.pointsize,format=datapoints.format,formatColumn=axis.charAt(0),index=getNextIndex(categories);for(var i=0;i<points.length;i+=ps){if(points[i]==null)continue;for(var m=0;m<ps;++m){var val=points[i+m];if(val==null||!format[m][formatColumn])continue;if(!(val in categories)){categories[val]=index;++index}points[i+m]=categories[val]}}}function processDatapoints(plot,series,datapoints){setupCategoriesForAxis(series,"xaxis",datapoints);setupCategoriesForAxis(series,"yaxis",datapoints)}function init(plot){plot.hooks.processRawData.push(processRawData);plot.hooks.processDatapoints.push(processDatapoints)}$.plot.plugins.push({init:init,options:options,name:"categories",version:"1.0"})})(jQuery);

View File

@ -0,0 +1,7 @@
/* Javascript plotting library for jQuery, version 0.8.3.
Copyright (c) 2007-2014 IOLA and Ole Laursen.
Licensed under the MIT license.
*/
(function($){var options={crosshair:{mode:null,color:"rgba(170, 0, 0, 0.80)",lineWidth:1}};function init(plot){var crosshair={x:-1,y:-1,locked:false};plot.setCrosshair=function setCrosshair(pos){if(!pos)crosshair.x=-1;else{var o=plot.p2c(pos);crosshair.x=Math.max(0,Math.min(o.left,plot.width()));crosshair.y=Math.max(0,Math.min(o.top,plot.height()))}plot.triggerRedrawOverlay()};plot.clearCrosshair=plot.setCrosshair;plot.lockCrosshair=function lockCrosshair(pos){if(pos)plot.setCrosshair(pos);crosshair.locked=true};plot.unlockCrosshair=function unlockCrosshair(){crosshair.locked=false};function onMouseOut(e){if(crosshair.locked)return;if(crosshair.x!=-1){crosshair.x=-1;plot.triggerRedrawOverlay()}}function onMouseMove(e){if(crosshair.locked)return;if(plot.getSelection&&plot.getSelection()){crosshair.x=-1;return}var offset=plot.offset();crosshair.x=Math.max(0,Math.min(e.pageX-offset.left,plot.width()));crosshair.y=Math.max(0,Math.min(e.pageY-offset.top,plot.height()));plot.triggerRedrawOverlay()}plot.hooks.bindEvents.push(function(plot,eventHolder){if(!plot.getOptions().crosshair.mode)return;eventHolder.mouseout(onMouseOut);eventHolder.mousemove(onMouseMove)});plot.hooks.drawOverlay.push(function(plot,ctx){var c=plot.getOptions().crosshair;if(!c.mode)return;var plotOffset=plot.getPlotOffset();ctx.save();ctx.translate(plotOffset.left,plotOffset.top);if(crosshair.x!=-1){var adj=plot.getOptions().crosshair.lineWidth%2?.5:0;ctx.strokeStyle=c.color;ctx.lineWidth=c.lineWidth;ctx.lineJoin="round";ctx.beginPath();if(c.mode.indexOf("x")!=-1){var drawX=Math.floor(crosshair.x)+adj;ctx.moveTo(drawX,0);ctx.lineTo(drawX,plot.height())}if(c.mode.indexOf("y")!=-1){var drawY=Math.floor(crosshair.y)+adj;ctx.moveTo(0,drawY);ctx.lineTo(plot.width(),drawY)}ctx.stroke()}ctx.restore()});plot.hooks.shutdown.push(function(plot,eventHolder){eventHolder.unbind("mouseout",onMouseOut);eventHolder.unbind("mousemove",onMouseMove)})}$.plot.plugins.push({init:init,options:options,name:"crosshair",version:"1.0"})})(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,7 @@
/* Javascript plotting library for jQuery, version 0.8.3.
Copyright (c) 2007-2014 IOLA and Ole Laursen.
Licensed under the MIT license.
*/
(function($){var options={series:{fillBetween:null}};function init(plot){function findBottomSeries(s,allseries){var i;for(i=0;i<allseries.length;++i){if(allseries[i].id===s.fillBetween){return allseries[i]}}if(typeof s.fillBetween==="number"){if(s.fillBetween<0||s.fillBetween>=allseries.length){return null}return allseries[s.fillBetween]}return null}function computeFillBottoms(plot,s,datapoints){if(s.fillBetween==null){return}var other=findBottomSeries(s,plot.getData());if(!other){return}var ps=datapoints.pointsize,points=datapoints.points,otherps=other.datapoints.pointsize,otherpoints=other.datapoints.points,newpoints=[],px,py,intery,qx,qy,bottom,withlines=s.lines.show,withbottom=ps>2&&datapoints.format[2].y,withsteps=withlines&&s.lines.steps,fromgap=true,i=0,j=0,l,m;while(true){if(i>=points.length){break}l=newpoints.length;if(points[i]==null){for(m=0;m<ps;++m){newpoints.push(points[i+m])}i+=ps}else if(j>=otherpoints.length){if(!withlines){for(m=0;m<ps;++m){newpoints.push(points[i+m])}}i+=ps}else if(otherpoints[j]==null){for(m=0;m<ps;++m){newpoints.push(null)}fromgap=true;j+=otherps}else{px=points[i];py=points[i+1];qx=otherpoints[j];qy=otherpoints[j+1];bottom=0;if(px===qx){for(m=0;m<ps;++m){newpoints.push(points[i+m])}bottom=qy;i+=ps;j+=otherps}else if(px>qx){if(withlines&&i>0&&points[i-ps]!=null){intery=py+(points[i-ps+1]-py)*(qx-px)/(points[i-ps]-px);newpoints.push(qx);newpoints.push(intery);for(m=2;m<ps;++m){newpoints.push(points[i+m])}bottom=qy}j+=otherps}else{if(fromgap&&withlines){i+=ps;continue}for(m=0;m<ps;++m){newpoints.push(points[i+m])}if(withlines&&j>0&&otherpoints[j-otherps]!=null){bottom=qy+(otherpoints[j-otherps+1]-qy)*(px-qx)/(otherpoints[j-otherps]-qx)}i+=ps}fromgap=false;if(l!==newpoints.length&&withbottom){newpoints[l+2]=bottom}}if(withsteps&&l!==newpoints.length&&l>0&&newpoints[l]!==null&&newpoints[l]!==newpoints[l-ps]&&newpoints[l+1]!==newpoints[l-ps+1]){for(m=0;m<ps;++m){newpoints[l+ps+m]=newpoints[l+m]}newpoints[l+1]=newpoints[l-ps+1]}}datapoints.points=newpoints}plot.hooks.processDatapoints.push(computeFillBottoms)}$.plot.plugins.push({init:init,options:options,name:"fillbetween",version:"1.0"})})(jQuery);

View File

@ -0,0 +1,7 @@
/* Javascript plotting library for jQuery, version 0.8.3.
Copyright (c) 2007-2014 IOLA and Ole Laursen.
Licensed under the MIT license.
*/
(function($){var options={series:{images:{show:false,alpha:1,anchor:"corner"}}};$.plot.image={};$.plot.image.loadDataImages=function(series,options,callback){var urls=[],points=[];var defaultShow=options.series.images.show;$.each(series,function(i,s){if(!(defaultShow||s.images.show))return;if(s.data)s=s.data;$.each(s,function(i,p){if(typeof p[0]=="string"){urls.push(p[0]);points.push(p)}})});$.plot.image.load(urls,function(loadedImages){$.each(points,function(i,p){var url=p[0];if(loadedImages[url])p[0]=loadedImages[url]});callback()})};$.plot.image.load=function(urls,callback){var missing=urls.length,loaded={};if(missing==0)callback({});$.each(urls,function(i,url){var handler=function(){--missing;loaded[url]=this;if(missing==0)callback(loaded)};$("<img />").load(handler).error(handler).attr("src",url)})};function drawSeries(plot,ctx,series){var plotOffset=plot.getPlotOffset();if(!series.images||!series.images.show)return;var points=series.datapoints.points,ps=series.datapoints.pointsize;for(var i=0;i<points.length;i+=ps){var img=points[i],x1=points[i+1],y1=points[i+2],x2=points[i+3],y2=points[i+4],xaxis=series.xaxis,yaxis=series.yaxis,tmp;if(!img||img.width<=0||img.height<=0)continue;if(x1>x2){tmp=x2;x2=x1;x1=tmp}if(y1>y2){tmp=y2;y2=y1;y1=tmp}if(series.images.anchor=="center"){tmp=.5*(x2-x1)/(img.width-1);x1-=tmp;x2+=tmp;tmp=.5*(y2-y1)/(img.height-1);y1-=tmp;y2+=tmp}if(x1==x2||y1==y2||x1>=xaxis.max||x2<=xaxis.min||y1>=yaxis.max||y2<=yaxis.min)continue;var sx1=0,sy1=0,sx2=img.width,sy2=img.height;if(x1<xaxis.min){sx1+=(sx2-sx1)*(xaxis.min-x1)/(x2-x1);x1=xaxis.min}if(x2>xaxis.max){sx2+=(sx2-sx1)*(xaxis.max-x2)/(x2-x1);x2=xaxis.max}if(y1<yaxis.min){sy2+=(sy1-sy2)*(yaxis.min-y1)/(y2-y1);y1=yaxis.min}if(y2>yaxis.max){sy1+=(sy1-sy2)*(yaxis.max-y2)/(y2-y1);y2=yaxis.max}x1=xaxis.p2c(x1);x2=xaxis.p2c(x2);y1=yaxis.p2c(y1);y2=yaxis.p2c(y2);if(x1>x2){tmp=x2;x2=x1;x1=tmp}if(y1>y2){tmp=y2;y2=y1;y1=tmp}tmp=ctx.globalAlpha;ctx.globalAlpha*=series.images.alpha;ctx.drawImage(img,sx1,sy1,sx2-sx1,sy2-sy1,x1+plotOffset.left,y1+plotOffset.top,x2-x1,y2-y1);ctx.globalAlpha=tmp}}function processRawData(plot,series,data,datapoints){if(!series.images.show)return;datapoints.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 init(plot){plot.hooks.processRawData.push(processRawData);plot.hooks.drawSeries.push(drawSeries)}$.plot.plugins.push({init:init,options:options,name:"image",version:"1.1"})})(jQuery);

8
codepot/src/js/jquery.flot.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

7
codepot/src/js/jquery.flot.pie.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,7 @@
/* Javascript plotting library for jQuery, version 0.8.3.
Copyright (c) 2007-2014 IOLA and Ole Laursen.
Licensed under the MIT license.
*/
(function($,e,t){"$:nomunge";var i=[],n=$.resize=$.extend($.resize,{}),a,r=false,s="setTimeout",u="resize",m=u+"-special-event",o="pendingDelay",l="activeDelay",f="throttleWindow";n[o]=200;n[l]=20;n[f]=true;$.event.special[u]={setup:function(){if(!n[f]&&this[s]){return false}var e=$(this);i.push(this);e.data(m,{w:e.width(),h:e.height()});if(i.length===1){a=t;h()}},teardown:function(){if(!n[f]&&this[s]){return false}var e=$(this);for(var t=i.length-1;t>=0;t--){if(i[t]==this){i.splice(t,1);break}}e.removeData(m);if(!i.length){if(r){cancelAnimationFrame(a)}else{clearTimeout(a)}a=null}},add:function(e){if(!n[f]&&this[s]){return false}var i;function a(e,n,a){var r=$(this),s=r.data(m)||{};s.w=n!==t?n:r.width();s.h=a!==t?a:r.height();i.apply(this,arguments)}if($.isFunction(e)){i=e;return a}else{i=e.handler;e.handler=a}}};function h(t){if(r===true){r=t||1}for(var s=i.length-1;s>=0;s--){var l=$(i[s]);if(l[0]==e||l.is(":visible")){var f=l.width(),c=l.height(),d=l.data(m);if(d&&(f!==d.w||c!==d.h)){l.trigger(u,[d.w=f,d.h=c]);r=t||true}}else{d=l.data(m);d.w=0;d.h=0}}if(a!==null){if(r&&(t==null||t-r<1e3)){a=e.requestAnimationFrame(h)}else{a=setTimeout(h,n[o]);r=false}}}if(!e.requestAnimationFrame){e.requestAnimationFrame=function(){return e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame||e.msRequestAnimationFrame||function(t,i){return e.setTimeout(function(){t((new Date).getTime())},n[l])}}()}if(!e.cancelAnimationFrame){e.cancelAnimationFrame=function(){return e.webkitCancelRequestAnimationFrame||e.mozCancelRequestAnimationFrame||e.oCancelRequestAnimationFrame||e.msCancelRequestAnimationFrame||clearTimeout}()}})(jQuery,this);(function($){var options={};function init(plot){function onResize(){var placeholder=plot.getPlaceholder();if(placeholder.width()==0||placeholder.height()==0)return;plot.resize();plot.setupGrid();plot.draw()}function bindEvents(plot,eventHolder){plot.getPlaceholder().resize(onResize)}function shutdown(plot,eventHolder){plot.getPlaceholder().unbind("resize",onResize)}plot.hooks.bindEvents.push(bindEvents);plot.hooks.shutdown.push(shutdown)}$.plot.plugins.push({init:init,options:options,name:"resize",version:"1.0"})})(jQuery);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,7 @@
/* Javascript plotting library for jQuery, version 0.8.3.
Copyright (c) 2007-2014 IOLA and Ole Laursen.
Licensed under the MIT license.
*/
(function($){var options={series:{stack:null}};function init(plot){function findMatchingSeries(s,allseries){var res=null;for(var i=0;i<allseries.length;++i){if(s==allseries[i])break;if(allseries[i].stack==s.stack)res=allseries[i]}return res}function stackData(plot,s,datapoints){if(s.stack==null||s.stack===false)return;var other=findMatchingSeries(s,plot.getData());if(!other)return;var ps=datapoints.pointsize,points=datapoints.points,otherps=other.datapoints.pointsize,otherpoints=other.datapoints.points,newpoints=[],px,py,intery,qx,qy,bottom,withlines=s.lines.show,horizontal=s.bars.horizontal,withbottom=ps>2&&(horizontal?datapoints.format[2].x:datapoints.format[2].y),withsteps=withlines&&s.lines.steps,fromgap=true,keyOffset=horizontal?1:0,accumulateOffset=horizontal?0:1,i=0,j=0,l,m;while(true){if(i>=points.length)break;l=newpoints.length;if(points[i]==null){for(m=0;m<ps;++m)newpoints.push(points[i+m]);i+=ps}else if(j>=otherpoints.length){if(!withlines){for(m=0;m<ps;++m)newpoints.push(points[i+m])}i+=ps}else if(otherpoints[j]==null){for(m=0;m<ps;++m)newpoints.push(null);fromgap=true;j+=otherps}else{px=points[i+keyOffset];py=points[i+accumulateOffset];qx=otherpoints[j+keyOffset];qy=otherpoints[j+accumulateOffset];bottom=0;if(px==qx){for(m=0;m<ps;++m)newpoints.push(points[i+m]);newpoints[l+accumulateOffset]+=qy;bottom=qy;i+=ps;j+=otherps}else if(px>qx){if(withlines&&i>0&&points[i-ps]!=null){intery=py+(points[i-ps+accumulateOffset]-py)*(qx-px)/(points[i-ps+keyOffset]-px);newpoints.push(qx);newpoints.push(intery+qy);for(m=2;m<ps;++m)newpoints.push(points[i+m]);bottom=qy}j+=otherps}else{if(fromgap&&withlines){i+=ps;continue}for(m=0;m<ps;++m)newpoints.push(points[i+m]);if(withlines&&j>0&&otherpoints[j-otherps]!=null)bottom=qy+(otherpoints[j-otherps+accumulateOffset]-qy)*(px-qx)/(otherpoints[j-otherps+keyOffset]-qx);newpoints[l+accumulateOffset]+=bottom;i+=ps}fromgap=false;if(l!=newpoints.length&&withbottom)newpoints[l+2]+=bottom}if(withsteps&&l!=newpoints.length&&l>0&&newpoints[l]!=null&&newpoints[l]!=newpoints[l-ps]&&newpoints[l+1]!=newpoints[l-ps+1]){for(m=0;m<ps;++m)newpoints[l+ps+m]=newpoints[l+m];newpoints[l+1]=newpoints[l-ps+1]}}datapoints.points=newpoints}plot.hooks.processDatapoints.push(stackData)}$.plot.plugins.push({init:init,options:options,name:"stack",version:"1.2"})})(jQuery);

View File

@ -0,0 +1,7 @@
/* Javascript plotting library for jQuery, version 0.8.3.
Copyright (c) 2007-2014 IOLA and Ole Laursen.
Licensed under the MIT license.
*/
(function($){function processRawData(plot,series,datapoints){var handlers={square:function(ctx,x,y,radius,shadow){var size=radius*Math.sqrt(Math.PI)/2;ctx.rect(x-size,y-size,size+size,size+size)},diamond:function(ctx,x,y,radius,shadow){var size=radius*Math.sqrt(Math.PI/2);ctx.moveTo(x-size,y);ctx.lineTo(x,y-size);ctx.lineTo(x+size,y);ctx.lineTo(x,y+size);ctx.lineTo(x-size,y)},triangle:function(ctx,x,y,radius,shadow){var size=radius*Math.sqrt(2*Math.PI/Math.sin(Math.PI/3));var height=size*Math.sin(Math.PI/3);ctx.moveTo(x-size/2,y+height/2);ctx.lineTo(x+size/2,y+height/2);if(!shadow){ctx.lineTo(x,y-height/2);ctx.lineTo(x-size/2,y+height/2)}},cross:function(ctx,x,y,radius,shadow){var size=radius*Math.sqrt(Math.PI)/2;ctx.moveTo(x-size,y-size);ctx.lineTo(x+size,y+size);ctx.moveTo(x-size,y+size);ctx.lineTo(x+size,y-size)}};var s=series.points.symbol;if(handlers[s])series.points.symbol=handlers[s]}function init(plot){plot.hooks.processDatapoints.push(processRawData)}$.plot.plugins.push({init:init,name:"symbols",version:"1.0"})})(jQuery);

View File

@ -0,0 +1,7 @@
/* Javascript plotting library for jQuery, version 0.8.3.
Copyright (c) 2007-2014 IOLA and Ole Laursen.
Licensed under the MIT license.
*/
(function($){var options={series:{threshold:null}};function init(plot){function thresholdData(plot,s,datapoints,below,color){var ps=datapoints.pointsize,i,x,y,p,prevp,thresholded=$.extend({},s);thresholded.datapoints={points:[],pointsize:ps,format:datapoints.format};thresholded.label=null;thresholded.color=color;thresholded.threshold=null;thresholded.originSeries=s;thresholded.data=[];var origpoints=datapoints.points,addCrossingPoints=s.lines.show;var threspoints=[];var newpoints=[];var m;for(i=0;i<origpoints.length;i+=ps){x=origpoints[i];y=origpoints[i+1];prevp=p;if(y<below)p=threspoints;else p=newpoints;if(addCrossingPoints&&prevp!=p&&x!=null&&i>0&&origpoints[i-ps]!=null){var interx=x+(below-y)*(x-origpoints[i-ps])/(y-origpoints[i-ps+1]);prevp.push(interx);prevp.push(below);for(m=2;m<ps;++m)prevp.push(origpoints[i+m]);p.push(null);p.push(null);for(m=2;m<ps;++m)p.push(origpoints[i+m]);p.push(interx);p.push(below);for(m=2;m<ps;++m)p.push(origpoints[i+m])}p.push(x);p.push(y);for(m=2;m<ps;++m)p.push(origpoints[i+m])}datapoints.points=newpoints;thresholded.datapoints.points=threspoints;if(thresholded.datapoints.points.length>0){var origIndex=$.inArray(s,plot.getData());plot.getData().splice(origIndex+1,0,thresholded)}}function processThresholds(plot,s,datapoints){if(!s.threshold)return;if(s.threshold instanceof Array){s.threshold.sort(function(a,b){return a.below-b.below});$(s.threshold).each(function(i,th){thresholdData(plot,s,datapoints,th.below,th.color)})}else{thresholdData(plot,s,datapoints,s.threshold.below,s.threshold.color)}}plot.hooks.processDatapoints.push(processThresholds)}$.plot.plugins.push({init:init,options:options,name:"threshold",version:"1.2"})})(jQuery);

File diff suppressed because one or more lines are too long