You may need to explicitly set the content type on the Response
Response.ContentType = "text/plain";
Response.Charset = "UTF-8";
On Jul 20, 12:14 am, gtgeek <[email protected]> wrote:
> ok, so bacially after my research i've decided to implement my own
> data source using asp.net as VizBoy suggested option
> 2:http://groups.google.com/group/google-visualization-api/browse_thread...
>
> trying to
> mimic:http://spreadsheets.google.com/tq?key=pCQbetd-CptGXxxQIG7VFIQ&range=B...
>
> which should
> feed:http://code.google.com/apis/ajax/playground/?type=visualization#inten...
>
> I created a single file asp.net file myds.aspx it will take in ?
> tqx=out:json;reqId:1234 etc.
> It is a single accept any parameter, but will process as the
> documented:http://code.google.com/apis/visualization/documentation/dev/implement...
>
> It does return a json string as text but the example doesn't seem to
> accept it.
>
> please take a look and let me know if i am missing something
>
> <%@ Page Language="VB" %>
> <script runat="server">
> Dim reqId as string
> Dim version as string
> Dim responseHandler as string
> Dim outFileName as string
> Dim out as string
> Dim sig as string
> Dim status as string
> Dim warnings as string
> Dim errors as string
> Dim table as string
>
> Private Sub Page_Load(ByVal sender As Object, ByVal e As
> System.EventArgs)
> ParseTQX
> PerformQuery
> SendResponse(reqId, version, responseHandler, out, outFileName,
> status, warnings, errors, table)
> End Sub
>
> Private Sub PerformQuery()
> status = "ok"
> sig = "1068688546"
> version = "0.6"
> table = "{cols:[{id:'B',label:'Country
> code',type:'string',pattern:''},
> {id:'C',label:'Population',type:'number',pattern:'#0.###############'},
> {id:'D',label:'Population
> Density',type:'number',pattern:'#0.###############'}],rows:[{c:
> [{v:'CN'},{v:1.32297E9,f:'1322970000'},{v:137.0,f:'137'}]},{c:
> [{v:'IN'},{v:1.13013E9,f:'1130130000'},{v:336.0,f:'336'}]},{c:
> [{v:'US'},{v:3.03605941E8,f:'303605941'},{v:31.0,f:'31'}]},{c:
> [{v:'ID'},{v:2.31627E8,f:'231627000'},{v:117.0,f:'117'}]},{c:[{v:'BR'},
> {v:1.86315468E8,f:'186315468'},{v:22.0,f:'22'}]},{c:[{v:'PK'},{v:
> 1.626525E8,f:'162652500'},{v:198.0,f:'198'}]},{c:[{v:'BD'},{v:
> 1.58665E8,f:'158665000'},{v:1045.0,f:'1045'}]},{c:[{v:'NG'},{v:
> 1.48093E8,f:'148093000'},{v:142.0,f:'142'}]},{c:[{v:'RU'},{v:
> 1.41933955E8,f:'141933955'},{v:8.4,f:'8.4'}]},{c:[{v:'JP'},{v:
> 1.2779E8,f:'127790000'},{v:339.0,f:'339'}]}]}"
> End Sub
>
> Private Sub SendResponse(reqId as string, version as string,
> responseHandler as string, out as string, outFileName as string,
> status as string, warnings as string, errors as string, table as
> string)
> Dim sReturn as string
>
> If responseHandler <> "" Then
> sReturn = responseHandler + "({"
> Else
> sReturn = "google.visualization.Query.setResponse({"
> End If
> If version <> "" Then
> sReturn += "version:'"+version+"',"
> End If
> If reqId <> "" Then
> sReturn += "reqId:'"+reqId+"',"
> End If
> If status <> "" Then
> sReturn += "status:'"+status+"',"
> End If
> If status = "warning" Then
> sReturn += "warnings:'"+warnings+"',"
> End If
> If status = "error" Then
> sReturn += "errors:'"+errors+"',"
> End If
> If sig <> "" Then
> sReturn += "sig:'"+sig+"',"
> End If
> If table <> "" Then
> sReturn += "table:"+table
> End If
>
> sReturn += "});"
>
> Response.Clear()
> Response.Write(sReturn)
> Response.Flush()
> Response.Close()
> Response.End()
> End Sub
>
> Private Sub ParseTQX()
> Dim tqx as string()
> Dim name as string
> Dim value as string
> tqx = Request.QueryString("tqx").tostring.split(";")
> For Each item as string in tqx
> name = item.split(":")(0)
> value = item.split(":")(1)
> Select Case name
> Case "reqId"
> reqId = value
> Case "version"
> version = value
> Case "sig"
> sig = value
> Case "responseHandler"
> responseHandler = value
> Case "out"
> out = value
> Case "outFileName"
> outFileName = value
> End Select
> Next
> End Sub
> </script>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---