-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Abstract Data Dereferencing #82
Comments
I have this problem, and I solved it by using the method shown in Towards Reusable Charts:
Then, when you need to tell the chart what your data looks like, you can do this:
In this case, What do people think about this approach? |
@mgerring I think that looks pretty good! The tricky thing about solving this I'm thinking of one change that might make your approach a little better still: chart.yValue = function(d){ return d[0] };
chart.idValue = function(d){ return d[1] };
- chart.maxValue = function(data){ return d3.max(data,function(d){ return d[0] }) };
+ chart.maxValue = function(data){ return d3.max(data,function(d){ return chart.yValue(d); }) }; This way, users who override |
Some users have expressed interest in defining charts with "abstract"
requirements on the shape of input data. If this were provided by d3.chart,
charts might be considered more "reusable". Any chart could be configured to
visualize data sets defined in many different ways.
In building version 0.2 of this library, we discussed the needs of such an API
(see issue #22), built a prototype implementation, and eventually encapsulated
this solution in a JavaScript module named
DataMap
. We introduced the basic APIand functionality in the roadmap for the v0.2 release.
Ultimately, though, we decided not to include this solution for two reasons:
Miso DataSet and
CrossFilter for existing solutions)
more confusion than it was worth.
Again, you can read the roadmap for the v0.2 release to learn more.
I'm opening this issue to create a place for further discussion on this
decision. If you disagree with
#1
above and believe that data transformationis within the purview of this data visualization plugin, let us know why. If
would like to experiment with (and possibly extend) our original solution, you'll
find a commit on the
HEAD
of thedata-attrs
branch that re-introduces the feature.The text was updated successfully, but these errors were encountered: