I have a problem once I add in Indicator the StockChart (angular)
- Can't add any other indicator
- Can't add the same again even if I delete it
- Can't compare other charts or update the main chart datasource, sometimes even the existing chart is broken once I delete the indicator.
core.js:6210 ERROR TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at TechnicalIndicator.processJsonData (ej2-charts.es2015.js:6094)
at TechnicalIndicator.dataManagerSuccess (ej2-charts.es2015.js:6435)
at TechnicalIndicator.refreshDataManager (ej2-charts.es2015.js:6412)
at Chart.initializeDataModule (ej2-charts.es2015.js:9696)
at Chart.processData (ej2-charts.es2015.js:9674)
at Chart.cartesianChartRendering (ej2-charts.es2015.js:9286)
at Chart.render (ej2-charts.es2015.js:9273)
at Chart.appendTo (ej2-base.es2015.js:6935)
at CartesianChart.initializeChart (ej2-charts.es2015.js:35130)
Here is this code:
<ejs-stockchart #stockChart id="chartStock" [enableSelector]=false [enablePeriodSelector]=false theme='Bootstrap' [primaryXAxis]='primaryXAxis' [primaryYAxis]='primaryYAxis' [axes]='axes' [rows]='rows' [tooltip]='tooltip' [crosshair]='crosshair'
[zoomSettings]='zoomSettings' (axisLabelRender)='axisLabelRender($event)'>
<e-stockchart-series-collection>
<e-stockchart-series name="my_volume" [dataSource]="chartData" type='Column' xName='date' yName='volume' volume='volume' yAxisName='volume_axis' [enableTooltip]=false></e-stockchart-series>
<e-stockchart-series [name]="my_serie" [dataSource]="chartData" type="HiloOpenClose" xName="date" yName='close' Open="open" High="high" Low="low" Close="close" Volume="volume" bearFillColor='#2ecd71' bullFillColor='#e74c3d'>
<e-trendlines>
<e-trendline type='Polynomial' width=0 fill='#9D36F1' [enableTooltip]=true></e-trendline>
</e-trendlines>
</e-stockchart-series>
</e-stockchart-series-collection>
</ejs-stockchart>
public onIndicatorChange(args: any): void {
if (args.value === 'ADD') {
this.stockChart.axes.push({
labelFormat: 'n2',
name: 'ADL_axis',
rowIndex: 1,
majorGridLines: { width: 0 },
});
this.stockChart.indicators.push({
type: 'AccumulationDistribution',
field: 'Close',
seriesName: 'my_name',
yAxisName: 'ADL_axis',
fill: 'blue',
period: 3,
animation: { enable: true },
});
} else {
this.stockChart.indicators.pop();
this.stockChart.axes.pop();
}
this.stockChart.refresh();
}
stockChart.getStockChartIndicators('Rsi');
stockChart.getStockChartIndicators('AccumulationDistribution'); |