Skip to content

Commit

Permalink
更新调试代码:优化性能图表
Browse files Browse the repository at this point in the history
  • Loading branch information
iamscottxu committed Oct 10, 2020
1 parent e572bb9 commit c4e148e
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions debug/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ window.stats = function (statsTitle, min, max, color, container) {
var ctx = dom.getContext("2d");
ctx.scale(devicePixelRatio, devicePixelRatio);
ctx.fillStyle = "rgba(0,0,0,.7)";
ctx.beginPath();
ctx.moveTo(0 ,0);
/*var _length = GRAPH_WIDTH + 1 - values.length;
for (var i = 0; i <= GRAPH_WIDTH; i++) {
var percent = 1;
Expand All @@ -58,14 +56,9 @@ window.stats = function (statsTitle, min, max, color, container) {
ctx.lineTo(i, GRAPH_HEIGHT * percent);
};*/
values.forEach(function(value, index) {
ctx.lineTo(index, GRAPH_HEIGHT * (1 - (value - _min) / (_max - _min)));
ctx.fillRect(index, 0, 1, GRAPH_HEIGHT * (1 - (value - _min) / (_max - _min)));
});
if (values.length < GRAPH_WIDTH) {
ctx.lineTo(values.length - 1, GRAPH_HEIGHT);
ctx.lineTo(GRAPH_WIDTH, GRAPH_HEIGHT);
}
ctx.lineTo(GRAPH_WIDTH, 0);
ctx.fill();
ctx.fillRect(values.length, 0, GRAPH_WIDTH - values.length, GRAPH_HEIGHT);
};

var setMaxAndMin = function () {
Expand Down

0 comments on commit c4e148e

Please sign in to comment.