Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

dataTable not working with fancy columns #1030

Closed
stevemandl opened this issue Oct 26, 2015 · 1 comment
Closed

dataTable not working with fancy columns #1030

stevemandl opened this issue Oct 26, 2015 · 1 comment
Labels
Milestone

Comments

@stevemandl
Copy link

When passing an array of objects to dataTable.columns() as suggested in the docs, _doColumnValueFormat throws an error that v.format is not a function. Instead of using this template for the columns:

chart.columns([
    ["Date",   // Specify an Object = [Label, Fn]
        function (d) { return d.date; }], ...

This one works instead:

.columns([
     {label: "Period", format:
      function (d) { return d.p; }}, ...

Either the docs should be changed (using a similar template to the one I pasted above), or the code should be changed:

    _chart._doColumnValueFormat = function (v, d) {
        return ((typeof v === 'function') ?
                v(d) :                          // v as function
                ((typeof v === 'string') ?
                 d[v] :                         // v is field name string
//                 v.format(d)                        // v is Object, use fn (element 2)
//use element 2 instead:
                 v.[1](d)                        // v is Object, use fn (element 2)
                )
               );
    };

to call so they match. If the code is changed, _doColumnHeaderFormat is also impacted by a similar issue.

@gordonwoodhull
Copy link
Contributor

I see. I requested the API change but didn't verify that the docs had been changed accordingly. So this is a documentation bug

Thanks @stevemandl for the report!

@gordonwoodhull gordonwoodhull added this to the v2.0 milestone Dec 14, 2015
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants