d3 charting libraries in january 2015,
a short, personal and incomplete survey
Anna Powell-Smith http://anna.ps @darkgreener
post-talk note: lots of love for dimple at the meetup, especially for analysis - should check this out
nv.addGraph(function() {
var chart = nv.models.discreteBarChart()
.x(function(d) { return d.label }) //Specify the data accessors.
.y(function(d) { return d.value })
.staggerLabels(true) // Staggering labels.
.tooltips(false) //Don't show tooltips
.showValues(true) //...instead, show bar value on top of each bar.
.transitionDuration(350)
;
d3.select('#chart svg')
.datum(exampleData())
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
var chart = c3.generate({
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 100, 140, 200, 150, 50]
],
type: 'bar'
},
bar: {
width: 100
}
});
chart.load({
columns: [
['data3', 130, -150, 200, 300, -200, 100]
]
});
var chart = c3.generate({
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 130, 100, 140, 200, 150, 50]
],
type: 'bar',
labels: {
format: {
y: d3.format("$,")
}
}
},
bar: {
width: 100
}
});
var chart = dc.barChart("#test");
d3.csv("morley.csv", function(error, experiments) {
experiments.forEach(function(x) {
x.Speed = +x.Speed;
});
var ndx = crossfilter(experiments),
runDimension = ndx.dimension(function(d) {return +d.Run;}),
speedSumGroup = runDimension.group().reduceSum(function(d) {return d.Speed * d.Run / 1000;});
chart
.width(768)
.height(480)
.x(d3.scale.linear().domain([6,20]))
.brushOn(false)
.yAxisLabel("This is the Y Axis!")
.dimension(runDimension)
.group(speedSumGroup)
.renderlet(function(chart) {
chart.selectAll('rect').on("click", function(d) {
console.log("click!", d);
});
});
chart.render();
});
// Scales
var xScale = new Plottable.Scale.Ordinal();
var yScale = new Plottable.Scale.Linear();
// Plot Components
var title = new Plottable.Component.TitleLabel("Celebrities");
var yLabel = new Plottable.Component.Label("Height (cm)", "left");
var xAxis = new Plottable.Axis.Category(xScale, "bottom");
var yAxis = new Plottable.Axis.Numeric(yScale, "left");
var lines = new Plottable.Component.Gridlines(null, yScale);
var plot = new Plottable.Plot.VerticalBar(xScale, yScale)
.addDataset(data)
.project("x", "name", xScale)
.project("y", "height", yScale)
.animate(true);
// Layout and render
new Plottable.Component.Table([
[null, null, title],
[yLabel, yAxis, lines.merge(plot)],
[null, null, xAxis]
])
.renderTo("svg#example");
post talk note: people think raw is a great tool for exploration (but lament the lack of bar + line chart support)
(and thanks)