Published
Edited
Oct 12, 2020
1 star
Insert cell
md`# Colombo Stock Exchange`
Insert cell
{
const data = await getData();
const N = 40;

return drawBubbleChart(
data.slice(0, N).map(d =>
Object({
name:
d.symbol +
' $' +
d3.format('.3')(d.market_cap / 1000 / 1000 / 185) +
'M',
value: d.market_cap,
group: d.gics_type
})
),
{
width: 1000,
height: 1000,
caption: `Top ${N} Entities on the CSE by Market Cap.`
}
);
}
Insert cell
d3 = require('d3')
Insert cell
import { drawBubbleChart } from '@nuuuwan/bubble-chart'
Insert cell
async function getData() {
return (await d3.csv(
'https://raw.githubusercontent.com/nuuuwan/misc-sl-data/master/sl.cse.market_cap.2020.10.12.v2.csv'
))
.map(function(d) {
d.price = parseFloat(d.price);
d.issued_quantity = parseFloat(d.issued_quantity);
d.market_cap = parseFloat(d.market_cap);
return d;
})
.sort((a, b) => b.market_cap - a.market_cap);
}
Insert cell
getData()
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