Skip to content

Commit 8d468f0

Browse files
committed
Stats fixes
1 parent ff3d10a commit 8d468f0

3 files changed

Lines changed: 40 additions & 10 deletions

File tree

components/modules/stats/BlocksFeed.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ const timeline = computed(() => {
4242
})
4343
time = new Set(time)
4444
45+
while (chartWidth.value / time.size < 35) {
46+
let arr = Array.from(time)
47+
arr.splice(Math.round(arr.length / 2), 1)
48+
time = new Set(arr)
49+
}
4550
return time
4651
})
4752

components/modules/stats/RollupsBubbleChart.vue

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ const buildChart = (chart, data) => {
8080
8181
const x = d3.scaleLog()
8282
.domain([1_000, maxBlobsCount + maxBlobsCount * 0.1])
83-
.range([ marginLeft, width ])
83+
.range([marginLeft, width])
8484
.base(10)
8585
.nice()
8686
@@ -90,7 +90,7 @@ const buildChart = (chart, data) => {
9090
9191
const y = d3.scaleLog()
9292
.domain([1, maxFee + maxFee * 0.3])
93-
.range([ height - 30, 0])
93+
.range([height + 5, 0])
9494
.base(10)
9595
.nice()
9696
@@ -138,7 +138,7 @@ const buildChart = (chart, data) => {
138138
139139
// Size legend
140140
let size = d3.scaleSqrt()
141-
.domain([minSize, maxSize / 2]) //[ minSize, maxSize ])
141+
.domain([minSize, maxSize / 2])
142142
.range([ 10, 35 ])
143143
144144
let legendValues = [500 * 1_024 * 1_024, midSize * 0.5, maxSize / 2]
@@ -201,14 +201,22 @@ const buildChart = (chart, data) => {
201201
tooltip.value.show = false
202202
}
203203
204+
const calculateY = (d) => {
205+
let cy = y(d.fee)
206+
if (cy > height - 30) {
207+
return height - 30 - 1
208+
}
209+
210+
return cy
211+
}
204212
// Draw chart
205213
const defs = svg.append("defs")
206214
data.forEach((d, i) => {
207215
defs.append("clipPath")
208216
.attr("id", `clip-${i}`)
209217
.append("circle")
210218
.attr("cx", x(d.blobs_count))
211-
.attr("cy", y(d.fee))
219+
.attr("cy", calculateY(d))
212220
.attr("r", 0)
213221
.transition()
214222
.duration(1_500)
@@ -221,7 +229,14 @@ const buildChart = (chart, data) => {
221229
.enter()
222230
.append("circle")
223231
.attr("cx", d => x(d.blobs_count))
224-
.attr("cy", d => y(d.fee))
232+
.attr("cy", d => {
233+
let cy = y(d.fee)
234+
if (cy > height - 30) {
235+
return height - 30 - 1
236+
}
237+
238+
return cy
239+
})
225240
.attr("r", 0)
226241
.attr("stroke", "var(--op-20)")
227242
.attr("stroke-width", 1)
@@ -240,7 +255,17 @@ const buildChart = (chart, data) => {
240255
.attr("width", d => z(d.size) * 2)
241256
.attr("height", d => z(d.size) * 2)
242257
.attr("x", d => x(d.blobs_count) - z(d.size))
243-
.attr("y", d => y(d.fee) - z(d.size))
258+
.attr("y", d => {
259+
let cy = y(d.fee)
260+
if (cy > height - 30) {
261+
console.log('cy', cy);
262+
console.log('height', height);
263+
264+
return height - 30 - z(d.size) - 1
265+
}
266+
267+
return cy - z(d.size)
268+
})
244269
.attr("clip-path", (d, i) => `url(#clip-${i})`)
245270
.style("filter", "brightness(60%)")
246271
.attr("class", "transition_all")

services/constants/stats.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export const STATS_SERIES = [
2727
},
2828
{
2929
name: 'bytes_in_block',
30-
title: 'Bytes In Block',
31-
page: 'bytes_in_block',
30+
title: 'Bytes In Blocks',
31+
page: 'bytes_in_blocks',
3232
units: 'bytes',
3333
tooltip: 'Bytes',
3434
aggregate: 'sum',
@@ -78,8 +78,8 @@ export const STATS_SERIES = [
7878
},
7979
{
8080
name: 'bytes_in_block',
81-
title: 'Bytes In Block',
82-
page: 'bytes_in_block',
81+
title: 'Bytes In Blocks',
82+
page: 'bytes_in_blocks',
8383
units: 'bytes',
8484
tooltip: 'Bytes',
8585
aggregate: 'cumulative',

0 commit comments

Comments
 (0)