GoogleCharts.deploy.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. smalltalk.addPackage('GoogleCharts', {});
  2. smalltalk.addClass('ChartApp', smalltalk.Object, [], 'GoogleCharts');
  3. smalltalk.addMethod(
  4. "_begin",
  5. smalltalk.method({
  6. selector: "begin",
  7. fn: function (){
  8. var self=this;
  9. return self;
  10. }
  11. }),
  12. smalltalk.ChartApp);
  13. smalltalk.addMethod(
  14. "_initialize",
  15. smalltalk.method({
  16. selector: "initialize",
  17. fn: function (){
  18. var self=this;
  19. smalltalk.send(smalltalk.send(self,"_class",[]),"_loadGoogleLoader_",[(function(){
  20. return smalltalk.send(smalltalk.send(self,"_class",[]),"_loadVisualization_",[(function(){
  21. return smalltalk.send(self,"_begin",[]);
  22. })]);
  23. })]);
  24. return self}
  25. }),
  26. smalltalk.ChartApp);
  27. smalltalk.addMethod(
  28. "_loadGoogleLoader_",
  29. smalltalk.method({
  30. selector: "loadGoogleLoader:",
  31. fn: function (callback){
  32. var self=this;
  33. $.ajax({url:"https://www.google.com/jsapi",dataType:"script",success:callback});;
  34. ;
  35. return self}
  36. }),
  37. smalltalk.ChartApp.klass);
  38. smalltalk.addMethod(
  39. "_loadVisualization_",
  40. smalltalk.method({
  41. selector: "loadVisualization:",
  42. fn: function (callback){
  43. var self=this;
  44. var packages;
  45. packages=smalltalk.send(self,"_neededVisualizationPackages",[]);
  46. google.load("visualization","1",{"callback" : callback , "packages":packages});;
  47. ;
  48. return self}
  49. }),
  50. smalltalk.ChartApp.klass);
  51. smalltalk.addMethod(
  52. "_neededVisualizationPackages",
  53. smalltalk.method({
  54. selector: "neededVisualizationPackages",
  55. fn: function (){
  56. var self=this;
  57. var $1;
  58. $1=[];
  59. return $1;
  60. }
  61. }),
  62. smalltalk.ChartApp.klass);
  63. smalltalk.addClass('ChartButton', smalltalk.Object, ['element', 'clickBlock'], 'GoogleCharts');
  64. smalltalk.addMethod(
  65. "_activate",
  66. smalltalk.method({
  67. selector: "activate",
  68. fn: function (){
  69. var self=this;
  70. var button;
  71. button=smalltalk.send(smalltalk.send(self,"_element",[]),"_asJQuery",[]);
  72. smalltalk.send(button,"_click_",[(function(){
  73. return smalltalk.send(smalltalk.send(self,"_clickBlock",[]),"_value",[]);
  74. })]);
  75. return self}
  76. }),
  77. smalltalk.ChartButton);
  78. smalltalk.addMethod(
  79. "_clickBlock",
  80. smalltalk.method({
  81. selector: "clickBlock",
  82. fn: function (){
  83. var self=this;
  84. return self["@clickBlock"];
  85. }
  86. }),
  87. smalltalk.ChartButton);
  88. smalltalk.addMethod(
  89. "_clickBlock_",
  90. smalltalk.method({
  91. selector: "clickBlock:",
  92. fn: function (aBlock){
  93. var self=this;
  94. self["@clickBlock"]=aBlock;
  95. return self}
  96. }),
  97. smalltalk.ChartButton);
  98. smalltalk.addMethod(
  99. "_element",
  100. smalltalk.method({
  101. selector: "element",
  102. fn: function (){
  103. var self=this;
  104. return self["@element"];
  105. }
  106. }),
  107. smalltalk.ChartButton);
  108. smalltalk.addMethod(
  109. "_element_",
  110. smalltalk.method({
  111. selector: "element:",
  112. fn: function (aSymbol){
  113. var self=this;
  114. self["@element"]=aSymbol;
  115. return self}
  116. }),
  117. smalltalk.ChartButton);
  118. smalltalk.addMethod(
  119. "_element_clickBlock_",
  120. smalltalk.method({
  121. selector: "element:clickBlock:",
  122. fn: function (elementSymbol,clickBlock){
  123. var self=this;
  124. var $2,$3,$1;
  125. $2=smalltalk.send(self,"_new",[]);
  126. smalltalk.send($2,"_element_",[elementSymbol]);
  127. smalltalk.send($2,"_clickBlock_",[clickBlock]);
  128. smalltalk.send($2,"_activate",[]);
  129. $3=smalltalk.send($2,"_yourself",[]);
  130. $1=$3;
  131. return $1;
  132. }
  133. }),
  134. smalltalk.ChartButton.klass);
  135. smalltalk.addMethod(
  136. "_popUpChart_atDom_",
  137. smalltalk.method({
  138. selector: "popUpChart:atDom:",
  139. fn: function (chart,element){
  140. var self=this;
  141. var $1;
  142. $1=smalltalk.send(self,"_element_clickBlock_",[element,(function(){
  143. return smalltalk.send(chart,"_drawChart",[]);
  144. })]);
  145. return $1;
  146. }
  147. }),
  148. smalltalk.ChartButton.klass);
  149. smalltalk.addClass('GoogleChart', smalltalk.Object, ['chartId', 'chartType'], 'GoogleCharts');
  150. smalltalk.addMethod(
  151. "_arrayToDataTable_",
  152. smalltalk.method({
  153. selector: "arrayToDataTable:",
  154. fn: function (array){
  155. var self=this;
  156. var $1;
  157. $1=google.visualization.arrayToDataTable(array);
  158. ;
  159. return $1;
  160. }
  161. }),
  162. smalltalk.GoogleChart);
  163. smalltalk.addMethod(
  164. "_chartId",
  165. smalltalk.method({
  166. selector: "chartId",
  167. fn: function (){
  168. var self=this;
  169. return self["@chartId"];
  170. }
  171. }),
  172. smalltalk.GoogleChart);
  173. smalltalk.addMethod(
  174. "_chartId_",
  175. smalltalk.method({
  176. selector: "chartId:",
  177. fn: function (aString){
  178. var self=this;
  179. self["@chartId"]=aString;
  180. return self}
  181. }),
  182. smalltalk.GoogleChart);
  183. smalltalk.addMethod(
  184. "_chartType",
  185. smalltalk.method({
  186. selector: "chartType",
  187. fn: function (){
  188. var self=this;
  189. return self["@chartType"];
  190. }
  191. }),
  192. smalltalk.GoogleChart);
  193. smalltalk.addMethod(
  194. "_chartType_",
  195. smalltalk.method({
  196. selector: "chartType:",
  197. fn: function (aString){
  198. var self=this;
  199. self["@chartType"]=aString;
  200. return self}
  201. }),
  202. smalltalk.GoogleChart);
  203. smalltalk.addMethod(
  204. "_drawChart",
  205. smalltalk.method({
  206. selector: "drawChart",
  207. fn: function (){
  208. var self=this;
  209. var chart;
  210. var data;
  211. var options;
  212. data=smalltalk.send(self,"_makeData",[]);
  213. chart=smalltalk.send(self,"_makeChart_",[smalltalk.send(self,"_chartId",[])]);
  214. options=smalltalk.send(self,"_makeOptions",[]);
  215. chart.draw(data,options);
  216. ;
  217. return self}
  218. }),
  219. smalltalk.GoogleChart);
  220. smalltalk.addMethod(
  221. "_getElementById_",
  222. smalltalk.method({
  223. selector: "getElementById:",
  224. fn: function (id){
  225. var self=this;
  226. var $1;
  227. $1=document.getElementById(id);
  228. ;
  229. return $1;
  230. }
  231. }),
  232. smalltalk.GoogleChart);
  233. smalltalk.addMethod(
  234. "_initialize",
  235. smalltalk.method({
  236. selector: "initialize",
  237. fn: function (){
  238. var self=this;
  239. return self;
  240. }
  241. }),
  242. smalltalk.GoogleChart);
  243. smalltalk.addMethod(
  244. "_makeChart_",
  245. smalltalk.method({
  246. selector: "makeChart:",
  247. fn: function (id){
  248. var self=this;
  249. var $1;
  250. var e;
  251. var t;
  252. e=smalltalk.send(self,"_getElementById_",[id]);
  253. t=smalltalk.send(self,"_chartType",[]);
  254. $1=new google.visualization[t](e);
  255. ;
  256. return $1;
  257. }
  258. }),
  259. smalltalk.GoogleChart);
  260. smalltalk.addMethod(
  261. "_makeData",
  262. smalltalk.method({
  263. selector: "makeData",
  264. fn: function (){
  265. var self=this;
  266. var $1;
  267. $1=smalltalk.send(self,"_subclassresponsibility",[]);
  268. return $1;
  269. }
  270. }),
  271. smalltalk.GoogleChart);
  272. smalltalk.addMethod(
  273. "_makeOptions",
  274. smalltalk.method({
  275. selector: "makeOptions",
  276. fn: function (){
  277. var self=this;
  278. var $1;
  279. $1=smalltalk.send(self,"_subclassresponsibility",[]);
  280. return $1;
  281. }
  282. }),
  283. smalltalk.GoogleChart);
  284. smalltalk.addMethod(
  285. "_chartId_",
  286. smalltalk.method({
  287. selector: "chartId:",
  288. fn: function (aString){
  289. var self=this;
  290. var $2,$3,$1;
  291. $2=smalltalk.send(self,"_new",[]);
  292. smalltalk.send($2,"_chartId_",[aString]);
  293. $3=smalltalk.send($2,"_yourself",[]);
  294. $1=$3;
  295. return $1;
  296. }
  297. }),
  298. smalltalk.GoogleChart.klass);
  299. smalltalk.addClass('GaugeChart', smalltalk.GoogleChart, [], 'GoogleCharts');
  300. smalltalk.addMethod(
  301. "_initialize",
  302. smalltalk.method({
  303. selector: "initialize",
  304. fn: function (){
  305. var self=this;
  306. smalltalk.send(self,"_initialize",[],smalltalk.GoogleChart);
  307. smalltalk.send(self,"_chartType_",["Gauge"]);
  308. return self;
  309. }
  310. }),
  311. smalltalk.GaugeChart);
  312. smalltalk.addClass('GeoChart', smalltalk.GoogleChart, [], 'GoogleCharts');
  313. smalltalk.addMethod(
  314. "_initialize",
  315. smalltalk.method({
  316. selector: "initialize",
  317. fn: function (){
  318. var self=this;
  319. smalltalk.send(self,"_initialize",[],smalltalk.GoogleChart);
  320. smalltalk.send(self,"_chartType_",["GeoChart"]);
  321. return self;
  322. }
  323. }),
  324. smalltalk.GeoChart);
  325. smalltalk.addClass('PieChart', smalltalk.GoogleChart, [], 'GoogleCharts');
  326. smalltalk.addMethod(
  327. "_initialize",
  328. smalltalk.method({
  329. selector: "initialize",
  330. fn: function (){
  331. var self=this;
  332. smalltalk.send(self,"_initialize",[],smalltalk.GoogleChart);
  333. smalltalk.send(self,"_chartType_",["PieChart"]);
  334. return self;
  335. }
  336. }),
  337. smalltalk.PieChart);
  338. smalltalk.addClass('ScatterChart', smalltalk.GoogleChart, [], 'GoogleCharts');
  339. smalltalk.addMethod(
  340. "_initialize",
  341. smalltalk.method({
  342. selector: "initialize",
  343. fn: function (){
  344. var self=this;
  345. smalltalk.send(self,"_initialize",[],smalltalk.GoogleChart);
  346. smalltalk.send(self,"_chartType_",["ScatterChart"]);
  347. return self;
  348. }
  349. }),
  350. smalltalk.ScatterChart);