For no particular reason, I wonder if it is at all possible to use DanfoJS Series object as my binding data() entry point?
Here is what I have so far
And here is my code:
function render(svg) {
// const xValue = d => d['Population (2020)'];
// const yValue = d => d['Country (or dependency)'];
// const xExtent = d3.extent(world_population, xValue);
// const xScale = d3
// .scaleLinear()
// .domain(xExtent)
// .range([0, width]);
// const yScale = d3
// .scaleBand()
// .domain(world_population.map(yValue))
// .range([0, height]);
const xValue = d => d.data;
const yValue = d => d.index;
const xExtent = d3.extent(plot_data.values);
const xScale = d3
.scaleLinear()
.domain(xExtent)
.range([0, width]);
const yScale = d3
.scaleBand()
.domain(plot_data.index)
.range([0, height]);
const selection = d3.select(svg);
selection
.selectAll('rect')
.data(plot_data)
.enter()
.append('rect')
.attr('fill', 'slateblue')
.attr('y', d => yScale(d.index))
.attr('width', d => xScale(d.data))
.attr('height', yScale.bandwidth());
}
Any help will be much appreciated