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

Add support for reversing a grouped category title on tooltips #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lambk
Copy link

@lambk lambk commented Jun 15, 2019

  • Setting the new reverseTitle option on the chart.tooltip object will result in the tooltip title being displayed as <high_level_category>, <middle_level_category>, <low_level_category> rather than the default low to high order

  • If the option is omitted, it defaults to false

Let me know if there are other preferences on the option name or how it is obtained

- Setting the new reverseTitle option on the chart.tooltip object will result in the tooltip title being displayed as <high_level_category>, <middle_level_category>, <low_level_category> rather than the default low to high order

- If the option is omitted, it defaults to false
@KacperMadej
Copy link
Collaborator

Changes like that could be done through tooltip formatter, so I believe the option is redundant and will be merged only if more requests for this features will be made. This PR could be used to track how popular is the feature, so I'm not closing it either.

@dmitrygorbenko
Copy link

dmitrygorbenko commented Jul 8, 2022

Hi everyone,

I was working on this issue today and I almost was ready to submit the same MR.

@KacperMadej I'd like to know how it's possible to achieve this reverse after the string was joined with commas.
I mean, if I try to split the string back by commas, I can have issues if one of the parts contained comma.
Like, if I have ['A', 'B', 'C, D'] (3 items) and I join them by commas I'll get string 'A, B, C, D'.
And if I try to split it back I'll get ['A', 'B', 'C', 'D'] (4 items).
So the reverse should be done before joining.
But maybe I'm missing something and you can help us ?

I'd love to see this code being merged and used by everyone.

Thanks,
Dima

@dmitrygorbenko
Copy link

But at the same time I'd like to pass 'options' variable instead of 'reverseTooltipTitle' to Category class, so in the future more options can be passed there. I think I'm going to create my own MR from this idea.

@dmitrygorbenko
Copy link

So, I've created another MR #187
which does the same but passes object instead of one variable, and here is the sample of usage:

Highcharts({
	...
	tooltip: {
		...
		reverseTitle: true
	}
})

and this tooltip object is available inside the Category class as this.tooltipOptions variable.

I hope you find this useful and consider adding such ability to your code.

Thanks

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

Successfully merging this pull request may close these issues.

3 participants