Skip to content
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

DC.Capped Value Accessor Issue #338

Closed
ggannon opened this issue Oct 13, 2013 · 8 comments
Closed

DC.Capped Value Accessor Issue #338

ggannon opened this issue Oct 13, 2013 · 8 comments
Assignees
Labels
Milestone

Comments

@ggannon
Copy link

ggannon commented Oct 13, 2013

When creating a capped chart with a value accessor that is anything other than just returning .value as a number, the capped chart doesn't work.

_othersGrouper will return the sum of others in .value as a number. If, for example, my value accessor is returning d.value.total then the value accessor in the chart render looks to access an object and breaks when it gets to the other row.

My hack was to change my value accessor:
return typeof(d.value) == "number" ? d.value : d.value.total

Perhaps caped chart should return all rows with .value as a number?

@ghost ghost assigned jrideout Oct 14, 2013
@jrideout
Copy link
Contributor

@ggannon

The capped charts now call accessors like this:

    _chart.cappedKeyAccessor = function(d,i) {
        if (d.others)
            return d.key;
        return _chart.keyAccessor()(d,i);
    };

I also fixed all the user settable callback functions to receive d.data, rather than just d. So we can hide the implementation details of both cases.

@ggannon
Copy link
Author

ggannon commented Oct 18, 2013

Great fix. :)

@albertotagliavini
Copy link

How should i do to use this functionality?

@gordonwoodhull
Copy link
Contributor

Hi @albertotagliavini - are you looking for the documentation of the Cap Mixin, or something else?

https://github.com/dc-js/dc.js/blob/master/web/docs/api-latest.md#cap-mixin

@albertotagliavini
Copy link

I have a problem in a rowchart with cap and valueAccessor.
In detail, i've got browser console said:
Error: Invalid value for attribute width="NaN" d3.min.js: 16

I can't understand if i i've wrong something making the chart or there is another problem.

can you post me an example of cappedValueAccessor?

@gordonwoodhull
Copy link
Contributor

Sorry, but the issue tracker is for reporting bugs and making enhancement requests, not for general support questions. Please ask on Stack Overflow with the dc.js tag, or on the user group, and we will be glad to help you there.

@gordonwoodhull
Copy link
Contributor

There may be harmless (but still wrong) warnings in the log, but if your chart is not displaying, please ask in one of the support forums.

@albertotagliavini
Copy link

ok, thaks! sorry for the error. i've asked it here : https://stackoverflow.com/questions/31029925/dc-js-error-rowchart-with-cap-and-valueaccessor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants