Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript Amcharts adding listeners

I have two functions like this:

    function zoomChart() {
        chart.zoomToIndexes(0, 20000);
    }

    function zoomAtStartToLast90() {
        var dataLength = am_chartData.length;
        chart.zoomToIndexes(dataLength - 90, dataLength - 1);
    }

When I draw the chart at the beginning, I want to see last 90 records. So I need to call for zoomAtStartToLast90() function, but when I make an update on chart I want to see all 20k records, so I will call for zoomChart().

inside AmCharts.ready(function () { I call this: chart.addListener("dataUpdated", zoomChart);

But where can I call zoomAtStartToLast90() function ? If I add it to addListener, chart is zoomed to last 90 records. Is it possible to call some function just after creeating chart ?

like image 581
trante Avatar asked Oct 04 '22 11:10

trante


1 Answers

to trigger a function just after creating chat you can use init event..

REF: AMcharts Docs

like image 85
Sandeep Avatar answered Oct 10 '22 03:10

Sandeep