Hi everybody !
In ASP.NET i'm doing this to have my datatable : Private Function
GetData() As DataTable
Dim idPtypeCondition As String = ""
Dim idCountryCondition As String = ""
Dim StrCmd As String = ""
'Country Condition
If ddCountry.SelectedValue <> 0 Then
idCountryCondition = " AND idCountry = " &
ddCountry.SelectedValue & " "
ddType.Enabled = True
End If
'PropertyType Condition
If ddType.SelectedValue = 0 Then
idPtypeCondition = " AND (P.idPType = 1 OR P.idPType = 2
OR P.idPType = 3 OR P.idPType = 4 OR P.idPType = 36 OR P.idPType =
38 )"
Else
idPtypeCondition = " AND P.idPType = " &
ddType.SelectedValue & " "
End If
Dim Request As String = "SELECT COUNT(P.idList) as BedRoom,
PT.PTypeName as Type, BL.TotalRooms as TotalRoom " & _
"From Property as P, PropertyType as PT, BedroomList as BL " &
_
"WHERE PT.idPType = P.idPType " & _
"AND P.idList = BL.idList " & _
"AND idPropMarket = 2 " & _
"AND idCRule = 1 " & _
"AND BL.TotalRooms > 0 " & idCountryCondition &
idPtypeCondition & _
"GROUP BY PT.PTypeName, BL.TotalRooms "
Dim objConn As SqlConnection = openDBConnection()
Dim objCmd As SqlCommand = New SqlCommand(Request, objConn)
'Force the connection to be closed
objConn.Close()
objConn.Open()
Dim reader As SqlDataReader = objCmd.ExecuteReader
(CommandBehavior.CloseConnection)
Dim DataT As New DataTable
DataT.Load(reader)
Return DataT
End Function
Then, i'm doing this to have my Google.dataTable :
Dim gdt As New Bortosky.Google.Visualization.GoogleDataTable
(Me.GetData)
Using mem As New System.IO.MemoryStream()
gdt.WriteJson(mem)
mem.Position = 0
Dim sr As New System.IO.StreamReader(mem)
Page.ClientScript.RegisterStartupScript(Me.[GetType]
(), "vis", String.Format("var fundata = {0}", sr.ReadToEnd()), True)
sr.Close()
End Using
Dim Ams_header As Web.UI.HtmlControls.HtmlHead
Ams_header = TryCast(Me.Page.Header,
Web.UI.HtmlControls.HtmlHead)
Ams_header.InnerHtml = "<title>MarketContext Report</
title> " & _
"<script type='text/javascript' src='http://www.google.com/
jsapi'></script> " & _
"<script type='text/javascript'> " & _
"google.load('visualization', '1', { 'packages':
['piechart'] }); " & _
" google.setOnLoadCallback(drawChart); " & _
"function drawChart() { " & _
" var data = new google.visualization.DataTable
(fundata, 0.5); " & _
" var chart = new google.visualization.PieChart
(document.getElementById('chart_div')); " & _
" chart.draw(data, { width: 400, height: 240, is3D:
true, title: 'Test' }); " & _
" }</script>"
It works well, but i don't have the legend !! What can i do ?
Thanks a lot !
--
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=.