GoogleChartsExamples.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. smalltalk.addPackage('GoogleChartsExamples', {});
  2. smalltalk.addClass('GaugeChartExample', smalltalk.GaugeChart, [], 'GoogleChartsExamples');
  3. smalltalk.addMethod(
  4. "_makeData",
  5. smalltalk.method({
  6. selector: "makeData",
  7. category: 'not yet classified',
  8. fn: function (){
  9. var self=this;
  10. var $1;
  11. $1=smalltalk.send(self,"_arrayToDataTable_",[[["Label","Value"],["Memory",(80)],["CPU",(55)],["Network",(68)]]]);
  12. return $1;
  13. },
  14. args: [],
  15. source: "makeData\x0a\x22Example Gauge Data\x22\x0a ^ self arrayToDataTable: { {'Label'.'Value'}.\x0a \x09\x09\x09\x09\x09{'Memory' . 80}.\x0a {'CPU' . 55}.\x0a {'Network' . 68}}",
  16. messageSends: ["arrayToDataTable:"],
  17. referencedClasses: []
  18. }),
  19. smalltalk.GaugeChartExample);
  20. smalltalk.addMethod(
  21. "_makeOptions",
  22. smalltalk.method({
  23. selector: "makeOptions",
  24. category: 'not yet classified',
  25. fn: function (){
  26. var self=this;
  27. var $1;
  28. $1={width:400, heigth:120,
  29. redFrom:90,redTo:100,
  30. yellowFrom:75,yellowTo:90,
  31. minorTicks:5};
  32. ;
  33. return $1;
  34. },
  35. args: [],
  36. source: "makeOptions\x0a\x22Example Gauge options\x22\x0a ^<{width:400, heigth:120,\x0a redFrom:90,redTo:100,\x0a yellowFrom:75,yellowTo:90,\x0a minorTicks:5}>",
  37. messageSends: [],
  38. referencedClasses: []
  39. }),
  40. smalltalk.GaugeChartExample);
  41. smalltalk.addClass('GeoChartExample', smalltalk.GeoChart, [], 'GoogleChartsExamples');
  42. smalltalk.addMethod(
  43. "_makeData",
  44. smalltalk.method({
  45. selector: "makeData",
  46. category: 'not yet classified',
  47. fn: function (){
  48. var self=this;
  49. var $1;
  50. $1=smalltalk.send(self,"_arrayToDataTable_",[[["City","Population","Area"],["Rome",(2761477),(1285.31)],["Milan",(1324110),(181.76)],["Naples",(959574),(117.27)],["Turin",(907563),(130.17)],["Palermo",(655875),(158.9)],["Genoa",(607906),(243.6)],["Bologna",(380181),(140.7)],["Florence",(371282),(102.41)],["Fiumicino",(67370),(213.44)],["Anzio",(52192),(43.43)],["Ciampino",(38262),(11)]]]);
  51. return $1;
  52. },
  53. args: [],
  54. source: "makeData\x0a\x22Example Geo Data\x22\x0a ^ self arrayToDataTable: {\x0a{'City'. 'Population' . 'Area'}.\x0a {'Rome'. 2761477 . 1285.31}.\x0a {'Milan'. 1324110 . 181.76}.\x0a {'Naples'. 959574 . 117.27}.\x0a {'Turin'. 907563 . 130.17}.\x0a {'Palermo'. 655875 . 158.9}.\x0a {'Genoa'. 607906 . 243.60}.\x0a {'Bologna'. 380181 . 140.7}.\x0a {'Florence'. 371282 . 102.41}.\x0a {'Fiumicino'. 67370 . 213.44}.\x0a {'Anzio'. 52192 . 43.43}.\x0a {'Ciampino'. 38262 . 11} \x0a }",
  55. messageSends: ["arrayToDataTable:"],
  56. referencedClasses: []
  57. }),
  58. smalltalk.GeoChartExample);
  59. smalltalk.addMethod(
  60. "_makeOptions",
  61. smalltalk.method({
  62. selector: "makeOptions",
  63. category: 'not yet classified',
  64. fn: function (){
  65. var self=this;
  66. var $1;
  67. $1={
  68. region: 'IT',
  69. displayMode: 'markers',
  70. colorAxis: {colors: ['green', 'blue']}
  71. };
  72. ;
  73. return $1;
  74. },
  75. args: [],
  76. source: "makeOptions\x0a\x22Example Geo Options\x22\x0a\x0a ^<{\x0a region: 'IT',\x0a displayMode: 'markers',\x0a colorAxis: {colors: ['green', 'blue']}\x0a }>",
  77. messageSends: [],
  78. referencedClasses: []
  79. }),
  80. smalltalk.GeoChartExample);
  81. smalltalk.addClass('IndexChartApp', smalltalk.ChartApp, [], 'GoogleChartsExamples');
  82. smalltalk.addMethod(
  83. "_begin",
  84. smalltalk.method({
  85. selector: "begin",
  86. category: 'not yet classified',
  87. fn: function (){
  88. var self=this;
  89. var $1,$2,$3;
  90. $1=smalltalk.send((smalltalk.PieChartExample || PieChartExample),"_new",[]);
  91. smalltalk.send($1,"_chartId_",["pie_chart_div"]);
  92. $2=smalltalk.send($1,"_drawChart",[]);
  93. $3=smalltalk.send(self,"_begin",[],smalltalk.ChartApp);
  94. return $3;
  95. },
  96. args: [],
  97. source: "begin\x0a\x09\x22Start the executiong of the ExampleChartApp by connecting each button/graphic pair\x22\x0a PieChartExample new chartId:'pie_chart_div';drawChart.\x0a ^super begin",
  98. messageSends: ["chartId:", "new", "drawChart", "begin"],
  99. referencedClasses: ["PieChartExample"]
  100. }),
  101. smalltalk.IndexChartApp);
  102. smalltalk.addMethod(
  103. "_neededVisualizationPackages",
  104. smalltalk.method({
  105. selector: "neededVisualizationPackages",
  106. category: 'not yet classified',
  107. fn: function (){
  108. var self=this;
  109. var $1;
  110. $1=["corechart"];
  111. return $1;
  112. },
  113. args: [],
  114. source: "neededVisualizationPackages\x0a\x22This App only needs a corechart package.\x22\x0a\x09^{'corechart'}",
  115. messageSends: [],
  116. referencedClasses: []
  117. }),
  118. smalltalk.IndexChartApp.klass);
  119. smalltalk.addClass('PieChartExample', smalltalk.PieChart, [], 'GoogleChartsExamples');
  120. smalltalk.addMethod(
  121. "_makeData",
  122. smalltalk.method({
  123. selector: "makeData",
  124. category: 'not yet classified',
  125. fn: function (){
  126. var self=this;
  127. var $1;
  128. $1=smalltalk.send(self,"_arrayToDataTable_",[[["Task","Hours per Day"],["Work",(11)],["Eat",(2)],["Commute",(2)],["Watch TV",(2)],["Snooze",(7)]]]);
  129. return $1;
  130. },
  131. args: [],
  132. source: "makeData\x0a\x09\x22return a DataTable of example Pie Chart data\x22\x0a\x0a ^ self arrayToDataTable: { {'Task'.'Hours per Day'}.\x0a \x09\x09\x09\x09\x09{'Work' . 11}.\x0a {'Eat'.2}.\x0a {'Commute'.2}.\x0a {'Watch TV'.2}.\x0a {'Snooze'.7}}",
  133. messageSends: ["arrayToDataTable:"],
  134. referencedClasses: []
  135. }),
  136. smalltalk.PieChartExample);
  137. smalltalk.addMethod(
  138. "_makeOptions",
  139. smalltalk.method({
  140. selector: "makeOptions",
  141. category: 'not yet classified',
  142. fn: function (){
  143. var self=this;
  144. var $1;
  145. $1=smalltalk.HashedCollection._fromPairs_([smalltalk.send("title","__minus_gt",["My Daily Activities"])]);
  146. return $1;
  147. },
  148. args: [],
  149. source: "makeOptions\x0a\x09\x22Return a Dictionary of the options in this case only a title\x22\x0a\x09^#{'title' -> 'My Daily Activities'}\x0a",
  150. messageSends: ["->"],
  151. referencedClasses: []
  152. }),
  153. smalltalk.PieChartExample);
  154. smalltalk.addClass('PopupChartApp', smalltalk.ChartApp, [], 'GoogleChartsExamples');
  155. smalltalk.addMethod(
  156. "_begin",
  157. smalltalk.method({
  158. selector: "begin",
  159. category: 'not yet classified',
  160. fn: function (){
  161. var self=this;
  162. var $1;
  163. smalltalk.send((smalltalk.ChartButton || ChartButton),"_popUpChart_atDom_",[smalltalk.send((smalltalk.PieChartExample || PieChartExample),"_chartId_",["pie_chart_div"]),"#popPieChart"]);
  164. smalltalk.send((smalltalk.ChartButton || ChartButton),"_popUpChart_atDom_",[smalltalk.send((smalltalk.ScatterChartExample || ScatterChartExample),"_chartId_",["scatter_chart_div"]),"#popScatterChart"]);
  165. smalltalk.send((smalltalk.ChartButton || ChartButton),"_popUpChart_atDom_",[smalltalk.send((smalltalk.GaugeChartExample || GaugeChartExample),"_chartId_",["gauge_chart_div"]),"#popGaugeChart"]);
  166. smalltalk.send((smalltalk.ChartButton || ChartButton),"_popUpChart_atDom_",[smalltalk.send((smalltalk.GeoChartExample || GeoChartExample),"_chartId_",["geo_markers_chart_div"]),"#popGeoMarkersChart"]);
  167. $1=smalltalk.send(self,"_begin",[],smalltalk.ChartApp);
  168. return $1;
  169. },
  170. args: [],
  171. source: "begin\x0a\x09\x22Start the executiong of the ExampleChartApp by connecting each button/graphic pair\x22\x0a ChartButton popUpChart:(PieChartExample chartId:'pie_chart_div') atDom:'#popPieChart' .\x0a ChartButton popUpChart:(ScatterChartExample chartId:'scatter_chart_div') atDom:'#popScatterChart'.\x0a ChartButton popUpChart:(GaugeChartExample chartId:'gauge_chart_div') atDom:'#popGaugeChart'.\x0a ChartButton popUpChart:(GeoChartExample chartId:'geo_markers_chart_div') atDom: '#popGeoMarkersChart'.\x0a ^super begin",
  172. messageSends: ["popUpChart:atDom:", "chartId:", "begin"],
  173. referencedClasses: ["PieChartExample", "ChartButton", "ScatterChartExample", "GaugeChartExample", "GeoChartExample"]
  174. }),
  175. smalltalk.PopupChartApp);
  176. smalltalk.addMethod(
  177. "_neededVisualizationPackages",
  178. smalltalk.method({
  179. selector: "neededVisualizationPackages",
  180. category: 'not yet classified',
  181. fn: function (){
  182. var self=this;
  183. var $1;
  184. $1=["corechart","gauge","geochart"];
  185. return $1;
  186. },
  187. args: [],
  188. source: "neededVisualizationPackages\x0a\x22This is a hook for subclasses to define which visualization packages to load.\x22\x0a\x09^{'corechart'.'gauge'.'geochart'}",
  189. messageSends: [],
  190. referencedClasses: []
  191. }),
  192. smalltalk.PopupChartApp.klass);
  193. smalltalk.addClass('ScatterChartExample', smalltalk.ScatterChart, [], 'GoogleChartsExamples');
  194. smalltalk.addMethod(
  195. "_makeData",
  196. smalltalk.method({
  197. selector: "makeData",
  198. category: 'not yet classified',
  199. fn: function (){
  200. var self=this;
  201. var $1;
  202. $1=smalltalk.send(self,"_arrayToDataTable_",[[["Age","Weight"],[(8),(11)],[(4),(5.5)],[(11),(14)],[(4),(5)],[(3),(3)],[(6.5),(7)]]]);
  203. return $1;
  204. },
  205. args: [],
  206. source: "makeData\x0a \x22Return the example dataset\x22\x0a ^ self arrayToDataTable: { \x0a \x09\x09\x09\x09\x09\x09\x09{'Age'.'Weight'}.\x0a {8 . 11} . \x0a { 4 . 5.5} . \x0a { 11 . 14 } . \x0a { 4 . 5}. \x0a {3 . 3} . \x0a {6.5 . 7}}\x0a ",
  207. messageSends: ["arrayToDataTable:"],
  208. referencedClasses: []
  209. }),
  210. smalltalk.ScatterChartExample);
  211. smalltalk.addMethod(
  212. "_makeOptions",
  213. smalltalk.method({
  214. selector: "makeOptions",
  215. category: 'not yet classified',
  216. fn: function (){
  217. var self=this;
  218. var $1;
  219. $1={
  220. title: 'Age vs. Weight comparison',
  221. hAxis: {title: 'Age', minValue: 0, maxValue: 15},
  222. vAxis: {title: 'Weight', minValue: 0, maxValue: 15},
  223. legend: 'none'
  224. };
  225. ;
  226. return $1;
  227. },
  228. args: [],
  229. source: "makeOptions\x0a\x22options for example dataset\x22\x0a ^<{\x0a title: 'Age vs. Weight comparison',\x0a hAxis: {title: 'Age', minValue: 0, maxValue: 15},\x0a vAxis: {title: 'Weight', minValue: 0, maxValue: 15},\x0a legend: 'none'\x0a }>",
  230. messageSends: [],
  231. referencedClasses: []
  232. }),
  233. smalltalk.ScatterChartExample);