Issue With DataGroupColumn

Thread is closed for posting
3 posts, 0 answers
  1. Ashim
    Ashim avatar
    17 posts
    Member since:
    Nov 2010

    Posted 05 Aug 2011 Link to this post

    i have allot of Charts in My Dashboard and all of them are working fine some with DataGroupColumn  and some without

    but i have problem with one of them,  i have { DDate , MOVE , Count } as data

    DataGroupColumn = "MOVE" and DataLabelsColumn = "DDate"
    The problem is Chart puts data's with different DDate in Same Column. (chart.jpg is attched)

                e.Result = from MMove in dvMoveInOut._Ds.Tables[0].AsEnumerable()
                          where (MMove.Field<DateTime>("DDATE") > NOW.AddDays(-15))
                           orderby MMove.Field<string>("INOUT")
                          select new
                          {
                              DDate = MMove.Field<DateTime>("DDATE").ToString("M/d"),
                              MOVE = (MMove.Field<string>("INOUT") =="I") ? ("In") : ("Out")  ,
                              Count = ((MMove.Field<string>("INOUT") == "I") ? (MMove.Field<int>("CCOUNT")) : (-1 * MMove.Field<int>("CCOUNT")))
    };
    { DDate = "8/5", MOVE = "In", Count = 1 }
    { DDate = "8/3", MOVE = "In", Count = 1 }
    { DDate = "8/1", MOVE = "In", Count = 1 }
    { DDate = "7/31", MOVE = "In", Count = 1 }
    { DDate = "7/31", MOVE = "Out", Count = -1 }
    { DDate = "7/30", MOVE = "In", Count = 2 }
    { DDate = "7/25", MOVE = "In", Count = 1 }
    { DDate = "7/25", MOVE = "Out", Count = -1 }
    { DDate = "7/24", MOVE = "In", Count = 1 }
    { DDate = "7/23", MOVE = "In", Count = 1 }
    { DDate = "7/23", MOVE = "Out", Count = -1 }
    { DDate = "7/22", MOVE = "In", Count = 1 }
    { DDate = "8/4", MOVE = "Out", Count = -1 }







       
  2. Evgenia
    Admin
    Evgenia avatar
    1407 posts

    Posted 10 Aug 2011 Link to this post

    Hello Ashim,

    Have in mind that when grouping is applied for series, the XValue of each SeriesItem will be respected (if no XValue is set -- the items will be added consecutively). Setting DataLabelsColumn property to the XAxis provides labels for each of the XAxis Items but that has nothing in common with their XValue-s. Take a look at the following code snippet that demonstrates how to achieve your scenario:

    DataTable tbl = new DataTable();
           DataColumn col = new DataColumn("totalFaxes");
           col.DataType = typeof(int);
           tbl.Columns.Add(col);
           col = new DataColumn("facilityName");
           col.DataType = typeof(string);
           tbl.Columns.Add(col);
           col = new DataColumn("Hour");
           col.DataType = typeof(double);
           tbl.Columns.Add(col);
           tbl.Rows.Add(new object[] { 100, "Fac1", 1 });
           tbl.Rows.Add(new object[] { 20, "Fac1", 2 });
           tbl.Rows.Add(new object[] { 20, "Fac1", 4 });
           tbl.Rows.Add(new object[] { 20, "Fac1", 5 });
           tbl.Rows.Add(new object[] { 35, "Fac2", 2 });
           tbl.Rows.Add(new object[] { 35, "Fac2", 3 });
           tbl.Rows.Add(new object[] { 35, "Fac2", 4 });
           RadChart1.DataManager.ValuesYColumns = new string[1] { "totalFaxes" };
           RadChart1.DataManager.ValuesXColumn = "Hour";
           RadChart1.DataGroupColumn = "facilityName";
           RadChart1.DefaultType = ChartSeriesType.StackedBar;
           RadChart1.DataSource = tbl;
           RadChart1.DataBind();
           RadChart1.PlotArea.XAxis.AutoScale = false;
           RadChart1.PlotArea.XAxis.AddRange(1, 5, 1);
           string[] labels = new string[] { "Toyota", "Mazda", "Mini", "Opel", "Renault"};
           for (int i = 0; i < RadChart1.PlotArea.XAxis.Items.Count; i++)
           {
               RadChart1.PlotArea.XAxis.Items[i].TextBlock.Text = labels[i];
           }
     
    The ValuesXColumn  predefines the XValue of each SeriesItem. Also after the Chart is databound there are new custom labels set for each of the Axis Items.

    Greetings,
    Evgenia
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Ashim
    Ashim avatar
    17 posts
    Member since:
    Nov 2010

    Posted 11 Aug 2011 Link to this post

    Thanks, it is working fine

Back to Top