Skip to content

Commit f760ce1

Browse files
authored
fix: scaling for transaction metrics (#273)
Signed-off-by: Brian Lee <[email protected]>
1 parent 4c80e06 commit f760ce1

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

internal/api/static/index.html

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,10 @@
249249
scales: {
250250
y: {
251251
beginAtZero: true,
252-
max: 20,
253252
ticks: {
254-
stepSize: 5,
253+
stepSize: 250,
255254
callback: function (value) {
256-
return value % 5 === 0 ? value : '';
255+
return value % 250 === 0 ? value : '';
257256
},
258257
color: 'white',
259258
},
@@ -360,11 +359,19 @@
360359
];
361360
charts.goRuntime.update();
362361

362+
const maxTxValue = Math.max(
363+
metrics.tx_submit_count,
364+
metrics.tx_submit_fail_count
365+
);
366+
367+
const txMaxScale = Math.ceil(maxTxValue / 100) * 100 + 500; //buffer of 500
368+
369+
charts.tx.options.scales.y.max = txMaxScale;
370+
console.log('txMaxScale', txMaxScale);
363371
charts.tx.data.datasets[0].data = [
364372
metrics.tx_submit_count,
365373
metrics.tx_submit_fail_count,
366374
];
367-
368375
charts.tx.update();
369376
}
370377

0 commit comments

Comments
 (0)