Data Doesn't Display When AutoRange= false;

5 posts, 0 answers
  1. 5280_Dev
    5280_Dev avatar
    4 posts
    Member since:
    Jul 2010

    Posted 10 Aug 2010 Link to this post

    Hello,

    I have a stacked area chart that I am trying to populate. As far as I can tell via reverse engineering the data structure is totally different than with non-stacked graphs. For example normally I would use this line:
    gdpSeriesMapping.ItemMappings.Add(new ItemMapping("GDP", DataPointMember.YValue));
    and
    RadChart1.ItemsSource = this.Data;
    where this.Data is a class with exposed properties like "GDP"

    According to the samples you instead use a List<int[]> or similiar. Well if this is true then I have to manually define my X Axis min & max values. So using the List<int[]> structure I can get my data to plot if I have AutoRange=true; But if I change it to false and manually define the X Axis (below) the data doesn't show?

    #region Define/Clarify X Axis
                    RadChart1.DefaultView.ChartArea.AxisX.AutoRange = false;
                    RadChart1.DefaultView.ChartArea.AxisX.MinValue=TransDate.ToOADate();
                    RadChart1.DefaultView.ChartArea.AxisX.MaxValue=TransDate.ToOADate();
                    RadChart1.DefaultView.ChartArea.AxisX.Step = 1;
      
                      
                #endregion

    Further I cannot seem to figure out how to filter the stacked area series. Again I would traditionally use a filter like:
    RadChart1.FilterDescriptors.Add(new ChartFilterDescriptor("Country", typeof(string), FilterOperator.IsNotEqualTo, sourceCheckbox.Content));
    but I am unsure how to name the Series member so it can then be found to apply / remove the filter.

    So confirmation of the different data structure for the ItemsSource, manual X Axis missing data problem, and how to filter the stacked area chart series would be greatly appreciated.

    THANK YOU
    JB
  2. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 13 Aug 2010 Link to this post

    Hello JB,

    The Area and StackedArea charts are actually quite similar with the only difference being that the StackedArea series draws it items on top of the previous ones. That is - if the first series' first item is 5 and second series first item is 3, the second series' first item would be positioned at 8. That said, the data used to populate multiple Area series would be valid for StackedArea series too. Still, in order to produce visible stacked areas you would need at least two series.

    The AxisX.AutoRange = false setting -- I can see you set the min and max for the axis with the same value. The axis should define a certain range, so please, reconsider this part of the code. I  have attached a small example, showing StackedAreaSeries with AxisX.AutoRange set to false.


    Best regards,
    Ves
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. 5280_Dev
    5280_Dev avatar
    4 posts
    Member since:
    Jul 2010

    Posted 13 Aug 2010 Link to this post

    Sorry the OP had a typo but the dates are different and the graph displays the X axis correctly. It's the data points that do NOT show when I have AutoRange set to false. I have already tried this:
    #region Define/Clarify X Axis
                    RadChart1.DefaultView.ChartArea.AxisX.AutoRange = false;
                    //in this case for now...all we need to define is the max and min dates for the X Axis
                    //which we will determine via Linq query
                      
                    //Get start and end dates from query
                    var stdate = (from LoanDate in ResultList group LoanDate by LoanDate.TransactionDate into LoanTransDate select new {LoanTransDate = LoanTransDate.Min(t=>t.TransactionDate)}).Distinct().First();
                    var enddate = (from LoanDate in ResultList group LoanDate by LoanDate.TransactionDate into LoanTransDate select new { LoanTransDate = LoanTransDate.Min(t => t.TransactionDate) }).Distinct().Last();
                      
                    //Finally set the values. Sin min & max take double we use OADate as it returns a double value that is the date.
                    RadChart1.DefaultView.ChartArea.AxisX.MinValue = stdate.LoanTransDate.ToOADate();
                    RadChart1.DefaultView.ChartArea.AxisX.MaxValue = enddate.LoanTransDate.ToOADate();
                    RadChart1.DefaultView.ChartArea.AxisX.Step = 1.0;
      
                      
                #endregion

    and this
    #region Define/Clarify X Axis
        RadChart1.DefaultView.ChartArea.AxisX.AutoRange = false;
        //in this case for now...all we need to define is the max and min dates for the X Axis
        //which we will determine via Linq query
          
        //Get start and end dates from query
        var stdate = (from LoanDate in ResultList group LoanDate by LoanDate.TransactionDate into LoanTransDate select new {LoanTransDate = LoanTransDate.Min(t=>t.TransactionDate)}).Distinct().First();
        var enddate = (from LoanDate in ResultList group LoanDate by LoanDate.TransactionDate into LoanTransDate select new { LoanTransDate = LoanTransDate.Min(t => t.TransactionDate) }).Distinct().Last();
        RadChart1.DefaultView.ChartArea.AxisX.AddRange(stdate.LoanTransDate.ToOADate(), enddate.LoanTransDate.ToOADate(), 1);
          
    #endregion

    both of which display the graph X Axis properly but NO data??? See attached image CorrectXAxisRange.jpg attached.

    When I change to AutoRange the data plots but of course the date auto ranges as well. See DataPlots.jpg
    RadChart1.DefaultView.ChartArea.AxisX.AutoRange = true;

    I don't understand what is so different from your sample provided???


    As for the data structure I must not have the knowledge needed to understand what you are trying to tell me. In your sample you provide a hard coded example that populates a class with property1, property2 etc. and property1 matches to series 1, property2 matches 2 series 2 etc. The data plots and all is good.....because it is hard coded to succeed.

    I do not understand how I can create such a class with dynamic data. For example if we had 10 loan offerings I could create a class with 10 property fields...but what happens when we add or remove a loan offering? I have to modify and push code through production? In the attached screen shot (DataStruct.jpg) you'll see my current data structure. Notice the data is organized by TransactionDate and the value of the LoanType property changes. So in the List<T> 0-9 are the loan counts for day 1 for each of the 10 loans.

    Now I am happy to modify the data structure and the WCF service that provides it but it needs to be flexible. For example if the user says (through calendar control) I want to see days 1 - 15 for loans A, B, C I need a single data structure to handle that as well as the user who wants to see data from day 1 - 354 for all loans types we offer. I really feel as though I am misunderstanding or doing something wrong so I apologize for the difficulty I am causing.

    JB
  4. 5280_Dev
    5280_Dev avatar
    4 posts
    Member since:
    Jul 2010

    Posted 17 Aug 2010 Link to this post

    For some reason my third image doesn't attach to previous reply so here it is.
  5. Ves
    Admin
    Ves avatar
    2926 posts

    Posted 18 Aug 2010 Link to this post

    Hi JB,

    The dataplots.jpg makes me think that the DataPoints do not have their XValue property set. Just to confirm that -- can you please update the XAxis.DefaultLabelFormat property to something like "dd-MMM-yyyy", so that the year is entirely visible. If the result is 1899 - 1900, it seems the above suggestion is correct. In that case you will need to populate the XValue property of the DataPoints in RadChart. This is done by adding an appropriate ItemMapping  to the series mapping for the data series. In this case the ItemMapping should have its DataPointMember property set to DataPointMember.XValue. Please, find more details about SeriesMappings and ItemMappings in this help topic.


    Best regards,
    Ves
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top