I am working on amcharts. while exporting chart image the chart is taking too much time like 3 to 4 seconds , I need to show the loader during waiting time , Is there any functionality related to amcharts version 4.
Demo Code for chart (The below chart is not taking too much time because it is just a demo code)
/**
* ---------------------------------------
* This demo was created using amCharts 4.
*
* For more information visit:
* https://www.amcharts.com/
*
* Documentation is available at:
* https://www.amcharts.com/docs/v4/
* ---------------------------------------
*/
// Create chart instance
var chart = am4core.create("chartdiv", am4charts.XYChart);
// Add data
chart.data = [{
"category": "Research & Development",
"value": 3.5
}, {
"category": "Marketing",
"value": 6
}, {
"category": "Distribution",
"value": 4.2
}];
// Create axes
let categoryAxis = chart.xAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "category";
let valueAxis = chart.yAxes.push(new am4charts.ValueAxis());
// Create series
var series = chart.series.push(new am4charts.ColumnSeries());
series.dataFields.valueY = "value";
series.dataFields.categoryX = "category";
series.name = "Sales";
// Enable export
chart.exporting.menu = new am4core.ExportMenu();
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
#chartdiv {
width: 100%;
height: 300px;
}
<script src="//www.amcharts.com/lib/4/core.js"></script>
<script src="//www.amcharts.com/lib/4/charts.js"></script>
<div id="chartdiv"></div>
In the following example I need to show the loader when user export the chart in to image or excel e.t.c ...
I've tried to add javascript by using class name but unable to detect click event on export button.