GrantMStevens / amCharts-Angular

Angular directive for amCharts library
Apache License 2.0
63 stars 39 forks source link

Zoom on chart load #69

Closed danielstpaul closed 7 years ago

danielstpaul commented 8 years ago

Hi,

I'm looking to perform a zoom when a chart initialises.

AmCharts example:

var chart = AmCharts.makeChart("blah", { options });

chart.addListener("rendered", zoomChart);
zoomChart();

// this method is called when chart is first inited as we listen for "rendered" event
function zoomChart() {
    // different zoom methods can be used - zoomToIndexes, zoomToDates, zoomToCategoryValues
    chart.zoomToIndexes(blah, blah);
}

how would I go about achieving this using this directive?

Cheers,

Dan

Sadi-1992 commented 7 years ago

is there no solution for this? :(

danielstpaul commented 7 years ago
listeners: [{
            event: 'rendered',
            method: function(e) {
              e.chart.zoomToCategoryValues('val1', 'val2');
            }
          }],

This is how I did it, added above to chart object.