#6812
by amcharts
HTML
<script type="text/javascript" src="http://www.amcharts.com/lib/3/amcharts.js"></script>
<script type="text/javascript" src="http://www.amcharts.com/lib/3/serial.js"></script>
<script type="text/javascript" src="http://www.amcharts.com/lib/3/themes/none.js"></script>
<script type="text/javascript" src="http://www.amcharts.com/lib/3/xy.js"></script>
<script type="text/javascript" src="http://www.amcharts.com/lib/3/exporting/amexport_combined.js"></script>
<div id="chartdiv"></div>
CSS
#chartdiv {
width : 100%;
height : 500px;
font-size : 11px;
}
JavaScript
/*
** MANUAL INJECTION OF THE DEV. VERSION
*/
AmCharts.AmExport = AmCharts.Class({
construct: function(chart, cfg, init ) {
var _this = this;
_this.DEBUG = false;
_this.chart = chart;
_this.canvas = null;
_this.svgs = [];
_this.userCFG = cfg;
_this.buttonIcon = 'export.png';
_this.exportPNG = true;
_this.exportPDF = false;
_this.exportJPG = false;
_this.exportSVG = false;
//_this.left;
_this.right = 0;
//_this.bottom;
_this.top = 0;
//_this.color;
_this.buttonRollOverColor = "#EFEFEF";
//_this.buttonColor = "#FFFFFF";
//_this.buttonRollOverAlpha = 0.5;
_this.textRollOverColor = "#CC0000";
_this.buttonTitle = "Save chart as an image";
_this.buttonAlpha = 0.75;
_this.imageFileName = "amChart";
_this.imageBackgroundColor = "#FFFFFF";
if (init) {
_this.init();
}
},
toCoordinate:function(value){
if(value === undefined){
return "auto";
}
if(String(value).indexOf("%") != -1){
return value;
}
else{
return value + "px";
}
},
init: function(){
var _this = this;
var formats = [];
if (_this.exportPNG) {
formats.push("png");
}
if (_this.exportPDF) {
formats.push("pdf");
}
if (_this.exportJPG) {
formats.push("jpg");
}
if (_this.exportSVG) {
formats.push("svg");
}
var menuItems = [];
if(formats.length == 1){
var format = formats[0];
menuItems.push({format:format, iconTitle:_this.buttonTitle, icon:_this.chart.pathToImages + _this.buttonIcon})
}
else if(formats.length > 1){
var subItems = [];
for(var i = 0; i < formats.length; i++){
subItems.push({format:formats[i], title:formats[i].toUpperCase()});
}
menuItems.push({onclick: function() {}, icon:_this.chart.pathToImages + _this.buttonIcon, items:subItems})
}
var color = _this.color;
if(color === undefined){
color = _this.chart.color;
}
var buttonColor = _this.buttonColor;
if(buttonColor ===...