@@ -4,11 +4,11 @@ import './index.css';
44
55import { IgrToolbarModule } from 'igniteui-react-layouts' ;
66import { IgrDataChartToolbarModule , IgrDataChartCoreModule , IgrDataChartCategoryModule , IgrDataChartAnnotationModule , IgrDataChartInteractivityModule , IgrDataChartCategoryTrendLineModule } from 'igniteui-react-charts' ;
7- import { IgrToolbar , IgrToolActionCheckbox , IgrToolActionLabel , IgrToolActionIconMenu } from 'igniteui-react-layouts' ;
7+ import { IgrToolbar , IgrToolActionIconMenu , IgrToolActionGroupHeader , IgrToolActionSubPanel , IgrToolActionCheckbox , IgrToolActionLabel } from 'igniteui-react-layouts' ;
88import { IgrDataChart , IgrCategoryXAxis , IgrNumericYAxis , IgrLineSeries } from 'igniteui-react-charts' ;
99import { CountryRenewableElectricityItem , CountryRenewableElectricity } from './CountryRenewableElectricity' ;
1010import { IgrToolCommandEventArgs } from 'igniteui-react-layouts' ;
11- import { IgrSeries , IgrDataToolTipLayer } from 'igniteui-react-charts' ;
11+ import { IgrSeries , IgrDataToolTipLayer , IgrCrosshairLayer , IgrFinalValueLayer } from 'igniteui-react-charts' ;
1212
1313const mods : any [ ] = [
1414 IgrToolbarModule ,
@@ -27,10 +27,16 @@ export default class Sample extends React.Component<any, any> {
2727 this . toolbar = r ;
2828 this . setState ( { } ) ;
2929 }
30+ private menuForSubPanelTool : IgrToolActionIconMenu
31+ private subPanelGroup : IgrToolActionGroupHeader
32+ private customSubPanelTools : IgrToolActionSubPanel
3033 private enableTooltipsLabel : IgrToolActionCheckbox
31- private zoomResetHidden : IgrToolActionLabel
34+ private enableCrosshairsLabel : IgrToolActionCheckbox
35+ private enableFinalValuesLabel : IgrToolActionCheckbox
3236 private zoomResetLabel : IgrToolActionLabel
37+ private zoomResetHidden : IgrToolActionLabel
3338 private analyzeMenu : IgrToolActionIconMenu
39+ private copyMenu : IgrToolActionLabel
3440 private chart : IgrDataChart
3541 private chartRef ( r : IgrDataChart ) {
3642 this . chart = r ;
@@ -46,7 +52,7 @@ export default class Sample extends React.Component<any, any> {
4652 super ( props ) ;
4753
4854 this . toolbarRef = this . toolbarRef . bind ( this ) ;
49- this . toolbarToggleTooltip = this . toolbarToggleTooltip . bind ( this ) ;
55+ this . toolbarToggleAnnotations = this . toolbarToggleAnnotations . bind ( this ) ;
5056 this . chartRef = this . chartRef . bind ( this ) ;
5157 }
5258
@@ -61,31 +67,60 @@ export default class Sample extends React.Component<any, any> {
6167 ref = { this . toolbarRef }
6268 target = { this . chart }
6369 orientation = "Horizontal"
64- onCommand = { this . toolbarToggleTooltip } >
65- < IgrToolActionCheckbox
66- name = "EnableTooltipsLabel"
67- title = "Enable Tooltips"
68- beforeId = "ZoomReset"
69- commandId = "EnableTooltips" >
70- </ IgrToolActionCheckbox >
71- < IgrToolActionLabel
72- name = "zoomResetHidden"
73- overlayId = "ZoomReset"
74- visibility = "Collapsed" >
75- </ IgrToolActionLabel >
70+ onCommand = { this . toolbarToggleAnnotations } >
71+ < IgrToolActionIconMenu
72+ name = "MenuForSubPanelTool"
73+ iconCollectionName = "ChartToolbarIcons"
74+ iconName = "analyze" >
75+ < IgrToolActionGroupHeader
76+ name = "SubPanelGroup"
77+ closeOnExecute = "true"
78+ title = "Visualizations"
79+ subtitle = "Layers" >
80+ </ IgrToolActionGroupHeader >
81+ < IgrToolActionSubPanel
82+ name = "CustomSubPanelTools" >
83+ < IgrToolActionCheckbox
84+ name = "EnableTooltipsLabel"
85+ title = "Enable Tooltips"
86+ commandId = "EnableTooltips" >
87+ </ IgrToolActionCheckbox >
88+ < IgrToolActionCheckbox
89+ name = "EnableCrosshairsLabel"
90+ title = "Enable Crosshairs"
91+ commandId = "EnableCrosshairs" >
92+ </ IgrToolActionCheckbox >
93+ < IgrToolActionCheckbox
94+ name = "EnableFinalValuesLabel"
95+ title = "Enable Final Values"
96+ commandId = "EnableFinalValues" >
97+ </ IgrToolActionCheckbox >
98+ </ IgrToolActionSubPanel >
99+ </ IgrToolActionIconMenu >
76100 < IgrToolActionLabel
77101 name = "zoomResetLabel"
78102 title = "Reset"
79103 afterId = "ZoomOut"
80104 iconName = "reset"
81105 iconCollectionName = "ChartToolbarIcons"
82- commandId = "ZoomReset" >
106+ commandId = "ZoomReset"
107+ isHighlighted = "true" >
108+ </ IgrToolActionLabel >
109+ < IgrToolActionLabel
110+ name = "zoomResetHidden"
111+ overlayId = "ZoomReset"
112+ visibility = "Collapsed" >
83113 </ IgrToolActionLabel >
84114 < IgrToolActionIconMenu
85115 name = "AnalyzeMenu"
86116 overlayId = "AnalyzeMenu"
87117 visibility = "Collapsed" >
88118 </ IgrToolActionIconMenu >
119+ < IgrToolActionLabel
120+ name = "CopyMenu"
121+ overlayId = "CopyMenu"
122+ visibility = "Collapsed" >
123+ </ IgrToolActionLabel >
89124 </ IgrToolbar >
90125 </ div >
91126 </ div >
@@ -147,7 +182,7 @@ export default class Sample extends React.Component<any, any> {
147182 }
148183
149184
150- public toolbarToggleTooltip ( sender : any , args : IgrToolCommandEventArgs ) : void {
185+ public toolbarToggleAnnotations ( sender : any , args : IgrToolCommandEventArgs ) : void {
151186 var target = this . chart ;
152187 switch ( args . command . commandId )
153188 {
@@ -173,6 +208,50 @@ export default class Sample extends React.Component<any, any> {
173208 }
174209 }
175210 break ;
211+ case "EnableCrosshairs" :
212+ var enable = args . command . argumentsList [ 0 ] . value as boolean ;
213+ if ( enable )
214+ {
215+ target . series . add ( new IgrCrosshairLayer ( { name : "crosshairLayer" } ) ) ;
216+ }
217+ else
218+ {
219+ var toRemove = null ;
220+ for ( var i = 0 ; i < target . actualSeries . length ; i ++ ) {
221+ let s = target . actualSeries [ i ] as IgrSeries ;
222+ if ( s instanceof IgrCrosshairLayer )
223+ {
224+ toRemove = s ;
225+ }
226+ }
227+ if ( toRemove != null )
228+ {
229+ target . series . remove ( toRemove ) ;
230+ }
231+ }
232+ break ;
233+ case "EnableFinalValues" :
234+ var enable = args . command . argumentsList [ 0 ] . value as boolean ;
235+ if ( enable )
236+ {
237+ target . series . add ( new IgrFinalValueLayer ( { name : "finalValueLayer" } ) ) ;
238+ }
239+ else
240+ {
241+ var toRemove = null ;
242+ for ( var i = 0 ; i < target . actualSeries . length ; i ++ ) {
243+ let s = target . actualSeries [ i ] as IgrSeries ;
244+ if ( s instanceof IgrFinalValueLayer )
245+ {
246+ toRemove = s ;
247+ }
248+ }
249+ if ( toRemove != null )
250+ {
251+ target . series . remove ( toRemove ) ;
252+ }
253+ }
254+ break ;
176255 }
177256 }
178257
0 commit comments