I am starting with Angula 8 and ngx-charts.
I want to display graphs from configuration files. To do that, I allow the configuration file to provide several graphics options (basicaly, almost all options from https://swimlane.gitbook.io/ngx-charts/examples/bar-charts/vertical-bar-chart )
and I have a basic component looking like this :
<ngx-charts-bar-vertical
[results]="results"
[xAxisLabel]="xAxisLabel"
[yAxisLabel]="yAxisLabel"
[view]="displayOptions.view"
[scheme]="displayOptions.scheme"
[schemeType]="displayOptions.schemeType"
[customColors]="displayOptions.customColors"
[animations]="displayOptions.animations"
[legend]="displayOptions.legend"
[legendPosition]="displayOptions.legendPosition"
[gradient]="displayOptions.gradient"
[tooltipDisabled]="displayOptions.tooltipDisabled"
[xAxis]="displayOptions.xAxis"
[yAxis]="displayOptions.yAxis"
[showXAxisLabel]="displayOptions.showXAxisLabel"
[showYAxisLabel]="displayOptions.showYAxisLabel"
[showGridLines]="displayOptions.showGridLines"
[xAxisTicks]="displayOptions.xAxisTicks"
[yAxisTicks]="displayOptions.yAxisTicks"
[showDataLabel]="displayOptions.showDataLabel"
[barPadding]="displayOptions.barPadding"
(select)="onSelect($event)"
>
</ngx-charts-bar-vertical>
My issue is that I want to use defaults values from ngx-charts if user does not provide options. But ngx-charts does not allow null input for some inputs. For example, if "displayOptions.scheme" is null, ngx-charts can't display the graph.
ERROR Error: Cannot read property 'scaleType' of undefined
https://stackblitz.com/edit/vertical-bar-chart?embed=1&file=app/app.component.ts (juste have to remove the colorScheme object). Even if i provide a empty array for colorScheme.domain, it does not use default value.
In fact, I just want to do not pass any "scheme" Input to ngx-charts-bar-vertical component if there is no "displayOptions.scheme".
Is there a way to do this ? I didn't find any way to condition an use of input in Angular.