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

Using axis type 'category' requires to have same values for all series #2522

Closed
mstahv opened this Issue Dec 9, 2013 · 15 comments

Comments

Projects
None yet
9 participants
@mstahv

mstahv commented Dec 9, 2013

With the current 'category' axis type the behaviour is bit cumbersome for users. The documentation says that that categories are taken from the first series. Still names are also read from subsequent series, but points x value is still always the index of the point (or explicit value).

Code example to demonstrate issue

http://jsfiddle.net/2gFMw/

My suggestion is to preprocess data without x values in category mode and calculate actual x value based on "name" property. I prototyped the solution here:
mstahv@c4b7f59

You will probably want rewrite the patch in a manner that suits better into your architecture. Logic most likely belongs to Axis.

Allowing this might not be the best idea performance wise (error 15 gets throw with the fix), but for most cases I think it wouldn't matter.

Original Vaadin Charts issue that brought this up:
http://dev.vaadin.com/ticket/13050

@zenob

This comment has been minimized.

Show comment
Hide comment
@zenob

zenob Mar 4, 2014

I have this problem too
I came here to open a ticket but it seems it is already opened

My example : http://jsfiddle.net/Wk7sF/

I would expect to be able to use the name as an x value.

My current workaround is to create on the fly an association table that maps my categories to numbers, and create my points with these numbers as x values.

zenob commented Mar 4, 2014

I have this problem too
I came here to open a ticket but it seems it is already opened

My example : http://jsfiddle.net/Wk7sF/

I would expect to be able to use the name as an x value.

My current workaround is to create on the fly an association table that maps my categories to numbers, and create my points with these numbers as x values.

@lvil

This comment has been minimized.

Show comment
Hide comment
@lvil

lvil Mar 11, 2014

I have the same issuie: http://jsfiddle.net/lvil/pSKRA/
Why the issue is labeled "Enhancement" and not "Bug"?

lvil commented Mar 11, 2014

I have the same issuie: http://jsfiddle.net/lvil/pSKRA/
Why the issue is labeled "Enhancement" and not "Bug"?

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Mar 11, 2014

Collaborator

Because Highcharts currently does what the docs say. You need to set x values for each point to determine the actual category position.

Collaborator

TorsteinHonsi commented Mar 11, 2014

Because Highcharts currently does what the docs say. You need to set x values for each point to determine the actual category position.

@lvil

This comment has been minimized.

Show comment
Hide comment
@lvil

lvil Mar 11, 2014

@highslide-software could you please show me the proper reference to the API.
Thank you.
meanwile I found this: " In a category axis, the point names of the chart's series are used for categories, if not a categories array is defined."

lvil commented Mar 11, 2014

@highslide-software could you please show me the proper reference to the API.
Thank you.
meanwile I found this: " In a category axis, the point names of the chart's series are used for categories, if not a categories array is defined."

@rinatio

This comment has been minimized.

Show comment
Hide comment
@rinatio

rinatio Mar 20, 2014

Having the same issue jsfiddle. Also it seems like the order of points have to be the same jsfiddle

rinatio commented Mar 20, 2014

Having the same issue jsfiddle. Also it seems like the order of points have to be the same jsfiddle

@pawelfus

This comment has been minimized.

Show comment
Hide comment
@pawelfus

pawelfus Mar 20, 2014

Contributor

As states above, you need to set x-value directly for points, Highcharts won't match categories with some different orders etc.
@mstahv - demo: http://jsfiddle.net/2gFMw/1/
@zenob - demo: http://jsfiddle.net/Wk7sF/1/
@lvil - demo: http://jsfiddle.net/pSKRA/1/
@rinatio - demo: http://jsfiddle.net/BKLrA/2/

Contributor

pawelfus commented Mar 20, 2014

As states above, you need to set x-value directly for points, Highcharts won't match categories with some different orders etc.
@mstahv - demo: http://jsfiddle.net/2gFMw/1/
@zenob - demo: http://jsfiddle.net/Wk7sF/1/
@lvil - demo: http://jsfiddle.net/pSKRA/1/
@rinatio - demo: http://jsfiddle.net/BKLrA/2/

@mstahv

This comment has been minimized.

Show comment
Hide comment
@mstahv

mstahv Mar 20, 2014

This is definitely an enhancement, but I guess it would be a useful one as quite many users seem to thing the category mode works like this. For me the issue originally came from Vaadin Charts user. Did you @pawelfus or Torstein check the patch if its suitable? Although it adds a small overhead, I think it shouldn't be an issue even with larger data sets.

mstahv commented Mar 20, 2014

This is definitely an enhancement, but I guess it would be a useful one as quite many users seem to thing the category mode works like this. For me the issue originally came from Vaadin Charts user. Did you @pawelfus or Torstein check the patch if its suitable? Although it adds a small overhead, I think it shouldn't be an issue even with larger data sets.

TorsteinHonsi added a commit that referenced this issue Mar 24, 2014

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Mar 24, 2014

Collaborator

Thanks for your interest! I have written a lightweight implementation that seems to work with most of the demos listed in this conversation. Please test your cases with http://github.highcharts.com/highcharts.js and report back here if you encounter any problems. The implementation uses the order given in xAxis.categories if given, or source code order of the point definitions if not.

Collaborator

TorsteinHonsi commented Mar 24, 2014

Thanks for your interest! I have written a lightweight implementation that seems to work with most of the demos listed in this conversation. Please test your cases with http://github.highcharts.com/highcharts.js and report back here if you encounter any problems. The implementation uses the order given in xAxis.categories if given, or source code order of the point definitions if not.

@mstahv

This comment has been minimized.

Show comment
Hide comment
@mstahv

mstahv Mar 25, 2014

Great to get this forward. I bet this will avoid many WTFs with newcomers.

My test still don't work out of the box. Test with github version of HC: http://jsfiddle.net/2gFMw/2/

It works if the series with all categories is introduced first or categories are explicitly defined.

mstahv commented Mar 25, 2014

Great to get this forward. I bet this will avoid many WTFs with newcomers.

My test still don't work out of the box. Test with github version of HC: http://jsfiddle.net/2gFMw/2/

It works if the series with all categories is introduced first or categories are explicitly defined.

@zenob

This comment has been minimized.

Show comment
Hide comment
@zenob

zenob Mar 31, 2014

I played a little with the version you provided and it seems great for me.

Thanks a lot for taking the time to improve this !

zenob commented Mar 31, 2014

I played a little with the version you provided and it seems great for me.

Thanks a lot for taking the time to improve this !

@arjeousski

This comment has been minimized.

Show comment
Hide comment
@arjeousski

arjeousski Apr 4, 2014

My use case is similar to @mstahv where all of the categories aren't known when the chart is created (data is loaded using ajax) so the fix in 9839bef doesn't quite work

arjeousski commented Apr 4, 2014

My use case is similar to @mstahv where all of the categories aren't known when the chart is created (data is loaded using ajax) so the fix in 9839bef doesn't quite work

arjeousski added a commit to arjeousski/highcharts.com that referenced this issue Apr 8, 2014

@ghost ghost referenced this issue May 16, 2014

Closed

categories from data names #3062

@cxytomo

This comment has been minimized.

Show comment
Hide comment
@cxytomo

cxytomo Dec 1, 2015

It doesn't work for me. I don't want to use categories given to compatible with all types of charts

cxytomo commented Dec 1, 2015

It doesn't work for me. I don't want to use categories given to compatible with all types of charts

@scottnursten

This comment has been minimized.

Show comment
Hide comment
@scottnursten

scottnursten Jun 5, 2016

I'm still experiencing this using Highcharts 4.2.5. I'm adding different length series to an existing chart from AJAX and the later series overwrite from left instead of aligning on matching category names...

Did this get implemented into Highcharts? If so, is there anything I need to do to align values by 'name'? Any ideas?

scottnursten commented Jun 5, 2016

I'm still experiencing this using Highcharts 4.2.5. I'm adding different length series to an existing chart from AJAX and the later series overwrite from left instead of aligning on matching category names...

Did this get implemented into Highcharts? If so, is there anything I need to do to align values by 'name'? Any ideas?

@scottnursten

This comment has been minimized.

Show comment
Hide comment
@scottnursten

scottnursten Jun 5, 2016

@TorsteinHonsi - dudeman... as a paying customer, this is something that I really need working ASAP. Is there anything I can do to get this functionality into my Highcharts with you guys? I can see this hasn't been implemented in 4.2.5 and I was wondering where it is on the roadmap / how I can get this working...

Any help greatly appreciated!

scottnursten commented Jun 5, 2016

@TorsteinHonsi - dudeman... as a paying customer, this is something that I really need working ASAP. Is there anything I can do to get this functionality into my Highcharts with you guys? I can see this hasn't been implemented in 4.2.5 and I was wondering where it is on the roadmap / how I can get this working...

Any help greatly appreciated!

@TorsteinHonsi

This comment has been minimized.

Show comment
Hide comment
@TorsteinHonsi

TorsteinHonsi Jun 6, 2016

Collaborator

I committed a fix for this now. It has been tested for regressions and I expect it to survive until the next maintenance release. Please run http://github.highcharts.com/highcharts.js to test.

Collaborator

TorsteinHonsi commented Jun 6, 2016

I committed a fix for this now. It has been tested for regressions and I expect it to survive until the next maintenance release. Please run http://github.highcharts.com/highcharts.js to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment