@@ -31,10 +31,10 @@ export class Sample {
3131 private xAxis : IgcCategoryXAxisComponent
3232 private yAxis : IgcNumericYAxisComponent
3333 private annotationInput : IgcInputComponent ;
34- private annotationTextArea : IgcTextareaComponent ;
34+ private annotationDetails : IgcTextareaComponent ;
3535 private annotationBadgeColorEditor : IgcColorEditorComponent ;
3636 private annotationMainColorEditor : IgcColorEditorComponent ;
37- private currentAnnotationInfo : IgcUserAnnotationInformation ;
37+ private annotationInfo : IgcUserAnnotationInformation ;
3838
3939 private _bind : ( ) => void ;
4040
@@ -47,7 +47,7 @@ export class Sample {
4747 var lineSeries2 = document . getElementById ( 'lineSeries2' ) as IgcLineSeriesComponent ;
4848 var lineSeries3 = document . getElementById ( 'lineSeries3' ) as IgcLineSeriesComponent ;
4949 this . annotationInput = document . getElementById ( 'annotationInput' ) as IgcInputComponent ;
50- this . annotationTextArea = document . getElementById ( 'annotationTextArea ' ) as IgcTextareaComponent ;
50+ this . annotationDetails = document . getElementById ( 'annotationDetails ' ) as IgcTextareaComponent ;
5151 this . annotationMainColorEditor = document . getElementById ( 'annotationMainColorEditor' ) as IgcColorEditorComponent ;
5252 this . annotationBadgeColorEditor = document . getElementById ( 'annotationBadgeColorEditor' ) as IgcColorEditorComponent ;
5353
@@ -58,7 +58,7 @@ export class Sample {
5858 this . chart . userAnnotationToolTipContentUpdating = this . onUserAnnotationToolTipContentUpdating . bind ( this ) ;
5959
6060 doneButton . onclick = this . onDoneBtnClick . bind ( this ) ;
61- cancelButton . onclick = this . onCancelBtnClick . bind ( this ) ;
61+ cancelButton . onclick = this . onCancelBtnClick . bind ( this ) ;
6262
6363 this . _bind = ( ) => {
6464 toolbar . target = this . chart ;
@@ -77,8 +77,8 @@ export class Sample {
7777 this . _bind ( ) ;
7878 }
7979
80- public onUserAnnotationInformationRequested ( s : IgcSeriesViewerComponent , e : IgcUserAnnotationInformationEventArgs ) {
81- this . currentAnnotationInfo = e . annotationInfo ;
80+ public onUserAnnotationInformationRequested ( s : IgcSeriesViewerComponent , e : IgcUserAnnotationInformationEventArgs ) {
81+ this . annotationInfo = e . annotationInfo ;
8282 this . toggleDialogState ( true ) ;
8383 }
8484
@@ -88,6 +88,7 @@ export class Sample {
8888 if ( e . content . children . length == 0 ) {
8989 var element = document . createElement ( "div" ) ;
9090 element . textContent = tooltipText ;
91+ element . style = "color: white" ;
9192 e . content . appendChild ( element ) ;
9293 }
9394 else {
@@ -98,27 +99,32 @@ export class Sample {
9899
99100 public onDoneBtnClick ( ) {
100101
101- this . currentAnnotationInfo . label = this . annotationInput . value ;
102- this . currentAnnotationInfo . annotationData = this . annotationTextArea . value ;
103- this . currentAnnotationInfo . mainColor = this . annotationMainColorEditor . value ;
104- this . currentAnnotationInfo . badgeColor = this . annotationBadgeColorEditor . value ;
102+ this . annotationInfo . label = this . annotationInput . value ;
103+ this . annotationInfo . annotationData = this . annotationDetails . value ;
104+ this . annotationInfo . mainColor = this . annotationMainColorEditor . value ;
105+ this . annotationInfo . badgeColor = this . annotationBadgeColorEditor . value ;
105106
106- this . chart . finishAnnotationFlow ( this . currentAnnotationInfo ) ;
107+ this . chart . finishAnnotationFlow ( this . annotationInfo ) ;
107108 this . toggleDialogState ( false ) ;
108109 }
109110
110- public onCancelBtnClick ( ) {
111- this . chart . cancelAnnotationFlow ( this . currentAnnotationInfo . annotationId ) ;
111+ public onCancelBtnClick ( ) {
112+
113+ if ( this . annotationInfo !== undefined && this . annotationInfo . annotationId !== undefined )
114+ {
115+ this . chart . cancelAnnotationFlow ( this . annotationInfo . annotationId ) ;
116+ }
117+
112118 this . toggleDialogState ( false ) ;
113119 }
114120
115121 public toggleDialogState ( open : boolean ) : void {
116- var popup = document . getElementsByClassName ( 'annotationPopup' ) [ 0 ] as HTMLDivElement ;
122+ var popup = document . getElementById ( 'annotationPopup' ) as HTMLDivElement ;
117123
118- if ( open ) {
119- popup . style . display = "block " ;
124+ if ( open ) {
125+ popup . style . display = "flex " ;
120126 }
121- else {
127+ else {
122128 popup . style . display = "none" ;
123129 }
124130 }
0 commit comments