2
votes

I've got data currently grouping by day, week and month using HighCharts. I've also got a click event tied to the chart as well as each series. When someone clicks, how can I determine what data grouping it's currently using - day, week, or month?

Here's a simplified example: http://jsfiddle.net/V5hSd/4/

2
Just updated with fiddle link, it's simplified but at least demonstrates what I'm trying to do.Dexter
Wow what a sport you are!! You choose a less detailed answer that was also posted after mine and gives the same solution. Be a sport dudeJugal Thakkar
@JugalThakkar: It happens dude. I saw that you have answered user's last 4-5 questions. You keep up the spirit. :)Hardik Mishra
Thanks, truly appreciate your gesture. I am trying my best to keep it up :|Jugal Thakkar

2 Answers

4
votes
//If in chart's click event handler
this.series[i].currentDataGrouping.unitName

//If in series's event handler
this.currentDataGrouping.unitName

HOW TO FIREBUG YOUR WAY TO THE SOLUTION
Highchart has a nice readable object graph that tells you most the things without needing documentation. I strongly recommend firebug or developer tools of whichever browser you use

All that was needed was to set a breakpoint in the click handler, look through the locals, and see what makes sense for the problem in hand, and there you go. You have (From the series's click handler) this.currentDataGrouping.unitName.

Now ain't that intutive?!! enter image description here

Due apologies if I sounded rude, but I believe in empowering people in ways that help them solve their own problems the next time

2
votes