custom binding

6 posts, 0 answers
  1. Itamar
    Itamar avatar
    31 posts
    Member since:
    Mar 2016

    Posted 25 Jan Link to this post

    Hi Telerik,

    I have a problem with binding data to chart

    my point inculcated date and int 

    but my int can be null

    i don't what to display the point but i what the chart to show the empty space  

     

    code:

    public class DataEntity : NSObject     

    {         

            [Export("Date")]         

           public NSDate Date { get; set; }       

          [Export("Value")]     

        public int? Value { get; set; }       

         public SeriesNames SeriesName { get; set; }  

    }

     

  2. Deyan
    Admin
    Deyan avatar
    2117 posts

    Posted 30 Jan Link to this post

    Hello Itamar,

    Can you please share some more information about the series type you are using?

    Regards,
    Deyan
    Telerik by Progress
    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 Feedback Portal and vote to affect the priority of the items
  3. Itamar
    Itamar avatar
    31 posts
    Member since:
    Mar 2016

    Posted 12 Mar in reply to Deyan Link to this post

     On the chart we build, the x axis is: TKChartNumericAxis and the y TKChartDateTimeAxis
    And I am using the series TKChartLineSeries and TKChartAreaSeries
    public class DataEntity : TKChartDataPoint // NSObject
        {
            public override NSObject DataYValue
            {
                [Export("dataYValue")]
                get
                {
                    return new NSNumber(this.Value);
                }
            }

            public override NSObject DataXValue
            {
                [Export("dataXValue")]
                get
                {
                    return Date;
                }
            }
            public NSDate Date { get; set; }
            public double Value { get; set; }
            public SeriesNames SeriesName { get; set; }
        }

    I need to change the double value to double nullable 
  4. Deyan
    Admin
    Deyan avatar
    2117 posts

    Posted 13 Mar Link to this post

    Hi,

    Thanks for writing back.

    Currently support for EMPTY (nil) values is not implemented. Here's a similar thread on our forums that suggest a way for working around this limitation:

    http://www.telerik.com/forums/dealing-with-nil-value-in-series

    Let us know should you have additional questions.

    Regards,
    Deyan
    Telerik by Progress
    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 Feedback Portal and vote to affect the priority of the items
  5. Itamar
    Itamar avatar
    31 posts
    Member since:
    Mar 2016

    Posted 16 Mar in reply to Deyan Link to this post

    I look on the code sample that you send me
    and be my understanding I need to create new series when every I have null point
    I have a lot of null point in my charts and I don’t think It is a good solution
    And also we working with databinding
    But if it is the only solution then you can send me code example in  xamarin iOS
    Regards Itamar
  6. Deyan
    Admin
    Deyan avatar
    2117 posts

    Posted 21 Mar Link to this post

    Hi Itamar,

    Thanks for writing back.

    Here's a sample snippet which works good on my side:

    public void ReloadChart()
            {
                chart.RemoveAllData ();
     
                Random r = new Random ();
     
                for (int i = 0; i < 1; i++) {
     
                    List<TKChartDataPoint> list = new List<TKChartDataPoint> ();
                    for (int j = 0; j < 80; j++) {
                        list.Add(new TKChartDataPoint(new NSNumber(j+1), j % 7 == 0 ? null : new NSNumber(r.Next()%100)));
                    }
                    chart.BeginUpdates();
                 
                 
                            List<TKChartDataPoint> newSource = new List<TKChartDataPoint>();
                            for (int k = 0; k < list.Count; k++)
                            {
                                TKChartDataPoint dp = list[k];
                                if (dp.DataYValue == null)
                                {
                                    TKChartLineSeries newSeries = new TKChartLineSeries(newSource.ToArray());
                                    chart.AddSeries(newSeries);
                                    newSource = new List<TKChartDataPoint>();
                                }
                                else
                                {
                                    newSource.Add(dp);
                                }
     
                                if (i == list.Count - 1 && newSource.Count > 0)
                                {
                                    TKChartLineSeries lineSeries = new TKChartLineSeries();
                                    chart.AddSeries(lineSeries);
                                }
                            }
             
             
                    chart.EndUpdates();
                }


    Regards,
    Deyan
    Telerik by Progress
    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 Feedback Portal and vote to affect the priority of the items
Back to Top