Skip to content
This repository was archived by the owner on May 3, 2023. It is now read-only.

Commit 6165cbc

Browse files
cjohn001shiv19
authored andcommitted
updateChartContent working again
1 parent 385b6df commit 6165cbc

File tree

6 files changed

+15
-4
lines changed

6 files changed

+15
-4
lines changed

src-angular/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ registerElement('UIChartsView', () => UIChartsView);
77
// the actual extended class implementing the bugfix
88
@Directive({
99
// tslint:disable-next-line: directive-selector
10-
selector: 'UIChartsView'
10+
selector: 'UIChartsView',
1111
})
1212
export class UIChartsViewDirective implements OnChanges, OnDestroy {
1313
private _uiChartsView: UIChartsView = null;
@@ -63,7 +63,7 @@ export class UIChartsViewDirective implements OnChanges, OnDestroy {
6363
//////////////////////////////////////////////////////////////////////////////////////////////////
6464
private setChartViewOptions() {
6565
if (this.options !== null && this.options !== undefined) {
66-
if (!this._uiChartsView._chartInitialized) {
66+
if (!(<any>this._uiChartsView)._chartInitialized) {
6767
this._uiChartsView.setOptions(this.options);
6868
} else {
6969
if (this.updateChartContent) {
@@ -78,6 +78,6 @@ export class UIChartsViewDirective implements OnChanges, OnDestroy {
7878

7979
@NgModule({
8080
declarations: [UIChartsViewDirective],
81-
exports: [UIChartsViewDirective]
81+
exports: [UIChartsViewDirective],
8282
})
8383
export class UIChartsViewModule {}

src/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
"build.angular": "cd ../src-angular && npm run build",
2121
"tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\"",
2222
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**' --exclude '**/platforms/**'",
23+
"src-angular.reset": "cd ../src-angular && npx rimraf node_modules package-lock.json",
2324
"demo.ios": "tsc && npm i && cd ../demo && tns run ios",
2425
"demo.android": "npm i && cd ../demo && tns run android",
2526
"demo.reset": "cd ../demo && npx rimraf -- hooks node_modules platforms package-lock.json",
2627
"demo-angular.ios": "npm i && cd ../demo-angular && tns run ios --no-hmr",
2728
"demo-angular.android": "npm i && cd ../demo-angular && tns run android --no-hmr",
2829
"demo-angular.reset": "cd ../demo-angular && npx rimraf -- hooks node_modules platforms package-lock.json",
2930
"plugin.prepare": "npm run build && cd ../demo && tns plugin remove @nativescript/ui-charts && tns plugin add ../src && cd ../demo-angular && tns plugin remove @nativescript/ui-charts && tns plugin add ../src",
30-
"clean": "npm run demo.reset && npm run demo-angular.reset && npx rimraf node_modules package-lock.json angular && npm run tsc"
31+
"clean": "npm run src-angular.reset && npm run demo.reset && npm run demo-angular.reset && npx rimraf node_modules package-lock.json angular && npm run tsc"
3132
},
3233
"keywords": [
3334
"NativeScript",

src/ui-charts.android.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { UIChartsViewBase } from './ui-charts.common';
22
export declare class UIChartsView extends UIChartsViewBase {
3+
_chartInitialized: boolean;
34
customLayoutChangeListener: any;
45
chartHeight: any;
56
chartWidth: any;

src/ui-charts.android.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Application } from '@nativescript/core';
44
import { langHandler } from './options-handlers/lang/lang-handler';
55

66
export class UIChartsView extends UIChartsViewBase {
7+
public _chartInitialized: boolean = false;
78
public customLayoutChangeListener;
89
public chartHeight;
910
public chartWidth;
@@ -61,6 +62,7 @@ export class UIChartsView extends UIChartsViewBase {
6162
}
6263

6364
public disposeNativeView() {
65+
this._chartInitialized = false;
6466
Application.off('orientationChanged', (<any>this)._orientationHandler);
6567
super.disposeNativeView();
6668
}
@@ -79,6 +81,8 @@ export class UIChartsView extends UIChartsViewBase {
7981
const hiOptions = optionsHandler(this.options);
8082
if (this.nativeView) {
8183
this.nativeView.setOptions(hiOptions);
84+
this._chartInitialized = true;
85+
this.nativeView.reload();
8286
}
8387
}
8488

src/ui-charts.ios.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { UIChartsViewBase } from './ui-charts.common';
22
export declare class UIChartsView extends UIChartsViewBase {
3+
_chartInitialized: boolean;
34
private _delegate;
45
onLoaded(): void;
56
createNativeView(): any;

src/ui-charts.ios.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { optionsHandler } from './options-handlers/options-handler';
33
import { langHandler } from './options-handlers/lang/lang-handler';
44

55
export class UIChartsView extends UIChartsViewBase {
6+
public _chartInitialized: boolean = false;
67
private _delegate: HighchartsViewDelegateImpl;
78
public onLoaded() {
89
super.onLoaded();
@@ -23,6 +24,7 @@ export class UIChartsView extends UIChartsViewBase {
2324
}
2425

2526
public disposeNativeView() {
27+
this._chartInitialized = false;
2628
super.disposeNativeView();
2729
}
2830

@@ -43,6 +45,8 @@ export class UIChartsView extends UIChartsViewBase {
4345
const hiOptions = optionsHandler(this.options);
4446
if (this.nativeView) {
4547
this.nativeView.options = hiOptions;
48+
this._chartInitialized = true;
49+
this.nativeView.reload();
4650
}
4751
}
4852

0 commit comments

Comments
 (0)