Skip to content

Commit b1e1020

Browse files
authored
Merge pull request #50 from serrut/master
Add events for X-Axis and Y-Axis
2 parents ff3108c + be98745 commit b1e1020

28 files changed

Lines changed: 437 additions & 19 deletions

README.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
- [Chart Events](#chart-events)
1616
- [Series Events](#series-events)
1717
- [Point Events](#point-events)
18+
- [X-Axis Events](#x-axis-events)
19+
- [Y-Axis Events](#y-axis-events)
1820
- [Dynamic Interaction with Chart Object](#dynamic-interaction-with-chart-object)
1921
- [Access to the Highcharts Static Members](#access-to-the-highcharts-static-members)
2022
- [Highstock and Highmaps](#highstock-and-highmaps)
@@ -101,14 +103,38 @@ Similary you can use the `point` to access to [options.plotOptions.series.point.
101103
</series>
102104
</chart>
103105
<p><b>{{point}}</b> is selected<p>
106+
```
107+
[Live Demo](http://plnkr.co/edit/TpKoJ60n4vyIDWxHNUkg?p=preview)
108+
#### X-Axis Events
104109

110+
Similary you can use the `xAxis` to access to [options.xAxis.events](http://api.highcharts.com/highcharts#xAxis.events) API.
111+
```HTML
112+
<chart [options]="options">
113+
<xAxis (afterSetExtremes)="onAfterSetExtremes($event)"></xAxis>
114+
</chart>
105115
```
106116
```TypeScript
107-
onPointSelect (e) {
108-
this.serieName = e.context.y;
117+
onAfterSetExtremes (e) {
118+
this.min = e.context.min;
119+
this.max = e.context.max;
109120
}
110121
```
111-
[Live Demo](http://plnkr.co/edit/TpKoJ60n4vyIDWxHNUkg?p=preview)
122+
[Live Demo](http://plnkr.co/edit/2tVDzLDDVaGwUQZe6vDj?p=preview)
123+
#### Y-Axis Events
124+
125+
Similary you can use the `yAxis` to access to [options.yAxis.events](http://api.highcharts.com/highcharts#yAxis.events) API.
126+
```HTML
127+
<chart [options]="options">
128+
<yAxis (afterSetExtremes)="onAfterSetExtremes($event)"></yAxis>
129+
</chart>
130+
```
131+
```TypeScript
132+
onAfterSetExtremes (e) {
133+
this.min = e.context.min;
134+
this.max = e.context.max;
135+
}
136+
```
137+
[Live Demo](http://plnkr.co/edit/HHUa9fHL766ynsi7Y5hR?p=preview)
112138
### Dynamic Interaction with Chart Object
113139

114140
angular2-higcharts provides possibility to interact with native `HighchartsChartObject` chart object.

dist/ChartComponent.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import { ElementRef, EventEmitter } from '@angular/core';
22
import { ChartSeriesComponent } from './ChartSeriesComponent';
3+
import { ChartXAxisComponent } from './ChartXAxisComponent';
4+
import { ChartYAxisComponent } from './ChartYAxisComponent';
35
import { HighchartsService } from './HighchartsService';
46
import { ChartEvent } from './ChartEvent';
57
export declare class ChartComponent {
68
series: ChartSeriesComponent;
9+
xAxis: ChartXAxisComponent;
10+
yAxis: ChartYAxisComponent;
711
create: EventEmitter<HighchartsChartObject>;
812
click: EventEmitter<ChartEvent>;
913
addSeries: EventEmitter<ChartEvent>;

dist/ChartComponent.js

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ChartComponent.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ChartComponent.spec.js

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)