Skip to content

Commit c4e148e

Browse files
committed
更新调试代码:优化性能图表
1 parent e572bb9 commit c4e148e

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

debug/stats.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ window.stats = function (statsTitle, min, max, color, container) {
4646
var ctx = dom.getContext("2d");
4747
ctx.scale(devicePixelRatio, devicePixelRatio);
4848
ctx.fillStyle = "rgba(0,0,0,.7)";
49-
ctx.beginPath();
50-
ctx.moveTo(0 ,0);
5149
/*var _length = GRAPH_WIDTH + 1 - values.length;
5250
for (var i = 0; i <= GRAPH_WIDTH; i++) {
5351
var percent = 1;
@@ -58,14 +56,9 @@ window.stats = function (statsTitle, min, max, color, container) {
5856
ctx.lineTo(i, GRAPH_HEIGHT * percent);
5957
};*/
6058
values.forEach(function(value, index) {
61-
ctx.lineTo(index, GRAPH_HEIGHT * (1 - (value - _min) / (_max - _min)));
59+
ctx.fillRect(index, 0, 1, GRAPH_HEIGHT * (1 - (value - _min) / (_max - _min)));
6260
});
63-
if (values.length < GRAPH_WIDTH) {
64-
ctx.lineTo(values.length - 1, GRAPH_HEIGHT);
65-
ctx.lineTo(GRAPH_WIDTH, GRAPH_HEIGHT);
66-
}
67-
ctx.lineTo(GRAPH_WIDTH, 0);
68-
ctx.fill();
61+
ctx.fillRect(values.length, 0, GRAPH_WIDTH - values.length, GRAPH_HEIGHT);
6962
};
7063

7164
var setMaxAndMin = function () {

0 commit comments

Comments
 (0)