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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more