Trouble with series plotting that I don't need...

Thread is closed for posting
2 posts, 0 answers
  1. Jon-Jon Kershaw
    Jon-Jon Kershaw avatar
    49 posts
    Member since:
    Dec 2008

    Posted 28 Jan 2009 Link to this post

    I have a ODBC connection to an informix database that is populating incremental 30 minutes of data.  Here is the aspx and the vb.  Basically I don't need to have all series to show.  I only need the total as the x-axis and y datalabel as starttime.  At the moment they post but I get a huge blank space in the chart I assuming that is the series for the starttime.  I need to have that removed as well as the choices in the datatable.  Thanks in advance.

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> 
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Charting" TagPrefix="cc1" %> 
    <!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></title>  
    </head> 
    <body> 
        <form id="form1" runat="server">  
        <div> 
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
            </telerik:RadScriptManager> 
            <asp:DropDownList ID="DropDownList1" runat="server" Width="89px" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="True">  
                <asp:ListItem>1401</asp:ListItem> 
                <asp:ListItem>1406</asp:ListItem> 
                <asp:ListItem>1426</asp:ListItem> 
                <asp:ListItem>1059</asp:ListItem> 
            </asp:DropDownList> 
            <br /> 
        </div> 
        <telerik:RadChart ID="RadChart1" runat="server" Width="850px">  
            <PlotArea> 
                <EmptySeriesMessage Visible="True">  
                    <Appearance Visible="True">  
                    </Appearance> 
                </EmptySeriesMessage> 
            </PlotArea> 
        </telerik:RadChart> 
        <br /> 
        <telerik:RadGrid ID="RadGrid1" runat="server">  
        </telerik:RadGrid> 
        </form> 
    </body> 
    </html> 
     

    Imports System.IO  
    Imports System.Data.SqlClient  
    Imports System.Collections.Specialized  
    Imports System.Diagnostics  
    Imports System.Web.UI.HtmlControls  
    'Imports Telerik.Windows.Controls.Charting  
    Imports System  
    Imports System.Data  
    Imports System.Configuration  
    Imports System.Collections  
    Imports System.Web  
    Imports System.Web.Security  
    Imports System.Web.UI  
    Imports System.Web.UI.WebControls  
    Imports System.Web.UI.WebControls.WebParts  
    Imports Telerik.Charting  
    Imports Telerik.Web.UI  
    Imports System.Data.Odbc  
    Imports System.Data.OleDb  
     
    Partial Class _Default  
        Inherits System.Web.UI.Page  
     
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load  
            RadChart1.ChartTitle.Visible = False 
     
            RadChart1.Legend.Visible = False 
            If Not Page.IsPostBack Then  
                RadChart1.Visible = False 
            End If  
     
        End Sub  
     
     
        Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged  
     
            Dim i As Integer  
            Dim x As Integer  
            Dim totalacd As Integer  
            Dim str As StringString = String.Empty  
            Dim dte As StringString = String.Empty  
            Dim cmd As OdbcCommand  
            Dim cmd2 As OdbcCommand  
            Dim swhere As String  
            Dim swhere2 As String  
            Dim conn As New OdbcConnection  
            Dim inttotal As Integer  
            Dim average As Integer  
     
            conn.ConnectionString = ("DSN='';uid='';pwd=''")  
            conn.Open()  
     
            swhere = "select * from hsplit where row_date = TODAY - 1 OR row_date = TODAY AND split = " & DropDownList1.SelectedValue.ToString() & ""  
            swhere2 = "SELECT DISTINCT row_date, starttime FROM hsplit WHERE row_date = Today OR row_date = TODAY - 1 ORDER BY row_date DESC, starttime DESC" 
     
            cmd = New OdbcCommand(swhere, conn)  
            cmd2 = New OdbcCommand(swhere2, conn)  
     
            Dim dt As New DataSet1.DataTable1DataTable  
            Dim dt2 As New DataSet1.DataTable2DataTable  
            Dim dt3 As New DataSet1.DataTable3DataTable  
     
            Dim da As OdbcDataAdapter  
            Dim da2 As OdbcDataAdapter  
     
            dt.Clear()  
            dt2.Clear()  
     
            cmd.ExecuteNonQuery()  
            cmd2.ExecuteNonQuery()  
     
            da = New OdbcDataAdapter(cmd)  
            da2 = New OdbcDataAdapter(cmd2)  
     
            da.Fill(dt)  
            da2.Fill(dt2)  
     
            totalacd = 0 
            inttotal = 0 
            average = 0 
     
            For x = 0 To 14  
                For i = 0 To dt.Rows.Count() - 1  
                    Try  
                        If dt2.Rows(x).Item("starttime") <> Nothing Then  
                            Try  
                                If dt.Rows(i).Item("starttime").ToString = dt2.Rows(x).Item("starttime").ToString Then  
                                    totalacdtotalacd = totalacd + dt.Rows(i).Item("acdcalls").ToString  
                                    inttotalinttotal = inttotal + 1  
                                End If  
                                str = dt2.Rows(x).Item("starttime").ToString  
                                dte = dt2.Rows(x).Item("row_date").ToString  
                            Catch ex As Exception  
                                average = 0 
                                str = dt2.Rows(x).Item("starttime").ToString  
                                dte = dt2.Rows(x).Item("row_date").ToString  
                            End Try  
                        End If  
                    Catch ex As Exception  
                        average = 0 
                    End Try  
                Next  
     
                Dim newCustomersRow As DataSet1.DataTable3Row  
                newCustomersRow = dt3.NewDataTable3Row()  
     
                newCustomersRow("row_date") = dte  
                newCustomersRow("starttime") = str  
     
                Try  
                    average = (totalacd / inttotal)  
                Catch ex As Exception  
                    average = 0 
                End Try  
                newCustomersRow("average") = average.ToString  
                newCustomersRow("total") = inttotal.ToString  
                dt3.Rows.Add(newCustomersRow)  
                average = 0 
                totalacd = 0 
                inttotal = 0 
     
            Next  
            RadChart1.PlotArea.XAxis.DataLabelsColumn = dt3.starttimeColumn.ToString()  
     
            RadChart1.Series(0).Type = ChartSeriesType.Line  
            RadChart1.Series(1).Type = ChartSeriesType.Bar  
            RadChart1.Series(0).Visible = False    
            RadChart1.PlotArea.DataTable.Visible = True 
     
            RadChart1.ChartTitle.Visible = False 
            RadChart1.Legend.Visible = False 
            RadChart1.DataSource = dt3 
            RadChart1.DataBind()  
            RadChart1.Visible = True 
     
            RadGrid1.DataSource = dt3 
            RadGrid1.DataBind()  
            RadGrid1.Visible = True 
     
            conn.Close()  
     
        End Sub  
    End Class 
  2. Jon-Jon Kershaw
    Jon-Jon Kershaw avatar
    49 posts
    Member since:
    Dec 2008

    Posted 29 Jan 2009 Link to this post

    nevermind I figured it out.  just had to play around with my datatable where I inserted new customer rows.

    now trying to figure out how to get a string with % to graph correctly. 
Back to Top