Я использую amchart в своем приложении angular6 с помощью следующего урока
amchart3-угловой
Но мне нужно показать график после загрузки всех его свойств. Как я могу проверить, готов ли график к загрузке в angular6? Я попытался с помощью свойства isReady amchart. Но он показывает следующую ошибку.
Cannot read property 'isReady' of undefined
app.component.ts
chart: AmChart;
ngAfterViewInit() {
this.chart = this.AmCharts.makeChart('chartdiv', {
'type': 'gauge',
'theme': 'light',
'dataProvider': [],
'axes': [{
'axisColor': 'transparent',
'color': '#fff',
'endValue': 7,
'gridInside': true,
'inside': true,
'radius': '100%',
'valueInterval': 1,
'tickColor': '#fff',
'pivotRadius': '0%',
'id': 'axes1',
'topText': 'RPM',
'topTextFontSize': 9,
'topTextYOffset': -20,
'topTextColor': '#fff',
'bottomTextYOffset': -3,
'bottomTextColor': '#fff',
'minorTickLength': 16,
'tickLength': 22,
'tickThickness': 2,
'labelOffset': 5,
'bands': [{
'color': '#f91f1f',
'endValue': 7,
'innerRadius': '87%',
'startValue': 5
},
{
'color': '#e60000',
'endValue': 0,
'startValue': 0,
'alpha': 0.3,
'radius': '100%',
'innerRadius': '15%',
},
{
'color': '#e60000',
'endValue': 0,
'startValue': 0,
'alpha': 0.6,
'radius': '100%',
'innerRadius': '15%',
},
]
}, {
'axisColor': '#fff',
'color': 'black',
'axisThickness': 3,
'endValue': 140,
'radius': '45%',
'valueInterval': 20,
'tickColor': 'black',
'axisAlpha': '0',
'bottomText': 'km/h',
'bottomTextFontSize': 9,
'bottomTextYOffset': -15,
'bottomTextColor': 'black',
'labelOffset': 2,
'tickThickness': 1.2,
'bands': [{
'color': '#fff',
'alpha': 1,
'startValue': 0,
'endValue': 220,
'radius': '100%',
'innerRadius': '0'
}]
}],
'arrows': [{
'color': '#ff0000',
'innerRadius': '6.3%',
'radius': '40%',
'startWidth': 3,
'value': 0,
}, {
'color': '#ff0000',
'innerRadius': '46%',
'radius': '90%',
'startWidth': 8,
'value': 0
},
{
'color': '#111',
'innerRadius': '7%',
'radius': '0',
'startWidth': 0,
'value': 0,
'nailAlpha': 1,
'nailRadius': 10
}
],
'export': {
'enabled': true
}
});
}
app.component.html
<div id="chartdiv" [style.width.%]="100" [style.height.px]="400">
в приведенном выше коде я создал диаграмму и сохранил ее в переменной типа Amchart и отобразил ее в шаблоне с помощью id. Когда я запускаю приложение, график занимает мало времени, чтобы показать его в шаблоне. Так что мне нужно показать график только после его инициализации. Как я могу решить эту проблему?