Hi,
A while ago we implemented a dynamic stacked data source helper (with your help).
Yesterday we updated our code to 14.1 and the code stopped working because IGStackedSeriesDataSource no longer has GetPoint and UpdatePointAtIndex methods.
It's ridiculous that new version changes are not backward compatible and break the signature of the code.
Please advice on how to fix this. The code for our dynamic stacked data source class is shown below. Worked perfectly until this update.
public class DynamicStackFragment : IGStackedFragmentSeries { public int Index { get; set; } } public class DynamicStackedDataSource : IGStackedSeriesDataSource { //This structure is the array of custom objects, from which the fragments will be extracted. [Export ("Data")] NSObject[] Data { get; set; } //Determines the property name of the items in the data array to be used for labels. [Export ("LabelPath")] string LabelPath { get; set; } //Determines the property name of the items in the data array to be used for stack values. [Export ("ValuesPath")] string ValuesPath { get; set; } public DynamicStackedDataSource () { } public DynamicStackedDataSource (NSObject[] data, string labelPath, string valuesPath) { Data = data; LabelPath = labelPath; ValuesPath = valuesPath; } public override int NumberOfFragments (IGStackedSeriesBase series) { return this.Data.Length; } public override int NumberOfPointsInFragment (IGStackedFragmentSeries fragment, IGStackedSeriesBase series) { DynamicStackFragment df = fragment as DynamicStackFragment; DataModel model = this.Data [df.Index] as DataModel; return (int)model.Points.Count; } public override IGStackedFragmentSeries GetFragment (IGStackedSeriesBase series, int index) { DynamicStackFragment fragment = new DynamicStackFragment (); DataModel item = (DataModel)this.Data [index]; fragment.Name = item.Name; fragment.Title = item.Title; fragment.ValueProperty = item.Title; fragment.Index = index; return fragment; } //FIX IT public IGCategoryPoint GetPoint (IGStackedSeriesBase series, int index, IGStackedFragmentSeries fragment) { //NSString label; DynamicStackFragment df = fragment as DynamicStackFragment; DataModel item = (DataModel)Data [df.Index]; DatePoint datepoint = item.Points.GetItem<DatePoint> (index); IGCategoryPoint point = new IGCategoryPoint (datepoint.Value.DoubleValue, datepoint.Date.ToString ("MMM-yy")); return point; } //FIX IT public IGCategoryPoint UpdatePointAtIndex (IGStackedSeriesBase series, int index, IGStackedFragmentSeries fragment) { IGCategoryPoint newPoint = GetPoint (series, index, fragment); NSObject sourceItem = new NSObject (series.DataPoints.ValueAt ((uint)index)); if (sourceItem != null && sourceItem.GetType () == typeof(NSDictionary)) { NSNumber value = new NSNumber (newPoint.Value); string label = newPoint.Label; sourceItem.SetValueForKey (value, new NSString (fragment.ValueProperty)); sourceItem.SetValueForKey (new NSString (label), new NSString ("label")); } return newPoint; } }
None of the IGStackedSeriesDataSource api has actually changed between versions. My first guess would be that the Xamarin bindings are somehow broken, but I'm looking through different versions of IGChart.dll and both GetPoint and UpdatePointAtIndex are there in Assembly Browser and I am able to call into those methods through code. Can you verify that those methods don't show up in the assembly browser? Any idea what the chart's dll version is installed?
That is actually not true. You are right that the methods are there ( I found them) but you guys have changed the return data type of the methods to iDataPoint instead of ICategoryDataPoint. While I understand the desire to make this more generic introducing API changes that break you customer's code is a bad practice.
Ah, you are correct. We had to change the return type to support date-based data points in the May SR, I believe. Sorry about that, it slipped through without getting documented.