my black belt in VB was revoked about five years ago because I stopped attending the continuing education classes.
can you try to debug this by saving a printout of the json and creating an html page with the same javascript and the json hard-coded? if it still doesn't work, I'll be able to debug it. but just for the sake of freestyle, why does "count" appear as the first column of your SQL query, before "type"? if you want a pie chart legend, you need to make sure that the legend/labels column is first. that might be unrelated to the order of columns in the SQL query, but it might not be. (it might not be unrelated.) On Mon, Nov 16, 2009 at 2:26 PM, Deathsurfer <[email protected]> wrote: > 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]<google-visualization-api%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-visualization-api?hl=. > > > -- 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=.
