bl.ocks.org/Eleonore9/978e35ff4bbdf53de90c896e2afdc879
This simple bar chart forked from mbostock's block: Bar Chart
Aim: I'm hoping to create a reusable template for my data viz needs
Idea: I'm expecting data as CSV file and I'm reusing most of mbostock's original project.
Note: The template is still being tested and updated to make it more generic
Fork the project
Upload your CSV file
In index.html
, update the top section:
// *** EDIT TO CUSTOMISE ***
var dataFile = "test-data.csv",
xName = "year", // column name for x-axis in the csv
xAxisLabel = "Years",
xLabelxPosition = 0, xLabelyPosition = 40,
yName = "value", // column name for y-axis in the csv
yAxisLabel = "Value"
yLabelxPosition = 0, yLabelyPosition = -15;
function transformXdata(data) {
return data;
}
function transformYdata(data) {
return +data; // '+' converts to numbers
}
// **************************
https://d3js.org/d3.v4.min.js