Help:Problem with line graph

Feb 15, 2013 at 2:07 AM
Edited Feb 15, 2013 at 2:08 AM
Hello everyone I'm from Peru, I have searched a lot on the forums but have not given me the solution.

Supposedly everything is fine in my code to generate a line graph but does not generate the chart.

I leave my code to see if help me please, something must be wrong.

Thank you very much.
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>HIGHCHARTS</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script src="http://code.highcharts.com/highcharts.js" type="text/javascript"></script>
    <script src="https://raw.github.com/douglascrockford/JSON-js/master/json2.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var options = {
                chart: {
                    renderTo: 'container',
                    defaultSeriesType: 'line'
                },
                title: {},
                xAxis: {},
                yAxis: {},
                series: []
            };

            $.ajax({
                type: "POST",
                dataType: "json",
                data: "{}",
                contentType: "application/json; charset=utf-8",
                url: "WebForm1.aspx/getData",
                success: function (items) {

                    var obj = eval(items.d);

                    var series2 = { data: [] };

                    $.each(obj, function (index, value) {

                        series2.data.push(parseFloat(value));

                    });

                    options.series.push(series2);
                  
                },
                cache: false,
                error: function (XMLHttpRequest, textStatus, errorThrown) { alert(errorThrown); }
            });

            chart = new Highcharts.Chart(options);
        });
    </script>
</head>
<body>
    
    <div id="container" style="width: 800px; height: 400px; margin: 0 auto">
    
    </div>
  
</body>
</html>
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Web.Services
Imports Newtonsoft.Json
Class WebForm1
    Inherits System.Web.UI.Page

    <WebMethod(EnableSession:=True)> _
    Public Shared Function getData() As String

        Dim cn As New SqlConnection("Data source=.;initial catalog=Prueba;uid=sa;pwd=.")
        Dim cmd As New SqlCommand("select * from data", cn)
        cn.Open()
        Dim dr As SqlDataReader
        dr = cmd.ExecuteReader

        Dim data As List(Of ArrayList) = New List(Of ArrayList)

        While dr.Read
            Dim a As New ArrayList
            a.Add(dr(0))
            data.Add(a)
        End While


        Dim str As String = JsonConvert.SerializeObject(data)

        Return str
__//RETURN [[15.00],[42.00],[100.00],[18.00],[16.00],[13.00],[18.00],[57.00],[90.00],[95.00],[96.00],[120.00]]__
    End Function
End Class