RadGridView Aggregate Result

2 posts, 0 answers
  1. Ivy
    Ivy avatar
    8 posts
    Member since:
    Oct 2009

    Posted 14 Dec 2009 Link to this post

    I am using the grouping functionality of RadGridVIew.  By dragging columns I was able to get columns' sum - displaying in this format

    Column1 | Total: 89
    Column2 | Total: 50

    Now, what I need is to capture this result and place it in a Dictionary object wherein the key is the column name and the value is the Total count.  How can I capture the result and save it?
  2. Ivy
    Ivy avatar
    8 posts
    Member since:
    Oct 2009

    Posted 17 Dec 2009 Link to this post

    found a solution:

     

    public void BindChart(string aggregateFunction, GroupDescriptorCollection gridGroupDescriptors, object gridItemsSource, string[] dataSets)

     

    {

    RadChart1.DefaultView.ChartArea.AdditionalYAxes.Clear();

    RadChart1.ItemsSource = Translate(gridItemsSource);

    RadChart1.SeriesMappings.Clear();

     

    ChartAggregateFunction aggFunct = (ChartAggregateFunction)Enum.Parse(typeof(ChartAggregateFunction), aggregateFunction, true);

     

     

    foreach (string dataSet in dataSets)

     

    {

     

    SeriesMapping mapping = new SeriesMapping();

     

    mapping.ItemMappings.Clear();

    mapping.ItemMappings.Add(

    new ItemMapping(dataSet, DataPointMember.YValue, aggFunct));

     

     

    mapping.SeriesDefinition =

    new BarSeriesDefinition();

     

    #region

     

    Assign Axis Y

     

     

    //if (RadChart1.SeriesMappings.Count > 1)

     

     

    //{

     

     

    // RadChart1.DefaultView.ChartArea.AdditionalYAxes.Add(GenerateYAxis(dataSet));

     

     

    // mapping.SeriesDefinition.AxisName = dataSet;

     

     

    //}

     

    #endregion

     

    ChartGroupDescriptorCollection chartGroupDescriptors = new ChartGroupDescriptorCollection();

     

     

    foreach (GroupDescriptor descriptor in gridGroupDescriptors)

     

    mapping.GroupingSettings.GroupDescriptors.Add(

    new ChartGroupDescriptor(descriptor.Member, descriptor.MemberType));

     

     

    GroupDescriptor lastGroupDescriptor;

     

     

    if (gridGroupDescriptors.Count > 0 && aggregateFunction.ToLower() != "none")

     

    {

    lastGroupDescriptor = gridGroupDescriptors[gridGroupDescriptors.Count - 1];

    mapping.ItemMappings.Add(

    new ItemMapping(lastGroupDescriptor.Member, DataPointMember.XCategory));

     

    }

    RadChart1.SeriesMappings.Add(mapping);

    }

    }

Back to Top