Hello 

I am using google API to draw google Piechart using WebMethod. Below is my 
code  for calling Webmethod.

 <script type="text/javascript">
        var result1;
        var data1;
        var i;
        var chart
        google.load('visualization', '1', { packages: ['corechart'] });
        google.setOnLoadCallback(drawChart);
        function drawChart() {
            $.ajax({
                type: "POST",
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                url: "GenderWisePurchaseBehavior.aspx/GenerateReport",
                data: '{}',
                success: function (result) {
                    result1 = eval(result.d);
                    data1 = new 
google.visualization.arrayToDataTable([result1]);
                     chart = new 
google.visualization.PieChart(document.getElementById('chartYearlyGenderWisePurchaseBehavior'));
                    chart.draw(data1);
                }
            });
        } 

Public Shared Function GetGenderWisePurchaseBehaviorScript(ByVal period As 
EnumPeriodType, ByVal periodValue As Integer, ByVal chartname As String) As 
String()

        Dim str As New StringBuilder
        Dim cls As New ClassDashBoard
        Dim offerlist As New List(Of String)
        Dim dt = cls.GetGenderWisePurchaseBehavior(period, periodValue)
        offerlist.Add("['Sex', 'Sale'],")
        Dim index As Integer = 0
        For Each dr As DataRow In dt.Rows
            index = index + 1
            If index = dt.Rows.Count Then
                offerlist.Add("['" & dr("SEX") & "', " & dr("SALE") & "]")
            Else
                offerlist.Add("['" & dr("SEX") & "', " & dr("SALE") & "],")
            End If
        Next

        Return offerlist.ToArray()
    End Function

Problem I am facing is data1 is not being bind to chart rather while 
debugging I found data into it.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-visualization-api/-/igbD_ZT6nVoJ.
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.

Reply via email to