Published
Edited
Mar 4, 2021
Importers
Insert cell
Insert cell
Insert cell
viewof table = Table(tableData(ipfsData, filecoinData, 1), { rows: 20 })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function tableData (ipfsTransitions, filecoinTransitions, weeksAgo) {
const ipfsFlows = ipfsTransitions[ipfsTransitions.length - weeksAgo]?.transitions
const prevIpfsFlows = ipfsTransitions[ipfsTransitions.length - weeksAgo - 1]?.transitions
const filFlows = filecoinTransitions[filecoinTransitions.length - weeksAgo]?.transitions
const prevFilFlows = filecoinTransitions[filecoinTransitions.length - weeksAgo - 1]?.transitions
const res = Object.keys(ipfsFlows).map((flow, i) => {
const fil = filFlows[flow]
const ipfs = ipfsFlows[flow]
const total = fil + ipfs
const prevTotal = prevFilFlows[flow] + prevIpfsFlows[flow]
const growthRate = Math.round(((total - prevTotal) / prevTotal) * 100)
return {flow, fil, ipfs, total, prevTotal, growthRate }
})
return res
}
Insert cell
Insert cell
Insert cell
import { ipfsGetTransitionsUrl, filecoinGetTransitionsUrl } from "@protocol/pmf-endpoints"
Insert cell
import { Table } from '@observablehq/inputs';
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more