Sorted bar chart

This ingests a csv using d3.csv(); it loads the data into an object and gives us an opportunity to manipulate that object before inserting it into the chart. A smart approach might be declaring a constant equal to the original ingestion, and assigning that as the value of another variable - so that we store both a constant/original version, and a manipulated one.

This visualization spec uses the same approach with data.name and the additional code in vegaEmbed to read an array of data that has been ingested into the browser.

Additionally, in layer[0].encoding.x, we have a sort on the bar chart. But, it sorts by alphabetical order.


Back to main