sunrise-votes 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -4
- data/Rakefile +0 -22
- data/app/controllers/manage/ballot_box/votes_controller.rb +4 -0
- data/app/views/manage/ballot_box/votes/show.html.erb +211 -81
- data/lib/generators/sunrise/votes/install_generator.rb +1 -1
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/highcharts.js +170 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/highcharts.src.js +11428 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/modules/exporting.js +22 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/modules/exporting.src.js +711 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/themes/dark-blue.js +263 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/themes/dark-green.js +263 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/themes/gray.js +262 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/themes/grid.js +96 -0
- data/lib/generators/sunrise/votes/templates/javascripts/highcharts/themes/skies.js +89 -0
- data/lib/sunrise/votes/version.rb +1 -1
- metadata +33 -79
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/excanvas.min.js +0 -35
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/jquery.jqplot.css +0 -226
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/jquery.jqplot.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.BezierCurveRenderer.js +0 -312
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.BezierCurveRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.barRenderer.js +0 -702
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.barRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.blockRenderer.js +0 -234
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.blockRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.bubbleRenderer.js +0 -748
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.bubbleRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasAxisLabelRenderer.js +0 -199
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasAxisLabelRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasAxisTickRenderer.js +0 -238
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasAxisTickRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasOverlay.js +0 -614
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasOverlay.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasTextRenderer.js +0 -420
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.canvasTextRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.categoryAxisRenderer.js +0 -634
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.categoryAxisRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.ciParser.js +0 -115
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.ciParser.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.cursor.js +0 -1002
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.cursor.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.dateAxisRenderer.js +0 -439
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.dateAxisRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.donutRenderer.js +0 -904
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.donutRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.dragable.js +0 -218
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.dragable.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.enhancedLegendRenderer.js +0 -199
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.enhancedLegendRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.funnelRenderer.js +0 -932
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.funnelRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.highlighter.js +0 -406
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.highlighter.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.json2.js +0 -475
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.json2.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.logAxisRenderer.js +0 -446
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.logAxisRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.mekkoAxisRenderer.js +0 -607
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.mekkoAxisRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.mekkoRenderer.js +0 -432
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.mekkoRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.meterGaugeRenderer.js +0 -1142
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.meterGaugeRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.ohlcRenderer.js +0 -372
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.ohlcRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.pieRenderer.js +0 -797
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.pieRenderer.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.pointLabels.js +0 -337
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.pointLabels.min.js +0 -30
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.trendline.js +0 -220
- data/lib/generators/sunrise/votes/templates/javascripts/ballot_box/plugins/jqplot.trendline.min.js +0 -30
@@ -0,0 +1,22 @@
|
|
1
|
+
/*
|
2
|
+
Highcharts JS v2.1.7 (2011-10-19)
|
3
|
+
Exporting module
|
4
|
+
|
5
|
+
(c) 2010-2011 Torstein H?nsi
|
6
|
+
|
7
|
+
License: www.highcharts.com/license
|
8
|
+
*/
|
9
|
+
(function(){var h=Highcharts,u=h.Chart,z=h.addEvent,m=h.createElement,v=h.discardElement,r=h.css,p=h.merge,j=h.each,n=h.extend,A=Math.max,i=document,B=window,w=i.documentElement.ontouchstart!==void 0,s=h.getOptions();n(s.lang,{downloadPNG:"Download PNG image",downloadJPEG:"Download JPEG image",downloadPDF:"Download PDF document",downloadSVG:"Download SVG vector image",exportButtonTitle:"Export to raster or vector image",printButtonTitle:"Print the chart"});s.navigation={menuStyle:{border:"1px solid #A0A0A0",
|
10
|
+
background:"#FFFFFF"},menuItemStyle:{padding:"0 5px",background:"none",color:"#303030",fontSize:w?"14px":"11px"},menuItemHoverStyle:{background:"#4572A5",color:"#FFFFFF"},buttonOptions:{align:"right",backgroundColor:{linearGradient:[0,0,0,20],stops:[[0.4,"#F7F7F7"],[0.6,"#E3E3E3"]]},borderColor:"#B0B0B0",borderRadius:3,borderWidth:1,height:20,hoverBorderColor:"#909090",hoverSymbolFill:"#81A7CF",hoverSymbolStroke:"#4572A5",symbolFill:"#E0E0E0",symbolStroke:"#A0A0A0",symbolX:11.5,symbolY:10.5,verticalAlign:"top",
|
11
|
+
width:24,y:10}};s.exporting={type:"image/png",url:"http://export.highcharts.com/",width:800,enableImages:!1,buttons:{exportButton:{symbol:"exportIcon",x:-10,symbolFill:"#A8BF77",hoverSymbolFill:"#768F3E",_id:"exportButton",_titleKey:"exportButtonTitle",menuItems:[{textKey:"downloadPNG",onclick:function(){this.exportChart()}},{textKey:"downloadJPEG",onclick:function(){this.exportChart({type:"image/jpeg"})}},{textKey:"downloadPDF",onclick:function(){this.exportChart({type:"application/pdf"})}},{textKey:"downloadSVG",
|
12
|
+
onclick:function(){this.exportChart({type:"image/svg+xml"})}}]},printButton:{symbol:"printIcon",x:-36,symbolFill:"#B5C9DF",hoverSymbolFill:"#779ABF",_id:"printButton",_titleKey:"printButtonTitle",onclick:function(){this.print()}}}};n(u.prototype,{getSVG:function(b){var c=this,a,e,d,k,f,t,g=p(c.options,b);if(!i.createElementNS)i.createElementNS=function(a,b){var c=i.createElement(b);c.getBBox=function(){return h.Renderer.prototype.Element.prototype.getBBox.apply({element:c})};return c};b=m("div",null,
|
13
|
+
{position:"absolute",top:"-9999em",width:c.chartWidth+"px",height:c.chartHeight+"px"},i.body);n(g.chart,{renderTo:b,forExport:!0});g.exporting.enabled=!1;if(!g.exporting.enableImages)g.chart.plotBackgroundImage=null;g.series=[];j(c.series,function(a){d=a.options;d.animation=!1;d.showCheckbox=!1;d.visible=a.visible;if(!g.exporting.enableImages&&d&&d.marker&&/^url\(/.test(d.marker.symbol))d.marker.symbol="circle";d.data=[];j(a.data,function(a){k=a.config;f={x:a.x,y:a.y,name:a.name};typeof k==="object"&&
|
14
|
+
a.config&&k.constructor!==Array&&n(f,k);f.visible=a.visible;d.data.push(f);g.exporting.enableImages||(t=a.config&&a.config.marker)&&/^url\(/.test(t.symbol)&&delete t.symbol});g.series.push(d)});a=new Highcharts.Chart(g);j(["xAxis","yAxis"],function(b){j(c[b],function(c,d){var f=a[b][d],e=c.getExtremes(),g=e.userMin,e=e.userMax;(g!==void 0||e!==void 0)&&f.setExtremes(g,e,!0,!1)})});e=a.container.innerHTML;g=null;a.destroy();v(b);e=e.replace(/zIndex="[^"]+"/g,"").replace(/isShadow="[^"]+"/g,"").replace(/symbolName="[^"]+"/g,
|
15
|
+
"").replace(/jQuery[0-9]+="[^"]+"/g,"").replace(/isTracker="[^"]+"/g,"").replace(/url\([^#]+#/g,"url(#").replace(/<svg /,'<svg xmlns:xlink="http://www.w3.org/1999/xlink" ').replace(/ href=/g," xlink:href=").replace(/ /g,"\u00a0").replace(/­/g,"\u00ad").replace(/id=([^" >]+)/g,'id="$1"').replace(/class=([^" ]+)/g,'class="$1"').replace(/ transform /g," ").replace(/:(path|rect)/g,"$1").replace(/<img ([^>]*)>/gi,"<image $1 />").replace(/<\/image>/g,"").replace(/<image ([^>]*)([^\/])>/gi,"<image $1$2 />").replace(/width=(\d+)/g,
|
16
|
+
'width="$1"').replace(/height=(\d+)/g,'height="$1"').replace(/hc-svg-href="/g,'xlink:href="').replace(/style="([^"]+)"/g,function(a){return a.toLowerCase()});e=e.replace(/(url\(#highcharts-[0-9]+)"/g,"$1").replace(/"/g,"'");e.match(/ xmlns="/g).length===2&&(e=e.replace(/xmlns="[^"]+"/,""));return e},exportChart:function(b,c){var a,e=this.getSVG(c),b=p(this.options.exporting,b);a=m("form",{method:"post",action:b.url},{display:"none"},i.body);j(["filename","type","width","svg"],function(c){m("input",
|
17
|
+
{type:"hidden",name:c,value:{filename:b.filename||"chart",type:b.type,width:b.width,svg:e}[c]},null,a)});a.submit();v(a)},print:function(){var b=this,c=b.container,a=[],e=c.parentNode,d=i.body,k=d.childNodes;if(!b.isPrinting)b.isPrinting=!0,j(k,function(b,c){if(b.nodeType===1)a[c]=b.style.display,b.style.display="none"}),d.appendChild(c),B.print(),setTimeout(function(){e.appendChild(c);j(k,function(b,c){if(b.nodeType===1)b.style.display=a[c]});b.isPrinting=!1},1E3)},contextMenu:function(b,c,a,e,d,
|
18
|
+
k){var f=this,h=f.options.navigation,g=h.menuItemStyle,i=f.chartWidth,x=f.chartHeight,q="cache-"+b,l=f[q],o=A(d,k),y,p;if(!l)f[q]=l=m("div",{className:"highcharts-"+b},{position:"absolute",zIndex:1E3,padding:o+"px"},f.container),y=m("div",null,n({MozBoxShadow:"3px 3px 10px #888",WebkitBoxShadow:"3px 3px 10px #888",boxShadow:"3px 3px 10px #888"},h.menuStyle),l),p=function(){r(l,{display:"none"})},z(l,"mouseleave",p),j(c,function(a){a&&(m("div",{onmouseover:function(){r(this,h.menuItemHoverStyle)},
|
19
|
+
onmouseout:function(){r(this,g)},innerHTML:a.text||f.options.lang[a.textKey]},n({cursor:"pointer"},g),y)[w?"ontouchstart":"onclick"]=function(){p();a.onclick.apply(f,arguments)})}),f.exportMenuWidth=l.offsetWidth,f.exportMenuHeight=l.offsetHeight;b={display:"block"};a+f.exportMenuWidth>i?b.right=i-a-d-o+"px":b.left=a-o+"px";e+k+f.exportMenuHeight>x?b.bottom=x-e-o+"px":b.top=e+k-o+"px";r(l,b)},addButton:function(b){function c(){m.attr(o);j.attr(l)}var a=this,e=a.renderer,d=p(a.options.navigation.buttonOptions,
|
20
|
+
b),h=d.onclick,f=d.menuItems,i=d.width,g=d.height,j,m,q,b=d.borderWidth,l={stroke:d.borderColor},o={stroke:d.symbolStroke,fill:d.symbolFill};d.enabled!==!1&&(j=e.rect(0,0,i,g,d.borderRadius,b).align(d,!0).attr(n({fill:d.backgroundColor,"stroke-width":b,zIndex:19},l)).add(),q=e.rect(0,0,i,g,0).align(d).attr({id:d._id,fill:"rgba(255, 255, 255, 0.001)",title:a.options.lang[d._titleKey],zIndex:21}).css({cursor:"pointer"}).on("mouseover",function(){m.attr({stroke:d.hoverSymbolStroke,fill:d.hoverSymbolFill});
|
21
|
+
j.attr({stroke:d.hoverBorderColor})}).on("mouseout",c).on("click",c).add(),f&&(h=function(){c();var b=q.getBBox();a.contextMenu("export-menu",f,b.x,b.y,i,g)}),q.on("click",function(){h.apply(a,arguments)}),m=e.symbol(d.symbol,d.symbolX,d.symbolY,(d.symbolSize||12)/2).align(d,!0).attr(n(o,{"stroke-width":d.symbolStrokeWidth||1,zIndex:20})).add())}});h.Renderer.prototype.symbols.exportIcon=function(b,c,a){return["M",b-a,c+a,"L",b+a,c+a,b+a,c+a*0.5,b-a,c+a*0.5,"Z","M",b,c+a*0.5,"L",b-a*0.5,c-a/3,b-a/
|
22
|
+
6,c-a/3,b-a/6,c-a,b+a/6,c-a,b+a/6,c-a/3,b+a*0.5,c-a/3,"Z"]};h.Renderer.prototype.symbols.printIcon=function(b,c,a){return["M",b-a,c+a*0.5,"L",b+a,c+a*0.5,b+a,c-a/3,b-a,c-a/3,"Z","M",b-a*0.5,c-a/3,"L",b-a*0.5,c-a,b+a*0.5,c-a,b+a*0.5,c-a/3,"Z","M",b-a*0.5,c+a*0.5,"L",b-a*0.75,c+a,b+a*0.75,c+a,b+a*0.5,c+a*0.5,"Z"]};u.prototype.callbacks.push(function(b){var c,a=b.options.exporting,e=a.buttons;if(a.enabled!==!1)for(c in e)b.addButton(e[c])})})();
|
@@ -0,0 +1,711 @@
|
|
1
|
+
/**
|
2
|
+
* @license Highcharts JS v2.1.7 (2011-10-19)
|
3
|
+
* Exporting module
|
4
|
+
*
|
5
|
+
* (c) 2010-2011 Torstein Hønsi
|
6
|
+
*
|
7
|
+
* License: www.highcharts.com/license
|
8
|
+
*/
|
9
|
+
|
10
|
+
// JSLint options:
|
11
|
+
/*global Highcharts, document, window, Math, setTimeout */
|
12
|
+
|
13
|
+
(function () { // encapsulate
|
14
|
+
|
15
|
+
// create shortcuts
|
16
|
+
var HC = Highcharts,
|
17
|
+
Chart = HC.Chart,
|
18
|
+
addEvent = HC.addEvent,
|
19
|
+
createElement = HC.createElement,
|
20
|
+
discardElement = HC.discardElement,
|
21
|
+
css = HC.css,
|
22
|
+
merge = HC.merge,
|
23
|
+
each = HC.each,
|
24
|
+
extend = HC.extend,
|
25
|
+
math = Math,
|
26
|
+
mathMax = math.max,
|
27
|
+
doc = document,
|
28
|
+
win = window,
|
29
|
+
hasTouch = doc.documentElement.ontouchstart !== undefined,
|
30
|
+
M = 'M',
|
31
|
+
L = 'L',
|
32
|
+
DIV = 'div',
|
33
|
+
HIDDEN = 'hidden',
|
34
|
+
NONE = 'none',
|
35
|
+
PREFIX = 'highcharts-',
|
36
|
+
ABSOLUTE = 'absolute',
|
37
|
+
PX = 'px',
|
38
|
+
UNDEFINED,
|
39
|
+
defaultOptions = HC.getOptions();
|
40
|
+
|
41
|
+
// Add language
|
42
|
+
extend(defaultOptions.lang, {
|
43
|
+
downloadPNG: 'Download PNG image',
|
44
|
+
downloadJPEG: 'Download JPEG image',
|
45
|
+
downloadPDF: 'Download PDF document',
|
46
|
+
downloadSVG: 'Download SVG vector image',
|
47
|
+
exportButtonTitle: 'Export to raster or vector image',
|
48
|
+
printButtonTitle: 'Print the chart'
|
49
|
+
});
|
50
|
+
|
51
|
+
// Buttons and menus are collected in a separate config option set called 'navigation'.
|
52
|
+
// This can be extended later to add control buttons like zoom and pan right click menus.
|
53
|
+
defaultOptions.navigation = {
|
54
|
+
menuStyle: {
|
55
|
+
border: '1px solid #A0A0A0',
|
56
|
+
background: '#FFFFFF'
|
57
|
+
},
|
58
|
+
menuItemStyle: {
|
59
|
+
padding: '0 5px',
|
60
|
+
background: NONE,
|
61
|
+
color: '#303030',
|
62
|
+
fontSize: hasTouch ? '14px' : '11px'
|
63
|
+
},
|
64
|
+
menuItemHoverStyle: {
|
65
|
+
background: '#4572A5',
|
66
|
+
color: '#FFFFFF'
|
67
|
+
},
|
68
|
+
|
69
|
+
buttonOptions: {
|
70
|
+
align: 'right',
|
71
|
+
backgroundColor: {
|
72
|
+
linearGradient: [0, 0, 0, 20],
|
73
|
+
stops: [
|
74
|
+
[0.4, '#F7F7F7'],
|
75
|
+
[0.6, '#E3E3E3']
|
76
|
+
]
|
77
|
+
},
|
78
|
+
borderColor: '#B0B0B0',
|
79
|
+
borderRadius: 3,
|
80
|
+
borderWidth: 1,
|
81
|
+
//enabled: true,
|
82
|
+
height: 20,
|
83
|
+
hoverBorderColor: '#909090',
|
84
|
+
hoverSymbolFill: '#81A7CF',
|
85
|
+
hoverSymbolStroke: '#4572A5',
|
86
|
+
symbolFill: '#E0E0E0',
|
87
|
+
//symbolSize: 12,
|
88
|
+
symbolStroke: '#A0A0A0',
|
89
|
+
//symbolStrokeWidth: 1,
|
90
|
+
symbolX: 11.5,
|
91
|
+
symbolY: 10.5,
|
92
|
+
verticalAlign: 'top',
|
93
|
+
width: 24,
|
94
|
+
y: 10
|
95
|
+
}
|
96
|
+
};
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
// Add the export related options
|
101
|
+
defaultOptions.exporting = {
|
102
|
+
//enabled: true,
|
103
|
+
//filename: 'chart',
|
104
|
+
type: 'image/png',
|
105
|
+
url: 'http://export.highcharts.com/',
|
106
|
+
width: 800,
|
107
|
+
enableImages: false,
|
108
|
+
buttons: {
|
109
|
+
exportButton: {
|
110
|
+
//enabled: true,
|
111
|
+
symbol: 'exportIcon',
|
112
|
+
x: -10,
|
113
|
+
symbolFill: '#A8BF77',
|
114
|
+
hoverSymbolFill: '#768F3E',
|
115
|
+
_id: 'exportButton',
|
116
|
+
_titleKey: 'exportButtonTitle',
|
117
|
+
menuItems: [{
|
118
|
+
textKey: 'downloadPNG',
|
119
|
+
onclick: function () {
|
120
|
+
this.exportChart();
|
121
|
+
}
|
122
|
+
}, {
|
123
|
+
textKey: 'downloadJPEG',
|
124
|
+
onclick: function () {
|
125
|
+
this.exportChart({
|
126
|
+
type: 'image/jpeg'
|
127
|
+
});
|
128
|
+
}
|
129
|
+
}, {
|
130
|
+
textKey: 'downloadPDF',
|
131
|
+
onclick: function () {
|
132
|
+
this.exportChart({
|
133
|
+
type: 'application/pdf'
|
134
|
+
});
|
135
|
+
}
|
136
|
+
}, {
|
137
|
+
textKey: 'downloadSVG',
|
138
|
+
onclick: function () {
|
139
|
+
this.exportChart({
|
140
|
+
type: 'image/svg+xml'
|
141
|
+
});
|
142
|
+
}
|
143
|
+
}/*, {
|
144
|
+
text: 'View SVG',
|
145
|
+
onclick: function() {
|
146
|
+
var svg = this.getSVG()
|
147
|
+
.replace(/</g, '\n<')
|
148
|
+
.replace(/>/g, '>');
|
149
|
+
|
150
|
+
doc.body.innerHTML = '<pre>'+ svg +'</pre>';
|
151
|
+
}
|
152
|
+
}*/]
|
153
|
+
|
154
|
+
},
|
155
|
+
printButton: {
|
156
|
+
//enabled: true,
|
157
|
+
symbol: 'printIcon',
|
158
|
+
x: -36,
|
159
|
+
symbolFill: '#B5C9DF',
|
160
|
+
hoverSymbolFill: '#779ABF',
|
161
|
+
_id: 'printButton',
|
162
|
+
_titleKey: 'printButtonTitle',
|
163
|
+
onclick: function () {
|
164
|
+
this.print();
|
165
|
+
}
|
166
|
+
}
|
167
|
+
}
|
168
|
+
};
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
extend(Chart.prototype, {
|
173
|
+
/**
|
174
|
+
* Return an SVG representation of the chart
|
175
|
+
*
|
176
|
+
* @param additionalOptions {Object} Additional chart options for the generated SVG representation
|
177
|
+
*/
|
178
|
+
getSVG: function (additionalOptions) {
|
179
|
+
var chart = this,
|
180
|
+
chartCopy,
|
181
|
+
sandbox,
|
182
|
+
svg,
|
183
|
+
seriesOptions,
|
184
|
+
config,
|
185
|
+
pointOptions,
|
186
|
+
pointMarker,
|
187
|
+
options = merge(chart.options, additionalOptions); // copy the options and add extra options
|
188
|
+
|
189
|
+
// IE compatibility hack for generating SVG content that it doesn't really understand
|
190
|
+
if (!doc.createElementNS) {
|
191
|
+
/*jslint unparam: true*//* allow unused parameter ns in function below */
|
192
|
+
doc.createElementNS = function (ns, tagName) {
|
193
|
+
var elem = doc.createElement(tagName);
|
194
|
+
elem.getBBox = function () {
|
195
|
+
return HC.Renderer.prototype.Element.prototype.getBBox.apply({ element: elem });
|
196
|
+
};
|
197
|
+
return elem;
|
198
|
+
};
|
199
|
+
/*jslint unparam: false*/
|
200
|
+
}
|
201
|
+
|
202
|
+
// create a sandbox where a new chart will be generated
|
203
|
+
sandbox = createElement(DIV, null, {
|
204
|
+
position: ABSOLUTE,
|
205
|
+
top: '-9999em',
|
206
|
+
width: chart.chartWidth + PX,
|
207
|
+
height: chart.chartHeight + PX
|
208
|
+
}, doc.body);
|
209
|
+
|
210
|
+
// override some options
|
211
|
+
extend(options.chart, {
|
212
|
+
renderTo: sandbox,
|
213
|
+
forExport: true
|
214
|
+
});
|
215
|
+
options.exporting.enabled = false; // hide buttons in print
|
216
|
+
|
217
|
+
if (!options.exporting.enableImages) {
|
218
|
+
options.chart.plotBackgroundImage = null; // the converter doesn't handle images
|
219
|
+
}
|
220
|
+
|
221
|
+
// prepare for replicating the chart
|
222
|
+
options.series = [];
|
223
|
+
each(chart.series, function (serie) {
|
224
|
+
seriesOptions = serie.options;
|
225
|
+
|
226
|
+
seriesOptions.animation = false; // turn off animation
|
227
|
+
seriesOptions.showCheckbox = false;
|
228
|
+
seriesOptions.visible = serie.visible;
|
229
|
+
|
230
|
+
if (!options.exporting.enableImages) {
|
231
|
+
// remove image markers
|
232
|
+
if (seriesOptions && seriesOptions.marker && /^url\(/.test(seriesOptions.marker.symbol)) {
|
233
|
+
seriesOptions.marker.symbol = 'circle';
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
seriesOptions.data = [];
|
238
|
+
|
239
|
+
each(serie.data, function (point) {
|
240
|
+
|
241
|
+
// extend the options by those values that can be expressed in a number or array config
|
242
|
+
config = point.config;
|
243
|
+
pointOptions = {
|
244
|
+
x: point.x,
|
245
|
+
y: point.y,
|
246
|
+
name: point.name
|
247
|
+
};
|
248
|
+
|
249
|
+
if (typeof config === 'object' && point.config && config.constructor !== Array) {
|
250
|
+
extend(pointOptions, config);
|
251
|
+
}
|
252
|
+
|
253
|
+
pointOptions.visible = point.visible;
|
254
|
+
seriesOptions.data.push(pointOptions); // copy fresh updated data
|
255
|
+
|
256
|
+
if (!options.exporting.enableImages) {
|
257
|
+
// remove image markers
|
258
|
+
pointMarker = point.config && point.config.marker;
|
259
|
+
if (pointMarker && /^url\(/.test(pointMarker.symbol)) {
|
260
|
+
delete pointMarker.symbol;
|
261
|
+
}
|
262
|
+
}
|
263
|
+
});
|
264
|
+
|
265
|
+
options.series.push(seriesOptions);
|
266
|
+
});
|
267
|
+
|
268
|
+
// generate the chart copy
|
269
|
+
chartCopy = new Highcharts.Chart(options);
|
270
|
+
|
271
|
+
// reflect axis extremes in the export
|
272
|
+
each(['xAxis', 'yAxis'], function (axisType) {
|
273
|
+
each(chart[axisType], function (axis, i) {
|
274
|
+
var axisCopy = chartCopy[axisType][i],
|
275
|
+
extremes = axis.getExtremes(),
|
276
|
+
userMin = extremes.userMin,
|
277
|
+
userMax = extremes.userMax;
|
278
|
+
|
279
|
+
if (userMin !== UNDEFINED || userMax !== UNDEFINED) {
|
280
|
+
axisCopy.setExtremes(userMin, userMax, true, false);
|
281
|
+
}
|
282
|
+
});
|
283
|
+
});
|
284
|
+
|
285
|
+
// get the SVG from the container's innerHTML
|
286
|
+
svg = chartCopy.container.innerHTML;
|
287
|
+
|
288
|
+
// free up memory
|
289
|
+
options = null;
|
290
|
+
chartCopy.destroy();
|
291
|
+
discardElement(sandbox);
|
292
|
+
|
293
|
+
// sanitize
|
294
|
+
svg = svg
|
295
|
+
.replace(/zIndex="[^"]+"/g, '')
|
296
|
+
.replace(/isShadow="[^"]+"/g, '')
|
297
|
+
.replace(/symbolName="[^"]+"/g, '')
|
298
|
+
.replace(/jQuery[0-9]+="[^"]+"/g, '')
|
299
|
+
.replace(/isTracker="[^"]+"/g, '')
|
300
|
+
.replace(/url\([^#]+#/g, 'url(#')
|
301
|
+
.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ')
|
302
|
+
.replace(/ href=/g, ' xlink:href=')
|
303
|
+
/*.replace(/preserveAspectRatio="none">/g, 'preserveAspectRatio="none"/>')*/
|
304
|
+
/* This fails in IE < 8
|
305
|
+
.replace(/([0-9]+)\.([0-9]+)/g, function(s1, s2, s3) { // round off to save weight
|
306
|
+
return s2 +'.'+ s3[0];
|
307
|
+
})*/
|
308
|
+
|
309
|
+
// Replace HTML entities, issue #347
|
310
|
+
.replace(/ /g, '\u00A0') // no-break space
|
311
|
+
.replace(/­/g, '\u00AD') // soft hyphen
|
312
|
+
|
313
|
+
// IE specific
|
314
|
+
.replace(/id=([^" >]+)/g, 'id="$1"')
|
315
|
+
.replace(/class=([^" ]+)/g, 'class="$1"')
|
316
|
+
.replace(/ transform /g, ' ')
|
317
|
+
.replace(/:(path|rect)/g, '$1')
|
318
|
+
.replace(/<img ([^>]*)>/gi, '<image $1 />')
|
319
|
+
.replace(/<\/image>/g, '') // remove closing tags for images as they'll never have any content
|
320
|
+
.replace(/<image ([^>]*)([^\/])>/gi, '<image $1$2 />') // closes image tags for firefox
|
321
|
+
.replace(/width=(\d+)/g, 'width="$1"')
|
322
|
+
.replace(/height=(\d+)/g, 'height="$1"')
|
323
|
+
.replace(/hc-svg-href="/g, 'xlink:href="')
|
324
|
+
.replace(/style="([^"]+)"/g, function (s) {
|
325
|
+
return s.toLowerCase();
|
326
|
+
});
|
327
|
+
|
328
|
+
// IE9 beta bugs with innerHTML. Test again with final IE9.
|
329
|
+
svg = svg.replace(/(url\(#highcharts-[0-9]+)"/g, '$1')
|
330
|
+
.replace(/"/g, "'");
|
331
|
+
if (svg.match(/ xmlns="/g).length === 2) {
|
332
|
+
svg = svg.replace(/xmlns="[^"]+"/, '');
|
333
|
+
}
|
334
|
+
|
335
|
+
return svg;
|
336
|
+
},
|
337
|
+
|
338
|
+
/**
|
339
|
+
* Submit the SVG representation of the chart to the server
|
340
|
+
* @param {Object} options Exporting options. Possible members are url, type and width.
|
341
|
+
* @param {Object} chartOptions Additional chart options for the SVG representation of the chart
|
342
|
+
*/
|
343
|
+
exportChart: function (options, chartOptions) {
|
344
|
+
var form,
|
345
|
+
chart = this,
|
346
|
+
svg = chart.getSVG(chartOptions);
|
347
|
+
|
348
|
+
// merge the options
|
349
|
+
options = merge(chart.options.exporting, options);
|
350
|
+
|
351
|
+
// create the form
|
352
|
+
form = createElement('form', {
|
353
|
+
method: 'post',
|
354
|
+
action: options.url
|
355
|
+
}, {
|
356
|
+
display: NONE
|
357
|
+
}, doc.body);
|
358
|
+
|
359
|
+
// add the values
|
360
|
+
each(['filename', 'type', 'width', 'svg'], function (name) {
|
361
|
+
createElement('input', {
|
362
|
+
type: HIDDEN,
|
363
|
+
name: name,
|
364
|
+
value: {
|
365
|
+
filename: options.filename || 'chart',
|
366
|
+
type: options.type,
|
367
|
+
width: options.width,
|
368
|
+
svg: svg
|
369
|
+
}[name]
|
370
|
+
}, null, form);
|
371
|
+
});
|
372
|
+
|
373
|
+
// submit
|
374
|
+
form.submit();
|
375
|
+
|
376
|
+
// clean up
|
377
|
+
discardElement(form);
|
378
|
+
},
|
379
|
+
|
380
|
+
/**
|
381
|
+
* Print the chart
|
382
|
+
*/
|
383
|
+
print: function () {
|
384
|
+
|
385
|
+
var chart = this,
|
386
|
+
container = chart.container,
|
387
|
+
origDisplay = [],
|
388
|
+
origParent = container.parentNode,
|
389
|
+
body = doc.body,
|
390
|
+
childNodes = body.childNodes;
|
391
|
+
|
392
|
+
if (chart.isPrinting) { // block the button while in printing mode
|
393
|
+
return;
|
394
|
+
}
|
395
|
+
|
396
|
+
chart.isPrinting = true;
|
397
|
+
|
398
|
+
// hide all body content
|
399
|
+
each(childNodes, function (node, i) {
|
400
|
+
if (node.nodeType === 1) {
|
401
|
+
origDisplay[i] = node.style.display;
|
402
|
+
node.style.display = NONE;
|
403
|
+
}
|
404
|
+
});
|
405
|
+
|
406
|
+
// pull out the chart
|
407
|
+
body.appendChild(container);
|
408
|
+
|
409
|
+
// print
|
410
|
+
win.print();
|
411
|
+
|
412
|
+
// allow the browser to prepare before reverting
|
413
|
+
setTimeout(function () {
|
414
|
+
|
415
|
+
// put the chart back in
|
416
|
+
origParent.appendChild(container);
|
417
|
+
|
418
|
+
// restore all body content
|
419
|
+
each(childNodes, function (node, i) {
|
420
|
+
if (node.nodeType === 1) {
|
421
|
+
node.style.display = origDisplay[i];
|
422
|
+
}
|
423
|
+
});
|
424
|
+
|
425
|
+
chart.isPrinting = false;
|
426
|
+
|
427
|
+
}, 1000);
|
428
|
+
|
429
|
+
},
|
430
|
+
|
431
|
+
/**
|
432
|
+
* Display a popup menu for choosing the export type
|
433
|
+
*
|
434
|
+
* @param {String} name An identifier for the menu
|
435
|
+
* @param {Array} items A collection with text and onclicks for the items
|
436
|
+
* @param {Number} x The x position of the opener button
|
437
|
+
* @param {Number} y The y position of the opener button
|
438
|
+
* @param {Number} width The width of the opener button
|
439
|
+
* @param {Number} height The height of the opener button
|
440
|
+
*/
|
441
|
+
contextMenu: function (name, items, x, y, width, height) {
|
442
|
+
var chart = this,
|
443
|
+
navOptions = chart.options.navigation,
|
444
|
+
menuItemStyle = navOptions.menuItemStyle,
|
445
|
+
chartWidth = chart.chartWidth,
|
446
|
+
chartHeight = chart.chartHeight,
|
447
|
+
cacheName = 'cache-' + name,
|
448
|
+
menu = chart[cacheName],
|
449
|
+
menuPadding = mathMax(width, height), // for mouse leave detection
|
450
|
+
boxShadow = '3px 3px 10px #888',
|
451
|
+
innerMenu,
|
452
|
+
hide,
|
453
|
+
menuStyle;
|
454
|
+
|
455
|
+
// create the menu only the first time
|
456
|
+
if (!menu) {
|
457
|
+
|
458
|
+
// create a HTML element above the SVG
|
459
|
+
chart[cacheName] = menu = createElement(DIV, {
|
460
|
+
className: PREFIX + name
|
461
|
+
}, {
|
462
|
+
position: ABSOLUTE,
|
463
|
+
zIndex: 1000,
|
464
|
+
padding: menuPadding + PX
|
465
|
+
}, chart.container);
|
466
|
+
|
467
|
+
innerMenu = createElement(DIV, null,
|
468
|
+
extend({
|
469
|
+
MozBoxShadow: boxShadow,
|
470
|
+
WebkitBoxShadow: boxShadow,
|
471
|
+
boxShadow: boxShadow
|
472
|
+
}, navOptions.menuStyle), menu);
|
473
|
+
|
474
|
+
// hide on mouse out
|
475
|
+
hide = function () {
|
476
|
+
css(menu, { display: NONE });
|
477
|
+
};
|
478
|
+
|
479
|
+
addEvent(menu, 'mouseleave', hide);
|
480
|
+
|
481
|
+
|
482
|
+
// create the items
|
483
|
+
each(items, function (item) {
|
484
|
+
if (item) {
|
485
|
+
var div = createElement(DIV, {
|
486
|
+
onmouseover: function () {
|
487
|
+
css(this, navOptions.menuItemHoverStyle);
|
488
|
+
},
|
489
|
+
onmouseout: function () {
|
490
|
+
css(this, menuItemStyle);
|
491
|
+
},
|
492
|
+
innerHTML: item.text || chart.options.lang[item.textKey]
|
493
|
+
}, extend({
|
494
|
+
cursor: 'pointer'
|
495
|
+
}, menuItemStyle), innerMenu);
|
496
|
+
|
497
|
+
div[hasTouch ? 'ontouchstart' : 'onclick'] = function () {
|
498
|
+
hide();
|
499
|
+
item.onclick.apply(chart, arguments);
|
500
|
+
};
|
501
|
+
|
502
|
+
}
|
503
|
+
});
|
504
|
+
|
505
|
+
chart.exportMenuWidth = menu.offsetWidth;
|
506
|
+
chart.exportMenuHeight = menu.offsetHeight;
|
507
|
+
}
|
508
|
+
|
509
|
+
menuStyle = { display: 'block' };
|
510
|
+
|
511
|
+
// if outside right, right align it
|
512
|
+
if (x + chart.exportMenuWidth > chartWidth) {
|
513
|
+
menuStyle.right = (chartWidth - x - width - menuPadding) + PX;
|
514
|
+
} else {
|
515
|
+
menuStyle.left = (x - menuPadding) + PX;
|
516
|
+
}
|
517
|
+
// if outside bottom, bottom align it
|
518
|
+
if (y + height + chart.exportMenuHeight > chartHeight) {
|
519
|
+
menuStyle.bottom = (chartHeight - y - menuPadding) + PX;
|
520
|
+
} else {
|
521
|
+
menuStyle.top = (y + height - menuPadding) + PX;
|
522
|
+
}
|
523
|
+
|
524
|
+
css(menu, menuStyle);
|
525
|
+
},
|
526
|
+
|
527
|
+
/**
|
528
|
+
* Add the export button to the chart
|
529
|
+
*/
|
530
|
+
addButton: function (options) {
|
531
|
+
var chart = this,
|
532
|
+
renderer = chart.renderer,
|
533
|
+
btnOptions = merge(chart.options.navigation.buttonOptions, options),
|
534
|
+
onclick = btnOptions.onclick,
|
535
|
+
menuItems = btnOptions.menuItems,
|
536
|
+
/*position = chart.getAlignment(btnOptions),
|
537
|
+
buttonLeft = position.x,
|
538
|
+
buttonTop = position.y,*/
|
539
|
+
buttonWidth = btnOptions.width,
|
540
|
+
buttonHeight = btnOptions.height,
|
541
|
+
box,
|
542
|
+
symbol,
|
543
|
+
button,
|
544
|
+
borderWidth = btnOptions.borderWidth,
|
545
|
+
boxAttr = {
|
546
|
+
stroke: btnOptions.borderColor
|
547
|
+
|
548
|
+
},
|
549
|
+
symbolAttr = {
|
550
|
+
stroke: btnOptions.symbolStroke,
|
551
|
+
fill: btnOptions.symbolFill
|
552
|
+
};
|
553
|
+
|
554
|
+
if (btnOptions.enabled === false) {
|
555
|
+
return;
|
556
|
+
}
|
557
|
+
|
558
|
+
// element to capture the click
|
559
|
+
function revert() {
|
560
|
+
symbol.attr(symbolAttr);
|
561
|
+
box.attr(boxAttr);
|
562
|
+
}
|
563
|
+
|
564
|
+
// the box border
|
565
|
+
box = renderer.rect(
|
566
|
+
0,
|
567
|
+
0,
|
568
|
+
buttonWidth,
|
569
|
+
buttonHeight,
|
570
|
+
btnOptions.borderRadius,
|
571
|
+
borderWidth
|
572
|
+
)
|
573
|
+
//.translate(buttonLeft, buttonTop) // to allow gradients
|
574
|
+
.align(btnOptions, true)
|
575
|
+
.attr(extend({
|
576
|
+
fill: btnOptions.backgroundColor,
|
577
|
+
'stroke-width': borderWidth,
|
578
|
+
zIndex: 19
|
579
|
+
}, boxAttr)).add();
|
580
|
+
|
581
|
+
// the invisible element to track the clicks
|
582
|
+
button = renderer.rect(
|
583
|
+
0,
|
584
|
+
0,
|
585
|
+
buttonWidth,
|
586
|
+
buttonHeight,
|
587
|
+
0
|
588
|
+
)
|
589
|
+
.align(btnOptions)
|
590
|
+
.attr({
|
591
|
+
id: btnOptions._id,
|
592
|
+
fill: 'rgba(255, 255, 255, 0.001)',
|
593
|
+
title: chart.options.lang[btnOptions._titleKey],
|
594
|
+
zIndex: 21
|
595
|
+
}).css({
|
596
|
+
cursor: 'pointer'
|
597
|
+
})
|
598
|
+
.on('mouseover', function () {
|
599
|
+
symbol.attr({
|
600
|
+
stroke: btnOptions.hoverSymbolStroke,
|
601
|
+
fill: btnOptions.hoverSymbolFill
|
602
|
+
});
|
603
|
+
box.attr({
|
604
|
+
stroke: btnOptions.hoverBorderColor
|
605
|
+
});
|
606
|
+
})
|
607
|
+
.on('mouseout', revert)
|
608
|
+
.on('click', revert)
|
609
|
+
.add();
|
610
|
+
|
611
|
+
//addEvent(button.element, 'click', revert);
|
612
|
+
|
613
|
+
// add the click event
|
614
|
+
if (menuItems) {
|
615
|
+
onclick = function () {
|
616
|
+
revert();
|
617
|
+
var bBox = button.getBBox();
|
618
|
+
chart.contextMenu('export-menu', menuItems, bBox.x, bBox.y, buttonWidth, buttonHeight);
|
619
|
+
};
|
620
|
+
}
|
621
|
+
/*addEvent(button.element, 'click', function() {
|
622
|
+
onclick.apply(chart, arguments);
|
623
|
+
});*/
|
624
|
+
button.on('click', function () {
|
625
|
+
onclick.apply(chart, arguments);
|
626
|
+
});
|
627
|
+
|
628
|
+
// the icon
|
629
|
+
symbol = renderer.symbol(
|
630
|
+
btnOptions.symbol,
|
631
|
+
btnOptions.symbolX,
|
632
|
+
btnOptions.symbolY,
|
633
|
+
(btnOptions.symbolSize || 12) / 2
|
634
|
+
)
|
635
|
+
.align(btnOptions, true)
|
636
|
+
.attr(extend(symbolAttr, {
|
637
|
+
'stroke-width': btnOptions.symbolStrokeWidth || 1,
|
638
|
+
zIndex: 20
|
639
|
+
})).add();
|
640
|
+
|
641
|
+
|
642
|
+
|
643
|
+
}
|
644
|
+
});
|
645
|
+
|
646
|
+
// Create the export icon
|
647
|
+
HC.Renderer.prototype.symbols.exportIcon = function (x, y, radius) {
|
648
|
+
return [
|
649
|
+
M, // the disk
|
650
|
+
x - radius, y + radius,
|
651
|
+
L,
|
652
|
+
x + radius, y + radius,
|
653
|
+
x + radius, y + radius * 0.5,
|
654
|
+
x - radius, y + radius * 0.5,
|
655
|
+
'Z',
|
656
|
+
M, // the arrow
|
657
|
+
x, y + radius * 0.5,
|
658
|
+
L,
|
659
|
+
x - radius * 0.5, y - radius / 3,
|
660
|
+
x - radius / 6, y - radius / 3,
|
661
|
+
x - radius / 6, y - radius,
|
662
|
+
x + radius / 6, y - radius,
|
663
|
+
x + radius / 6, y - radius / 3,
|
664
|
+
x + radius * 0.5, y - radius / 3,
|
665
|
+
'Z'
|
666
|
+
];
|
667
|
+
};
|
668
|
+
// Create the print icon
|
669
|
+
HC.Renderer.prototype.symbols.printIcon = function (x, y, radius) {
|
670
|
+
return [
|
671
|
+
M, // the printer
|
672
|
+
x - radius, y + radius * 0.5,
|
673
|
+
L,
|
674
|
+
x + radius, y + radius * 0.5,
|
675
|
+
x + radius, y - radius / 3,
|
676
|
+
x - radius, y - radius / 3,
|
677
|
+
'Z',
|
678
|
+
M, // the upper sheet
|
679
|
+
x - radius * 0.5, y - radius / 3,
|
680
|
+
L,
|
681
|
+
x - radius * 0.5, y - radius,
|
682
|
+
x + radius * 0.5, y - radius,
|
683
|
+
x + radius * 0.5, y - radius / 3,
|
684
|
+
'Z',
|
685
|
+
M, // the lower sheet
|
686
|
+
x - radius * 0.5, y + radius * 0.5,
|
687
|
+
L,
|
688
|
+
x - radius * 0.75, y + radius,
|
689
|
+
x + radius * 0.75, y + radius,
|
690
|
+
x + radius * 0.5, y + radius * 0.5,
|
691
|
+
'Z'
|
692
|
+
];
|
693
|
+
};
|
694
|
+
|
695
|
+
|
696
|
+
// Add the buttons on chart load
|
697
|
+
Chart.prototype.callbacks.push(function (chart) {
|
698
|
+
var n,
|
699
|
+
exportingOptions = chart.options.exporting,
|
700
|
+
buttons = exportingOptions.buttons;
|
701
|
+
|
702
|
+
if (exportingOptions.enabled !== false) {
|
703
|
+
|
704
|
+
for (n in buttons) {
|
705
|
+
chart.addButton(buttons[n]);
|
706
|
+
}
|
707
|
+
}
|
708
|
+
});
|
709
|
+
|
710
|
+
|
711
|
+
}());
|