26 ratings
  • 1
  • 2
  • 3
  • 4
  • 5
5 star 5
4 star 3
3 star 10
2 star 6
1 star 2
Compatible with
  • iOS

Core Plot 1.5.1.2

Drew McCormack

Create stunning, interactive, high-performance graphs for iOS.

Core Plot is a plotting framework for OS X and iOS that allows you to create

simple or complex graphs quickly and easily. Core Plot is tightly integrated with Apple technologies like Core Animation, Core Data, and Cocoa Bindings.

Here's an example of creating a simple graph with an XY scatter plot:

using CorePlot;
using System.Drawing;
using MonoTouch.CoreGraphics;
...
public override void ViewDidLoad ()
{
    base.ViewDidLoad ();

    var linear = CPTScaleType.Linear;
    var graph = new CPTXYGraph (View.Frame, linear, linear) {
        Title = "App Sales",
        BackgroundColor = new CGColor (0.982f, 0.988f, 0.890f)
    };

    graph.AddPlot (new CPTScatterPlot { DataSource = new MyDataSource () });
    graph.DefaultPlotSpace.Scale (0.1f, PointF.Empty);

    View.AddSubview (new CPTGraphHostingView (View.Frame) {
        HostedGraph = graph
    });
}

// A simple data source for the plot
class MyDataSource : CPTScatterPlotDataSource
{
    static float [] Sales = { 0, 1, 1, 1, 3, 6, 4, 5, 8, 12 };

    public override int NumberOfRecordsForPlot (CPTPlot plot)
    {
        return Sales.Length;
    }

    public override NSNumber NumberForPlot (CPTPlot plot, CPTPlotField field, int index)
    {
        return field == CPTPlotField.ScatterPlotFieldX ? index : Sales [index];
    }
}

Some component screenshots assembled with PlaceIt.

Release Notes

Version 1.5.1.2

Xamarin.iOS Unified support updated.

Version 1.5.1.1

Adding Xamarin.iOS Unified API Support.

Version 1.5.1

This release adds new animation options, user interaction for annotations and plot areas, and new customization options for legends, range plots, and axis titles. It also added plot space properties to permit more fine-grained control of momentum scrolling.

Write a Review

10 reviews

Nemanja Jevremovic rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

What is a purpose of component with no documentation? I spent 2 days trying to decode all objective C threads all over the internet to achieve simple thing with this component. Very powerful component, but for C# guys not useful at all.

Posted on: April 8, 2016 / Version: 1.5.1.2
Neal Culiner rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

Can someone push the latest to NuGet please? Thanks.

Posted on: May 14, 2015 / Version: 1.5.1.2
peter lin rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

System.Exception: Failed to marshal the Objective-C object 0x174152bc0 (type: CPTXYPlotSpace). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'CorePlot.CPTXYPlotSpace' does not have a constructor that takes one IntPtr argument).

at ObjCRuntime.Runtime.MissingCtor (IntPtr ptr, IntPtr klass, System.Type type, MissingCtorResolution resolution) [0x00046] in /Developer/MonoTouch/Source/maccore/src/ObjCRuntime/Runtime.iOS.cs:392 at ObjCRuntime.Runtime.ConstructNSObjectCPTPlotSpace [0x00000] in :0 at ObjCRuntime.Runtime.GetNSObjectCPTPlotSpace [0x00000] in :0 at CorePlot.CPTGraph.get_DefaultPlotSpace () [0x00000] in :0 at RideSync.CorePlotTest.ViewDidLoad () [0x0006b] in /Users/testtest/Desktop/Debug_Project/Debug_Project/CorePlotTest.cs:39 at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:62 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0001c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:45 at RideSync.Application.Main (System.String[] args) [0x00009] in /Users/testtest/Desktop/Debug_Project/Debug_Project/Main.cs:19 Thread finished: #12

Posted on: March 11, 2015 / Version: 1.5.1.2
Jared Price rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

For those of you who are having problems setting the Legend property of a CPTXYGraph and are getting "[CPTXYGraph setLegent:]: unrecognized selector sent to instance". You can perform the selector manually like so:

yourCPTXYGraphObject.PerformSelector(new ObjCRuntime.Selector("setLegend:"), yourCPTLegendObject);

It looks like this is not very well maintained since it looks like this bug has been around for a while. 3 stars for lack of maintenance.

Posted on: March 4, 2015 / Version: 1.5.1.2
Renato Todorov rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

Guys, any answer on Bradley Gore's question? I'm facing the same issues with the setLegent method. A bar graph without legend is juts useless. Is there a typo on the binding project? Can you update it please?

Thanks

Posted on: October 20, 2014 / Version: 1.5.1.1
Rick Gross rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

OK - The above documentation is incorrect, instead of int it should be marked as uint...

Posted on: October 15, 2014 / Version: 1.5.1.1
Bradley Gore rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

Just starting out and I have spent a lot of time so far trying to get a legend set up for my Pie Chart. I'm new to iOS dev, and extremely new to objective c, so I may be misunderstanding the api docs. My understanding is that I should be able to use the static Legend.FromGraph(myGraphHere) method, and set any Graph's Legend property to that. However, when I try to do that, I get an exception:

MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[CPTXYGraph setLegent:]: unrecognized selector sent to instance 0xffd94c0 at at (wrapper managed-to-native)..........

Is that method reference "-[CPTXYGraph setLegen*t*:]:" a typo - should it be setLegen*d*? I tried this with my app and with the sample charts that came with the download and received the same error on both.

The documents that are MonoTouch oriented are very sparse - it would be wonderful to see some more complex/complete usage examples for MonoTouch.

I didn't see any forums etc... for this component - is there a place for people to discuss or ask questions related to this component?

I understand that there's a ton of time going into a project like this, so I want to mention that the examples look awesome - I'm hopeful that once I'm either better at translating obj c to C# or pointed to some quality help resources I will be able to utilize this component without further issues! Thanks!

Posted on: October 22, 2013 / Version: 0.9.2.1
Paul Auman

Can we get an updated binding for iOS7. Runs great on device(s) but does not run on iOS7 simulator.

Posted on: October 22, 2013 / Version: 0.9.2.4
Isaac Eckert rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

Great API for its price.

Posted on: October 22, 2013 / Version: 0.9.2
Bojan Rajkovic rates this with
  • 1
  • 2
  • 3
  • 4
  • 5

CorePlot is an awesome plotting framework. It rocks my socks off!

Posted on: October 22, 2013 / Version: 0.9.2