This is a migrated thread and some comments may be shown as answers.

custom binding

5 Answers 59 Views
Chart - Xamarin.iOS
This is a migrated thread and some comments may be shown as answers.
Itamar
Top achievements
Rank 1
Itamar asked on 25 Jan 2017, 08:50 AM

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; }  

}

 

5 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 30 Jan 2017, 07:42 AM
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
0
Itamar
Top achievements
Rank 1
answered on 12 Mar 2017, 04:46 PM
 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 
0
Deyan
Telerik team
answered on 13 Mar 2017, 08:44 AM
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
0
Itamar
Top achievements
Rank 1
answered on 16 Mar 2017, 10:17 AM
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
0
Deyan
Telerik team
answered on 21 Mar 2017, 09:43 AM
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
Tags
Chart - Xamarin.iOS
Asked by
Itamar
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Itamar
Top achievements
Rank 1
Share this question
or