NativeScript / nativescript-ui-charts

NativeScript wrapper around HiCharts library
Apache License 2.0
26 stars 6 forks source link

Version 0.1.0: Setting of chart options via Angular template does not work anymore #18

Closed cjohn001 closed 3 years ago

cjohn001 commented 3 years ago

Which platform(s) does your issue occur on?

iOS 13.5 but also other versions on emulator. Not tried on device as it likely is the same

Please, provide the following version numbers that your issue occurs with:

CLI: ns --version 7.2.1 Cross-platform modules: "@nativescript/core": "~7.3.0", Runtime(s): "tns-ios": "6.5.4", and @nativescript/ios 7.2.0 Plugin(s): 0.1.0

Please, tell us how to recreate the issue in as much detail as possible.

In the past I could set chart options vie the Angular template

<UIChartsView [options]="chartOptions" >

This unfortunately does not work currently. A workaround is given using the loaded event:

<UIChartsView (loaded)="chartLoaded($event)">

public chartLoaded(args: EventData) { const chart = args.object as UIChartsView; chart.setOptions(this.chartOptions); }

shiv19 commented 3 years ago

@cjohn001 Yes, we ended up removing the ability to hookup options by binding. And using the chartLoaded event is the only way to setup chart options now. The readme has already been updated to reflect the same.

And I've also updated all the chart demos in the "demo" folder. (haven't updated the angular demos yet)

Another thing is that, if you want to update the chart options after the chart has loaded, you have to use "updateOptions()" method on the chartView object.

cjohn001 commented 3 years ago

Hello @shiv19 , thanks a lot for the info. The updateOptions() function I would have probably never found out about. I assume due to having two functions now the binding in the angular template is not possible anymore? Just for interest. What does the updateOptions()function do different than setOptions()? I observed that when I async update data repeatedly within very short time intervals, the chart was not refreshed correctly in old plugin version. Is this solved with updateOptions() now? I suspected it to be due to a refresh with new data during initial chart animation. Therefore I had debounced my refreshs.

shiv19 commented 3 years ago

Yes with updateOptions, you should be able to update the chart data in short intervals

cjohn001 commented 3 years ago

Well, as this is the new intended behavior I think I can close this issue.