Permalink
Browse files

[enhance] gcharts: Bar chart added

  • Loading branch information...
1 parent 1ed3bca commit 2323cd68bf19083bd5f046940912b1a99bb20fec Nicolas Glondu committed Nov 21, 2011
Showing with 16 additions and 1 deletion.
  1. +8 −1 plugins/gcharts/gcharts.js
  2. +3 −0 plugins/gcharts/jschecker_gcharts.js
  3. +5 −0 stdlib/tools/gcharts/gcharts.opa
@@ -11,7 +11,6 @@ function genericDynamicLoad(id, pack, str_data, str_opts, gfun) {
google.load("visualization", "1", options);
}
-
##register draw_area_chart : string, string, string -> void
##args(id, str_data, str_opts)
{
@@ -20,6 +19,14 @@ function genericDynamicLoad(id, pack, str_data, str_opts, gfun) {
function(v){return new google.visualization.AreaChart(v)});
}
+##register draw_bar_chart : string, string, string -> void
+##args(id, str_data, str_opts)
+{
+ genericDynamicLoad(
+ id, ["imagebarchart"], str_data, str_opts,
+ function(v){return new google.visualization.ImageBarChart(v)});
+}
+
##register draw_column_chart : string, string, string -> void
##args(id, str_data, str_opts)
{
@@ -19,6 +19,9 @@ google.prototype = {
IntensityMap : {
draw : null
},
+ ImageBarChart : {
+ draw : null
+ },
LineChart : {
draw : null
},
@@ -43,6 +43,7 @@ type json = RPC.Json.json
type GCharts.chart_type =
{ area_chart }
+ / { bar_chart }
/ { column_chart }
/ { combo_chart }
/ { geo_chart }
@@ -281,6 +282,9 @@ GCharts = {{
GCJson.DataTable.data(data)
|> Json.to_string
+ /**
+ * Create a DataTable object from its labels and a (key, value) list
+ */
make_simple(labels:(string,string), data:list((string, int))) =
cols = [
{col_id=Dom.fresh_id() col_type={string} col_label=labels.f1},
@@ -350,6 +354,7 @@ GCharts = {{
draw(t:GCharts.chart_type, id:string, data:GCharts.DataTable.t, options:list(GCharts.option)) =
bsl_fun = match t with
| {area_chart} -> %% gcharts.draw_area_chart %%
+ | {bar_chart} -> %% gcharts.draw_bar_chart %%
| {column_chart} -> %% gcharts.draw_column_chart %%
| {combo_chart} -> %% gcharts.draw_column_chart %%
| {geo_chart} -> %% gcharts.draw_geo_chart %%

0 comments on commit 2323cd6

Please sign in to comment.