Hello, 
I get the   "Table has no columns " on get json by *asp.net* for *Google 
chart.*
Could you help me here please ...?  *Thank you all! *I am stuck here. 

Method (1) I test the  Url  *for directly to Json on my iis*  EX:   
http://localhost/candy_json_D3/sampleData.json   => *fail* 
Method (2) I use the  Url  asp.net   public string GetChartData()  =>"Table 
has no columns "
        
          {    return JsonString;
        }

--------------------------------------------------------------------------------------------------------------------------------------------------------

I. sampleData.json
{
  "cols": [
        {"id":"","label":"Topping","pattern":"","type":"string"},
        {"id":"","label":"Slices","pattern":"","type":"number"}
      ],
  "rows": [
        {"c":[{"v":"Mushrooms","f":null},{"v":3,"f":null}]},
        {"c":[{"v":"Onions","f":null},{"v":1,"f":null}]},
        {"c":[{"v":"Olives","f":null},{"v":1,"f":null}]},
        {"c":[{"v":"Zucchini","f":null},{"v":1,"f":null}]},
        {"c":[{"v":"Pepperoni","f":null},{"v":2,"f":null}]}
      ]
}
------------------------------------------------------------------------------------------------------------------------------------
II. <script type="text/javascript">

        // Load the Visualization API and the piechart package.
        google.charts.load('current', { 'packages': ['corechart'] });

        // Set a callback to run when the Google Visualization API is 
loaded.
        google.charts.setOnLoadCallback(drawChart);

      *  function drawChart() {*
            var jsonData = $.ajax({
             *   url: "ColumnChart.aspx/GetChartData",     // how could I 
read it it get the right type here ?*
                dataType: "json",
                data: '{}',
                success: function (response) {
                    drawchart(response.d); // calling method  
                },

                error: function () {
                    alert("*Error loading data! Please try again*.");
                }
                //async: false
            }).responseText;

            // Create our data table out of JSON data loaded from server.
            var data = new google.visualization.DataTable(jsonData);

            // Instantiate and draw our chart, passing in some options.
            var chart = new 
google.visualization.PieChart(document.getElementById('chart_div'));
            chart.draw(data, { width: 400, height: 240 });
        }
    </script>
----------------------------------------------------------------------------------------------------
III. Asp.net 
 public string GetChartData()
        { 
           // Get data from "http://localhost/candy_json_D3/sampleData.json 
"
            return JsonString;
        }


BR
Candy

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/1d2b0c07-92a8-4887-865e-d2b325cf93f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to