GrantMStevens / amCharts-Angular

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

amCharts export plugin #26

Closed gsteiner89 closed 9 years ago

gsteiner89 commented 9 years ago

Greetings,

I want to use the official export plugin of amCharts as shown in this codepen example: http://codepen.io/amcharts/pen/55d41c60b96b44e1a69c94feb8f8b63b

But the export menu does not show up if i use the am-chart directive. Dont know if it should work, but maybe there is a way to implement the plugin in an easy way? I already tried it myself but i missed something.

asllad commented 9 years ago

I have a hack for the same problem

          // instantiate new chart object
          if (o.type === 'xy') {
            chart = o.theme ? new AmCharts.AmXYChart(AmCharts.themes[o.theme]) : new AmCharts.AmXYChart();
          } else if (o.type === 'pie') {
            chart = o.theme ? new AmCharts.AmPieChart(AmCharts.themes[o.theme]) : new AmCharts.AmPieChart();
          } else {
            chart = o.theme ? new AmCharts.AmSerialChart(AmCharts.themes[o.theme]) : new AmCharts.AmSerialChart();
          }

add this under the above lines

          if(!!o.export) {
            chart.export = o.export;
          }
gsteiner89 commented 9 years ago

Great and simple solution, works like a charm. Thanks for sharing!

GrantMStevens commented 9 years ago

I will extend the directive to add this in. The AmCharts lib has a lot of features that I didn't implement yet, simply because I haven't had the time.

GrantMStevens commented 9 years ago

Added this in 83933878b18ae5f080b0a6ebffb057c0af10d7f3