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

support ordinal y scale for bubble/scatter plots #539

Closed
gordonwoodhull opened this issue Mar 13, 2014 · 3 comments
Closed

support ordinal y scale for bubble/scatter plots #539

gordonwoodhull opened this issue Mar 13, 2014 · 3 comments
Milestone

Comments

@gordonwoodhull
Copy link
Contributor

While it has special cases for an ordinal X scale, currently coordinateGridMixin assumes that the Y scale is linear. This doesn't always makes sense for bubble or scatter plots.

Here is a fiddle sort of halfway hacking around the problem in prepareYAxis:
http://jsfiddle.net/gordonwoodhull/xZFx4/10/

@gordonwoodhull gordonwoodhull added this to the v2.1 milestone Nov 30, 2014
@the3ver
Copy link
Contributor

the3ver commented May 24, 2018

At least for a scatter plot I was able to get a simple example running with both x and y scales ordinal:
http://jsfiddle.net/the3ver/Lf72gmmy/3/

Looks like the prepareYAxis workaround is no longer necessary.

This also works in a seriesChart version:
http://jsfiddle.net/the3ver/Ldzn11u1/1/

@gordonwoodhull although the above examples work, when i add

.renderHorizontalGridLines(true)

I get

TypeError: scale.ticks is undefined
_dc/dc.coordinateGridMixin/_chart._renderHorizontalGridLinesForAxis  coordinate-grid-mixin.js:699:44

Should this go into a new issue? I was able to fix it and can provide a PR.

@gordonwoodhull
Copy link
Contributor Author

I see.. probably because d3.scaleBand is its own thing now, instead of having to calld3.scale.ordinal.rangeBands

@gordonwoodhull
Copy link
Contributor Author

This is fixed by using d3v4 in dc.js 3.0, except for the ticks undefined problem, which is fixed by #1448.

gordonwoodhull pushed a commit that referenced this issue Jul 11, 2018
Fix "TypeError: scale.ticks is undefined" when setting .renderHorizontalGridLines(true) on charts with ordinal y scale, see #539
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants