Filecoin Protocol Revenue by Month | dave c | Observable
ojs
Author
dave c
@dmc314
Comments (4)
Jinmiao Xie
May 17, 2023
remove ToDate function data: data.map((x) => ToDate(x.stat_date))
Jinmiao Xie
May 19, 2023
if you want to get this to aggregate by month instead of by day, please modify the code according to the following requirements: 1.Add the following code above Chart Script: month_data = Object.entries( data .map((x) => Object.assign({ month: x.stat_date.substring(0, 7) }, x)) .reduce((x, y) => { const { month } = y; x[month] = x[month] ?? []; x[month].push(y); return x; }, {}) ).map((i) => i[1].reduce((x, y) => { return { month: i[0], base_fee_burn: Number(x.base_fee_burn) + Number(y.base_fee_burn), overestimation_burn: Number(x.overestimation_burn) + Number(y.overestimation_burn), precommit_batch_fee_burn: Number(x.precommit_batch_fee_burn) + Number(y.precommit_batch_fee_burn), provecommit_batch_fee_burn: Number(x.provecommit_batch_fee_burn) + Number(y.provecommit_batch_fee_burn), penalty_fee_burn: Number(x.penalty_fee_burn) + Number(y.penalty_fee_burn), miner_tip: Number(x.base_fee_burn) + Number(y.miner_tip) }; }) )
May 19, 2023
2.Add `data: data.map((x) => x.month),` in option.xAxis 3.Replace all `data.map` with `month_data.map` in option.series
dave c
May 19, 2023
Nice thanks Jinmiao!
Reply
Add comment
Subscribe to notifications
© 2026 Observable, Inc.
Terms of service
Privacy policy
Product
About
Pricing
Documentation
Release notes
Contact us
Open source
Notebook Kit
Plot
D3
Community
Explore
Forum
Bluesky
YouTube
X
1
Follow
Follow
Filecoin Protocol Revenue by Month | dave c | Observable