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

[Request] Highstock Events - Access to xAxis.events.setExtremes event #32

Closed
djrr94 opened this issue Jun 21, 2016 · 7 comments
Closed
Labels

Comments

@djrr94
Copy link

djrr94 commented Jun 21, 2016

Hello, I'm using your chart directives in our project and I love it so much.

I'm using Highstocks and I need to know when user changes range of the chart and put these extremes in two variables (like in your example). I've tried your example with (selection) event emitter, but it doesn't work with navigator (editing range and panning) and range selector buttons (1M, 3M, YTD, ALL). It works only with editing the area in the chart (zooming and panning). That's probably because this event is made for Highcharts, not Highstocks.

I wanted to ask if there is (or will be) any way to access the xAxis.events.setExtremes event. I tried it through console.log and it worked like a charm, but I cannot assign these values to angular2's model variables.

I also thought that would be a nice thing to present in your examples, for users who need to use highstocks.

I appreciate your great work, thank you in advance.

//EDIT
Just for completation, you can see desired behavior here. Just check the console log.

@gevgeny
Copy link
Owner

gevgeny commented Jun 22, 2016

I really cannot understand the question.

@gevgeny
Copy link
Owner

gevgeny commented Jun 22, 2016

If you can fetch values in the event handler why you cannot assign them to a variable ?

@djrr94
Copy link
Author

djrr94 commented Jun 22, 2016

Sorry, my description maybe weren't so clear.

Maybe I'm doing something wrong, but in this updated plunk you can see that console logging with these variables works okay, but assigning these values to this.from and this.to model variables doesn't work.

xAxis: { events: { setExtremes: function (e) { this.from = Highcharts.dateFormat(null, e.min); // Doesn't work this.to = Highcharts.dateFormat(null, e.max); // Doesn't work console.log('min: ' + Highcharts.dateFormat(null, e.min) + ' max: ' + Highcharts.dateFormat(null, e.max)); // Works } } }

So I thought the correct way doing this is through your event emitters like (selection) in template, or I can really miss something.

@gevgeny
Copy link
Owner

gevgeny commented Jun 23, 2016

You are not changing properties of your component in your fiddle. see http://plnkr.co/edit/IXmgt9CcR15B3WbUizKr?p=preview

@gevgeny gevgeny closed this as completed Jun 23, 2016
@djrr94
Copy link
Author

djrr94 commented Jun 23, 2016

Aww, I though I must miss something, thank you so much!

@gevgeny
Copy link
Owner

gevgeny commented Jun 23, 2016

Yes, you did. How function context works in JS ;) https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/this

@arjun289
Copy link

arjun289 commented Dec 21, 2017

I am trying to access the rangeSelector button event inside my component using the (selection). But I am not able to do so if the button is pressed. http://plnkr.co/edit/OwcqjORHCB9pZHBrt4cm?p=preview. Do I need to export something from the event?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants