Permalink
Browse files

bar charts

  • Loading branch information...
1 parent c89d07e commit 229a360293562ff2410f5c9a65fca124dfb947ed @tmaiaroto committed Jan 4, 2012
Showing with 438 additions and 8 deletions.
  1. +53 −5 views/elements/timers.html.php
  2. +1 −1 views/layouts/default.html.php
  3. +384 −2 webroot/js/g.bar-min.js
@@ -1,3 +1,11 @@
+<?php
+$percentages = array();
+$total = $timers['complete_load_with_li3_perf'];
+$percentages['complete_load'] = ($timers['complete_load'] / $total) * 100;
+$percentages['dispatch_cycle'] = ($timers['dispatch_cycle'] / $total) * 100;
+var_dump($percentages);
+
+?>
<h2>Time to Load</h2>
<?=$this->li3perf->printVars($timers); ?>
@@ -22,12 +30,52 @@
this.label[1].attr({"font-weight": 400});
}
};
-
+
+ var fin = function () {
+ this.flag = r.g.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this);
+ };
+ var fout = function () {
+ this.flag.animate({opacity: 0}, 300, function () {this.remove();});
+ };
+ var fin2 = function () {
+ var y = [], res = [];
+ for (var i = this.bars.length; i--;) {
+ y.push(this.bars[i].y);
+ res.push(this.bars[i].value || "0");
+ }
+ this.flag = r.g.popup(this.bars[0].x, Math.min.apply(Math, y), res.join(", ")).insertBefore(this);
+ };
+ var fout2 = function () {
+ this.flag.animate({opacity: 0}, 300, function () {this.remove();});
+ };
+
var r = Raphael("holder");
- r.g.txtattr.font = "12px 'Fontin Sans', Fontin-Sans, sans-serif";
-
- // first chart
- ///r.g.text(225, 25, "Chart Title").attr({"font-size": 20});
+
+ r.g.txtattr.font = "11px 'Fontin Sans', Fontin-Sans, sans-serif";
+ r.g.txtattr.fill = "white";
+
+ // r.g.hbarchart(330, 10, 300, 220, [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55]], {stacked: true}).hover(fin, fout);
+ //
+ //var data2 = [[55, 20, 13, 32, 5, 1, 2, 10], [10, 2, 1, 5, 32, 13, 20, 55], [12, 20, 30]];
+ //r.g.barchart(330, 10, 300, 220, data2, {stacked: true});
+
+ var timer_labels = [
+ ["Dispatch Cycle - <?=number_format($timers['dispatch_cycle'], 2); ?>s"],
+ ["Complete Load - <?=number_format($timers['complete_load'], 2); ?>s"],
+ ["Complete Load (with li3_perf toolbar) - <?=number_format($timers['complete_load_with_li3_perf'], 2); ?>s"]
+ ];
+ var timer_colors = [
+ "#4ddb49",
+ "#00A5F5",
+ "#444444"
+ ];
+
+ r.g.text(225, 25, "Time to Load").attr({"font-size": 20});
+
+ r.g.hbarchart(20, 55, 400, 110, [[<?=$percentages['dispatch_cycle']; ?>],[<?=$percentages['complete_load']; ?>],[100]], {stacked: false, colors: timer_colors}).label(timer_labels);
+ //
+ //r.g.hbarchart(10, 25, 300, 25, [[100], [200], [300]], {stacked: true}).hover(fin, fout);
+
};
@@ -1,5 +1,5 @@
<?php
-echo $this->html->script(array('/li3_perf/js/jquery.1.7.1.min.js', '/li3_perf/js/li3-perf.js'));
+echo $this->html->script(array('/li3_perf/js/jquery.1.7.1.min.js', '/li3_perf/js/li3-perf.js', '/li3_perf/js/raphael-min.js', '/li3_perf/js/g.raphael-min.js', '/li3_perf/js/g.bar-min.js', '/li3_perf/js/g.pie-min.js'));
echo $this->html->style(array('/li3_perf/css/li3-perf.css', '/li3_perf/css/dump_r.css', '/li3_perf/css/ccze.css'));
echo $this->content();
?>
Oops, something went wrong.

0 comments on commit 229a360

Please sign in to comment.