Hi,
You can do the followings:
1. create a protected string variable on the desired page CS file
protected string googleJSON;
2. in the Page_Load (or whatever function that populates your data) create a
JSON string in the proper data format needed for the DataTable object.
googleJSON = "{cols: [{id: 'task', label: 'Task', type: 'string'},{id:
'hours', label: 'Hours per Day', type: 'number'}],rows: [{c:[{v: 'Work'},
{v: 11}]},{c:[{v: 'Eat'}, {v: 2}]},{c:[{v: 'Commute'}, {v: 2}]},{c:[{v:
'Watch TV'}, {v:2}]},{c:[{v: 'Sleep'}, {v:7, f:'7.000'}]}]},0.6";
3. use the variable in the ASPX file inside your "drawChart" function
var data = new google.visualization.DataTable(<% = googleJSON %>);
Good luck,
Roni
On Sun, Aug 7, 2011 at 9:54 PM, Dadani <[email protected]> wrote:
> Hello,
> this is probably something very simple, but I'm a little bit confused
> here.
> I make my application in ASP MVC and want to show some data from
> database (or variable in controller) to the chart. It's easy and clear
> for me for hardcoded values, but I don't know how to do in with data
> in DB.
> Would you be so kind and advice me how to do it step by step?
> Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-visualization-api?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.