RadChart Data Not Displaying Properly

Thread is closed for posting
2 posts, 0 answers
  1. kim
    kim avatar
    4 posts
    Member since:
    Aug 2011

    Posted 30 Jan 2013 Link to this post

    I have a radchart:
    <telerik:RadChart ID="rcProposedWaiting" runat="server" Width="750px" DataGroupColumn="Name" 
    AutoTextWrap="true" Skin="Hay" ChartTitle-TextBlock-Text="Projects By Department" SeriesOrientation="Horizontal" AutoLayout="true">
    <Legend><Appearance GroupNameFormat="#VALUE"></Appearance></Legend>
    <PlotArea><XAxis DataLabelsColumn="Department"></XAxis></PlotArea>
    </telerik:RadChart>

    I am populating with a DataView:
    public DataView GetProposedWaitingChart()
    {
    List<int> lst = new List<int>();
    lst.Add( (int)ApprovalStatus.Proposed );
    lst.Add( (int)ApprovalStatus.WaitingforApproval );

    string listStatus =  Util.CompressList( lst, "," );

    List<ITProject> projects = _dal.GetProjectByApprovalSatus( listStatus );

    DataTable dt = new DataTable();
    dt.Columns.Add( "Name" );
    dt.Columns.Add( "Department" );
    DataColumn dc = new DataColumn( "Value", Type.GetType( "System.Int32" ) );
    dt.Columns.Add( dc );

    var groupedStatus = from f in projects
    group f by new {
    f.Department,
    f.ApprovalStatus
    } into myGroup
    orderby myGroup.Key.ApprovalStatus, myGroup.Key.Department
    select new { myGroup.Key.Department, myGroup.Key.ApprovalStatus, Count = myGroup.Count() };

    foreach (var obj in groupedStatus) {
    string department = obj.Department;
    string status = obj.ApprovalStatus;
    int count = obj.Count;
    dt.Rows.Add( status, department, count );
    }

    DataView dv = dt.DefaultView;
    dv.Sort = "Name, Department";

    return dv;
    }
    ----------------------------------------------------------------------
    I have verified that my datatable looks correct after the foreach loop...
    ? dt.Rows[0].ItemArray
    {object[3]}
        [0]: "Proposed"
        [1]: "IT"
        [2]: 2
    ? dt.Rows[1].ItemArray
    {object[3]}
        [0]: "Waiting for Approval"
        [1]: "Advisory Services"
        [2]: 1
    ----------------------------------------------------------------------
     but I am getting the attached output (projbad.jpg)... 


    ---------------------------------------------------------------------------------
    If I just add dummy rows to my datatable rather than the database data, it works just fine (projgood.jpg)

    dt.Rows.Add( "Proposed", "IT", 4 );
    dt.Rows.Add( "Waiting", "FA", 4 );
    dt.Rows.Add( "Proposed", "TA", 1 );
    dt.Rows.Add( "Proposed", "FA", 2 );
    dt.Rows.Add( "Waiting", "IT", 3 );
    dt.Rows.Add( "Waiting", "TA", 2 );

    DataView dv = dt.DefaultView;
    dv.Sort = "Name, Department";
    ---------------------------------------------------------------------------------


    Any ideas?  Thanks
  2. kim
    kim avatar
    4 posts
    Member since:
    Aug 2011

    Posted 30 Jan 2013 Link to this post

    After some investigation we realized that the first sequence in the dataset needs to have a value for both groupings... so if IT has 3 proposed projects and no pending projects, it does not display properly. We have to manually add a 0 row for (IT, Pending, 0) as a work around.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top