locked
dotnetcharting problems. terrible help files. RRS feed

  • Question

  • User-676557134 posted

    I am having a hard time with dotnetcharting's stuff... basically, their help is un-followable to me. They show parts of code with no relationships between, part of how a pie chart works if you want it this way... and example aspx pages that do not interlink well... I have been trying to piece together from 3-4 pages, how to build a simple pie chart, based on data from a stored procedure.

    They have a page explaining somewhat, how to connect to a DB, a page with a pie chart,... but their help doesn't make the connection between. So I do not know how to structure a simple DB driven page and show a chart... please help. Here's some code I was trying, maybe someone can make sense of it. I'll paste in two different ways I was trying based on their example aspx pages and help files.

    First way: from their datareader.aspx page example combined with one of their piechart.aspx examples
    ====================
            Chart.Title = "Hours/Department"
            Chart.ChartArea.XAxis.Label.Text = "Customers"
            Chart.TempDirectory = "TempCharts"
            Chart.Series.Name = "Employee Hours"

            Dim myConnection As OleDbConnection
            Dim myCommand As OleDbCommand
            Dim strSQL As String
            Dim connStr As String

            connStr = System.Configuration.ConfigurationManager.ConnectionStrings("ProductionConnectionString").ConnectionString
            connStr = connStr & ";Provider=SQLOLEDB"
            myConnection = New OleDbConnection(connStr)

            strSQL = "GetClosedDepartmentSummary 12347"
            'This number in above SP will be replaced with a control item or querystring value once i get it working right
            myCommand = New OleDbCommand(strSQL, myConnection)
            myConnection.Open()

            Dim myReader As OleDbDataReader = myCommand.ExecuteReader()

            ' set dataReader to data property
            Chart.Series.Data = myReader

            'Cleanup
            myReader.Close()
            myConnection.Close()

            Chart.SeriesCollection.Add()
    ==========================

    SECOND WAY: their 'dataengine' way

             Dim de As New DataEngine()

    Dim connStr as String
    connStr = System.Configuration.ConfigurationManager.ConnectionStrings("ProductionConnectionString").ConnectionString
    connStr = connStr & ";Provider=SQLOLEDB"
                       

    de.ConnectionString = connStr
                  de.StoredProcedure = "GetClosedDepartmentSummary"
                  de.AddParameter("@WorkOrderID", 12347, FieldType.Number)

            'set global properties
                  Chart.Title = "Item sales report"
                 Chart.ChartArea.XAxis.Label.Text = "Customers"
                  Chart.TempDirectory = "TempCharts"
            Chart.Debug = True
           

            'Adding series programatically
                  Chart.Series.Name = "Item sales"
                  Chart.Type = ChartType.Pie 'Horizontal;

                 Dim SC As New SeriesCollection()
                 Dim s As New Series()

                  s.Name = "Series 1"

                  Dim ee As New Element()
                  ee.Name = "Employee"
            e.YValue = -25 + myR.Next(50);
            ee.YValue = myR.Next(50)

                 s.Elements.Add(ee)

                   SC.Add(s)
    =============================??????????????????

     P.S. Are there any other ways to make a simple chart in .NET without going Crystal reports? Or with Crystal reports, but somehow simple? like, no 'viewer' just an image output to include in an aspx page?

    Thanks all. 

    Saturday, October 6, 2007 1:43 PM

All replies