Dynamic Charts from Comet

65 views
Skip to first unread message

thanos

unread,
Jan 15, 2012, 12:19:26 PM1/15/12
to Nitrogen Project / The Nitrogen Web Framework for Erlang
I would love some pointer on how I could set the values of the
#google_chart element dynamically ideally with comet.
Please excuse my ignorance...


right() -> [
#h2 { text="Line Chart" },
#google_chart {
id=myChart,
title="Line Chart", width=400, height=200, grid_x=25,
grid_y=33,
axes=[
#chart_axis { position=bottom, labels=["First", "Second",
"Third", "Fourth"] },
#chart_axis { position=left, labels=["Good", "Better",
"Best"] }
],
data=[
#chart_data { legend="Data 1", color="FF9900",
line_width=3, line_length=1, blank_length=3,
values=[10, 20, 30, 20, 30, 40, 40, 50, 60]
},
#chart_data { legend="Data 2", color="2768A9",
line_width=5,
values=[20, 50, 70, 90, 70, 40, 10, 1, 8]
}
]
},
.
.
.

wf:comet(fun() -> background_update(myChart, Data) end),
Body.

event(_) -> ok.

background_update(ChartID, Count) ->
timer:sleep(1000),
% Its here I'm lost as
wf:update(ChartID, ????),
wf:flush(),
background_update(ControlID, data:get_more_data()).

Jesse Gumm

unread,
Jan 15, 2012, 7:04:31 PM1/15/12
to nitro...@googlegroups.com

My guess is that you'd have to use wf:replace and simply replace the element.

I haven't done a lot with the google charts so I could be wrong.

--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866
www.sigma-star.com
@jessegumm

--
You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
To post to this group, send email to nitro...@googlegroups.com.
To unsubscribe from this group, send email to nitrogenweb...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nitrogenweb?hl=en.

Reply all
Reply to author
Forward
0 new messages