Skip to content
This repository was archived by the owner on May 3, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src-angular/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ registerElement('UIChartsView', () => UIChartsView);
// the actual extended class implementing the bugfix
@Directive({
// tslint:disable-next-line: directive-selector
selector: 'UIChartsView'
selector: 'UIChartsView',
})
export class UIChartsViewDirective implements OnChanges, OnDestroy {
private _uiChartsView: UIChartsView = null;
Expand Down Expand Up @@ -63,7 +63,7 @@ export class UIChartsViewDirective implements OnChanges, OnDestroy {
//////////////////////////////////////////////////////////////////////////////////////////////////
private setChartViewOptions() {
if (this.options !== null && this.options !== undefined) {
if (!this._uiChartsView._chartInitialized) {
if (!(<any>this._uiChartsView)._chartInitialized) {
this._uiChartsView.setOptions(this.options);
} else {
if (this.updateChartContent) {
Expand All @@ -78,6 +78,6 @@ export class UIChartsViewDirective implements OnChanges, OnDestroy {

@NgModule({
declarations: [UIChartsViewDirective],
exports: [UIChartsViewDirective]
exports: [UIChartsViewDirective],
})
export class UIChartsViewModule {}
3 changes: 2 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
"build.angular": "cd ../src-angular && npm run build",
"tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\"",
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**' --exclude '**/platforms/**'",
"src-angular.reset": "cd ../src-angular && npx rimraf node_modules package-lock.json",
"demo.ios": "tsc && npm i && cd ../demo && tns run ios",
"demo.android": "npm i && cd ../demo && tns run android",
"demo.reset": "cd ../demo && npx rimraf -- hooks node_modules platforms package-lock.json",
"demo-angular.ios": "npm i && cd ../demo-angular && tns run ios --no-hmr",
"demo-angular.android": "npm i && cd ../demo-angular && tns run android --no-hmr",
"demo-angular.reset": "cd ../demo-angular && npx rimraf -- hooks node_modules platforms package-lock.json",
"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",
"clean": "npm run demo.reset && npm run demo-angular.reset && npx rimraf node_modules package-lock.json angular && npm run tsc"
"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"
},
"keywords": [
"NativeScript",
Expand Down
1 change: 1 addition & 0 deletions src/ui-charts.android.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { UIChartsViewBase } from './ui-charts.common';
export declare class UIChartsView extends UIChartsViewBase {
_chartInitialized: boolean;
customLayoutChangeListener: any;
chartHeight: any;
chartWidth: any;
Expand Down
4 changes: 4 additions & 0 deletions src/ui-charts.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Application } from '@nativescript/core';
import { langHandler } from './options-handlers/lang/lang-handler';

export class UIChartsView extends UIChartsViewBase {
public _chartInitialized: boolean = false;
public customLayoutChangeListener;
public chartHeight;
public chartWidth;
Expand Down Expand Up @@ -61,6 +62,7 @@ export class UIChartsView extends UIChartsViewBase {
}

public disposeNativeView() {
this._chartInitialized = false;
Application.off('orientationChanged', (<any>this)._orientationHandler);
super.disposeNativeView();
}
Expand All @@ -79,6 +81,8 @@ export class UIChartsView extends UIChartsViewBase {
const hiOptions = optionsHandler(this.options);
if (this.nativeView) {
this.nativeView.setOptions(hiOptions);
this._chartInitialized = true;
this.nativeView.reload();
}
}

Expand Down
1 change: 1 addition & 0 deletions src/ui-charts.ios.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { UIChartsViewBase } from './ui-charts.common';
export declare class UIChartsView extends UIChartsViewBase {
_chartInitialized: boolean;
private _delegate;
onLoaded(): void;
createNativeView(): any;
Expand Down
4 changes: 4 additions & 0 deletions src/ui-charts.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { optionsHandler } from './options-handlers/options-handler';
import { langHandler } from './options-handlers/lang/lang-handler';

export class UIChartsView extends UIChartsViewBase {
public _chartInitialized: boolean = false;
private _delegate: HighchartsViewDelegateImpl;
public onLoaded() {
super.onLoaded();
Expand All @@ -23,6 +24,7 @@ export class UIChartsView extends UIChartsViewBase {
}

public disposeNativeView() {
this._chartInitialized = false;
super.disposeNativeView();
}

Expand All @@ -43,6 +45,8 @@ export class UIChartsView extends UIChartsViewBase {
const hiOptions = optionsHandler(this.options);
if (this.nativeView) {
this.nativeView.options = hiOptions;
this._chartInitialized = true;
this.nativeView.reload();
}
}

Expand Down