简体   繁体   中英

How to retrieve parent category when using grouped categories in Highcharts?

I am using the grouped categories library here https://github.com/blacklabel/grouped_categories . How would I retrieve a parent category? For example, how would I get/return the category "Fruit" from the graph here: http://blacklabel.github.io/grouped_categories/ . I have tried this.x which returns both the parent and subcategories of a point. this.category.name would return the subcategory, or "Apple" in the example.

You almost got it. Talking about tooltip, you can reach parent category name with this.x.parent.name . Looks like that you can get any parent level this way;

Try it: jsFiddle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM