Closed jasonlally closed 8 years ago
So I've been doing some research here and I think I have an approach that can be quick and dirty and just use some of d3's native binning functions for histograms to handle basic transforms and then pass to c3 as data prepared for a chart. I'm going to map it out a bit more before digging in, but it should at least be minimally viable.
In doing this research I think we should consider using vega to power our visualizations. The nice thing about it is that it's a spec that encapsulates charts in a standard json object.
The tradeoff here is that vega is a bit lower level than C3, but what we gain is consistency in charting by using a declarative, standard grammar that defines a chart. This could also make reasoning about what's going on with a chart easier to do in code and make the charts super portable.
And it handles map based data as well. There's a great visualization explorer with examples on the site and there's a pretty detailed react/redux/vega tutorial here: https://medium.com/@pbesh/react-and-vega-an-alternative-visualization-example-cd76e07dc1cd#.jqeiot7dx
Anyway, not going to pull out C3, but after the sprint we should do a quick planning session to go over some technical architecture choices and make sure we balance flexibility and speed.
Also: this https://www.mapbox.com/blog/stickshift/ uses react + vega for charting as well
Alternatively NVD3 is pretty well developed and NuCivic has a react wrapper around it here: https://github.com/NuCivic/react-nvd3 which it looks like they use for their dashboards built on top of DKAN (Drupal for CKAN).
Addressed by #65
Additional smaller bugs and issues logged, but our approach here will likely shift if we switch our charting approach
So C3 doesn't have a straightforward way for handling histograms/distribution charts, so we may have to generate bins of data from the return based on whether the column type is a number or not. I'm going to backburner this one to do a little more research on an appropriate approach here. In an abstract sense, this is straightforward:
Data (from API call) -> Transform (binning function) -> Output (to chart)
But there are different nuances about how to deal with outliers, and other aspects of dynamically generated data, that I'd like to make sure we pick an approach that makes sense.
There's an issue on c3 that indicates a feature coming at some point related to creating histogram charts. It's unclear if the scope includes just displaying data and/or transforming inputs for display.