Shaw003 / core-plot

Automatically exported from code.google.com/p/core-plot
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Core Plot will not compile in Xamarin #617

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The following will not compile in latest release of Xamarin iOS. Errors at end 
of listing. 

public class PieSourceData : CPTPieChartDataSource
    {
        List<CPTColor> colors = new List<CPTColor> { CPTColor.WhiteColor, CPTColor.RedColor, CPTColor.GreenColor };
        static CPTMutableTextStyle whiteText;
        List<float> data;

        public PieSourceData (List<float> yValues)
        {
            if (whiteText == null) {
                whiteText = new CPTMutableTextStyle ();
                whiteText.Color = CPTColor.WhiteColor;
            }

            data = yValues;
        }

        public override int NumberOfRecordsForPlot (CPTPlot plot)
        {
            return data.Count;
        }

        public override NSNumber NumberForPlot (CPTPlot plot, CPTPlotField forFieldEnum, int index)
        {
            if (forFieldEnum == CPTPlotField.PieChartWidth)
                return data [index];
            return index;
        }

        public override CPTLayer DataLabelForPlot (CPTPlot plot, int recordIndex)
        {
            string text = ""; //"Pie" + recordIndex;
            return new CPTTextLayer (text, whiteText);
        }

        public override CPTFill GetSliceFill (CPTPieChart pieChart, int recordIndex)
        {
            return new CPTFill (colors[recordIndex]);
        }
    }

/Users/rickgross/Projects/PicturePlannerHD/PicturePlannerHD/Classes/PieSourceDat
a.cs(28,28): Error CS0115: 
`PicturePlannerHD.PieSourceData.NumberForPlot(CorePlot.CPTPlot, 
CorePlot.CPTPlotField, int)' is marked as an override but no suitable method 
found to override (CS0115) (PicturePlannerHD)

/Users/rickgross/Projects/PicturePlannerHD/PicturePlannerHD/Classes/PieSourceDat
a.cs(28,28): Error CS0115: 
`PicturePlannerHD.PieSourceData.DataLabelForPlot(CorePlot.CPTPlot, int)' is 
marked as an override but no suitable method found to override (CS0115) 
(PicturePlannerHD)

/Users/rickgross/Projects/PicturePlannerHD/PicturePlannerHD/Classes/PieSourceDat
a.cs(27,27): Error CS0115: 
`PicturePlannerHD.PieSourceData.GetSliceFill(CorePlot.CPTPieChart, int)' is 
marked as an override but no suitable method found to override (CS0115) 
(PicturePlannerHD)

Original issue reported on code.google.com by ric...@gmail.com on 7 Oct 2014 at 4:41

GoogleCodeExporter commented 8 years ago
The Core Plot issue tracker moved to GitHub with the code.

https://github.com/core-plot/core-plot/issues

Clearly, your datasource method definitions don't match the version of Core 
Plot you're working with, but I don't have access to Xamarin in order to help 
troubleshoot. Up-to-date iOS Objective-C API docs are here: 
http://core-plot.github.io/iOS/index.html

Original comment by eskr...@mac.com on 7 Oct 2014 at 11:30

GoogleCodeExporter commented 8 years ago
Clearly - Oh, sorry for disturbing you. I was under the impression that you 
supported the Xamarin component which is failing to compile. I have updated to 
the latest version of the component, what else am I supposed to do?

Original comment by ric...@gmail.com on 8 Oct 2014 at 4:05

GoogleCodeExporter commented 8 years ago
Figure out what the correct method signatures should be. If your IDE (Visual 
Studio?) can't help, find some documentation that tells you how the Objective-C 
API was translated into C#.

I don't know how the Xamarin interface works, but in Objective-C, those methods 
are defined in a protocol, not as overrides of definitions in the superclass.

Original comment by eskr...@mac.com on 9 Oct 2014 at 1:21