Menu
  • HOME
  • TAGS

Keep scale on windows resize CorePlot 2.0 Mac OSX?

osx,core-plot

You could make the Core Plot hosting view a fixed size and place it inside another view that tracks changes in the in the window size. This would clip the edges of the graph inside the parent view. If that won't work, you'll need to track changes to the size...

How to Refresh Whole Graph of Core Plot

dynamic,graph,core-plot,reloaddata

You are correct, -reloadData only updates the plot data. You can call -scaleToFitPlots: afterwards to adjust the plot ranges to fit the new plot data. Consider using axisConstraints instead of the orthogonalCoordinateDecimal to position the axes. That way the axes stay in position as the plot ranges change....

Core Plot: Creating a CPTImage with imageWithCGImage

ios,objective-c,gradient,core-plot,cptimage

Set the scale of the image. CPTImage *image = [CPTImage imageWithCGImage:img.CGImage scale:img.scale]; If you're using the latest Core Plot code (after release 1.5.1), you can load the image directly: CPTImage *image = [CPTImage imageNamed:@"orange_bar_graph"]; ...

Changing color for grid lines markers in Coreplot

ios,objective-c,core-plot

CPTColor defines the same basic colors as UIColor, including +lightGrayColor and +darkGrayColor. If those don't meet your needs, you can use +colorWithGenericGray: to make any gray between black and white or +colorWithComponentRed:green:blue:alpha: to make any RGB color including those with transparency....

iOS - Z order of plotted line in Core Plot

core-plot,ios8.1

Use the topDownLayerOrder to move the axis line in front of the plots. CPTPlotArea *plotArea = graph.plotAreaFrame.plotArea; plotArea.topDownLayerOrder = @[@(CPTGraphLayerTypeAxisLines)]; Set the yRange to start at 5.0 with length 10.0: lPlotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(5.0) length:CPTDecimalFromDouble(10.0)]; ...

Core Plot Swift BarPlot tickLocation always zero

ios,swift,core-plot

You need to set the tickLocation of each new label. newLabel.tickLocation = next ...

NSNotificationCenter addObserver being ignored

ios,objective-c,core-plot,nsnotificationcenter,addobserver

The Core Plot hosting view removes itself as an observer of all notifications whenever you set the hosted graph or the collapsesLayers property. Please post a bug report on the issue tracker if you'd like us to fix it. In the meantime, add your observers after you set up the...

How to code to draw y1 and y2 axis using coreplot in ios 8?

objective-c,ios8,core-plot

You need to add another plot space for the second y-axis. Make the xRange the same as the first plot space. The Plot Gallery example app has several demos for this. The "Plot Space Demo" creates several plot spaces with different settings and assigns an axis to each one. The...

Refresh core plot scatterplot

objective-c,cocoa,core-plot

There are several methods available to tell a Core Plot plot that you have new data available: -reloadData: Replace all of the plot data with new data points. Calling this method on the graph causes all plots in the graph to reload their data. -reloadDataInIndexRange:: Replace the plot data in...

Changing the position of a CorePlot annotation after zooming(iOS)

ios,objective-c,cocoa-touch,annotations,core-plot

Use the displacement property to offset the annotation away from the anchor point. The displacement is measured in pixels so it won't change with the plot space.

How ObjectiveC mutableCopy work in swift

ios,objective-c,swift,core-plot

The problem is that mutableCopy returns an AnyObject. An AnyObject has no properties, so you can't assign into a property of it. You need to cast this to a CPTMutableLineStyle. var lineStyle = aaplPlot.dataLineStyle.mutableCopy() as CPTMutableLineStyle lineStyle.lineColor = aaplColor; ...

CorePlot CPTAxisLabelingPolicyAutomatic and NSDate

ios,core-plot

It works fine, although the automatic labeling algorithm doesn't know about the dates, so it won't split the axis into "nice" date intervals like days or weeks. You will probably want to use CPTTimeFormatter or CPTCalendarFormatter as the labelFormatter.

Core Plot in Swift for Beginner

ios,iphone,xcode,swift,core-plot

The axis labelingPolicy controls the tick spacing and labels. With custom labels (CPTAxisLabelingPolicyNone), it's up to you to give each label a location. If you want tick marks and/or grid lines, you need to set those locations (majorTickLocations and/or minorTickLocations) separately. There is a labeling policy demo in the Plot...

How to show more x-axes in core-plot chart

objective-c,core-plot,ios-charts

Several of the Core Plot example apps show how to add multiple axes in a graph. See, for example, the "Axis Demo" in the Plot Gallery app. Position one x-axis at the top and the other at the bottom using the axisConstraints or orthogonalCoordinateDecimal.

How to Hide or Show Axis Labels programmatically in Core Plot?

label,core-plot

If you only want to hide them, you can loop through the axisLabels set and hide or show the contentLayer of each label with the hidden property. You can also remove the labels to hide them. For custom labels (CPTAxisLabelingPolicyNone), just set the axisLabels to nil to hide them and...

How to repeatedly call a method (reload…) with a timer to animate a transition

ios,objective-c,animation,nstimer,core-plot

I just added an example to the "Simple Pie Chart" demo in the Plot Gallery example app. I added two properties to the controller to hold the index of the selected slice and the desired offset value. Since the offset is a CGFloat it is easily animated using Core Animation...

How to code to zoom in or zoom out in coreplot / ios 8?

objective-c,ios8,core-plot

The -plotSpace:shouldScaleBy:aboutPoint: method is only called in response to a pinch gesture on the hosting view. The -plotSpace:willChangePlotRangeTo:forCoordinate: method is called for every change so you can do all of your limit checks there.

-[UIView setHostedGraph:] unrecognized selector sent to instance

ios,objective-c,xcode,uiview,core-plot

After playing on and off in Interface Builder trying everything again and again, I've started to search more on StackOverflow and I've stumbled upon this question: Application crashes when working with core plot Pretty weird, but it wasn't and IB issue (I was sure I was doing the right thing...

Questions about scatter plot in Core Plot

ios,objective-c,core-plot

What data is being plotted? Please show the datasource methods. The visible data ranges in the plot area are controlled by the plot space: plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInteger(-5) length:CPTDecimalFromInteger(10)]; plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInteger(-7) length:CPTDecimalFromInteger(14)]; The labelExclusionRanges skips over any labels in the specified ranges. If you want to see...

Core plot temperature gradient line

ios,core-plot

Try the lineFill property of the line style instead. You can use a gradient or an image to provide the fill pattern.

How to create UIImage from CPTPlotSymbol?

ios,core-plot

You can use the -renderAsVectorInContext:atPoint:scale: method to draw the symbol into a CGContext. Create a context, draw the symbol into it, and use UIGraphicsGetImageFromCurrentImageContext() to create a UIImage.

Core-plot: How can I set a starting value for the x axis?

core-plot

Use the labelingOrigin to adjust the starting point for fixed interval ticks. Setting it to 10 (or 30 or 50, etc.) will work.

CPTPlotSymbol larger touch area

ios,core-plot

In your method that you make the plot and the graph there should be a line that goes like this. _yourGraph.plotSymbolMarginForHitDetection = 20.0f; I always use 20.0f because of 'fat' fingers too. I have a method that I called configurePlots, I get a reference to the graph and plot space....

Axes, labels, and titles are hidden or overlapped/occluded by the plot when the dataSource is updated

ios,swift,core-plot

By default the axes always cross at (0, 0). I suspect your plot data doesn't cover that point, so scaleToFitPlots pushes (0, 0) outside the visible plot area and hides the axes. You have several options: Use axisConstraints to lock the axes to a certain spot (e.g., the left edge...

Animate at re-selected index not working

ios,objective-c,animation,core-plot

Clearing the selectedIndex drives the radial offset to zero right away. Don't clear it until after the animation finishes. You can use an animation delegate or clear it in -setSliceOffset: after the offset reaches zero.

coreplot Xaxis start value iOS 7

ios,graph,core-plot,stacked-area-chart

To make the line smoother, either give it more data points or make a curved plot. plot.interpolation = CPTScatterPlotInterpolationCurved; If you know the range of data values, just set the xRange directly. Remember to set the location to the min value and the length to (max - min). You can...

Coreplot in swift: change starting value of axis to 1

swift,graphics,core-plot

The location of a plot range is the left end (on the x-axis) or bottom end (on the y-axis). Give each range a location of one (1) and adjust the length to the max - min (i.e., one in this case).

How to show Line label with two digits after dote?

ios,objective-c,core-plot,ios8.1

Create a NSNumberFormatter and configure it to format the labels however you want. Set the labelFormatter on the plot to the new formatter.

Core Plot CPTAxisLabelingPolicyAutomatic Days only

ios,core-plot

The automatic labeling algorithm doesn't know about dates, so it won't split the axis into "nice" date intervals like days or weeks. Right now, the fixed interval labeling policy is the best solution. It is up to you to determine the proper interval based on the range being displayed. There...

How can I access the layer so I can flip it?

ios,objective-c,calayer,core-plot

The short answer to your question is that you need to flip the layer of the view which contains your legend layer. [[viewWithLegendSublayer layer] setTransform:CATransform3DMakeScale(1.0f, -1.0f, 1.0f)]; This will do the trick, but if you add any other subviews to that view, they'll be upside down. N.B.: There may be...

Core Plot Selecting (Random) Points Challenge

ios,xcode,swift,graph,core-plot

Use a plot area delegate and implement one or more of the following delegate methods: -(void)plotAreaWasSelected:(CPTPlotArea *)plotArea withEvent:(CPTNativeEvent *)event; -(void)plotAreaTouchDown:(CPTPlotArea *)plotArea withEvent:(CPTNativeEvent *)event; -(void)plotAreaTouchUp:(CPTPlotArea *)plotArea withEvent:(CPTNativeEvent *)event; Use the -plotPointForEvent: plot space method to get the data coordinates of the interaction point from the event....

Combine delegates and bindings as data source, highlight a index

osx,core-plot

You can add a binding to an array of plot symbols using the binding identifier CPTScatterPlotBindingPlotSymbols. This array should be the same size as your data arrays. If you don't want a symbol at a particular index, insert [NSNull null] in the array instead of a plot symbol.

Core Plot shows wrong date on x-Axis

ios,objective-c,ios7,core-plot

Make sure the xRange of the plot space is set correctly. For example, to make a range enclosing the values listed in the question, do this: NSTimeInterval minTime = 1398172101; NSTimeInterval maxTime = 1398196536; plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(minTime) length:CPTDecimalFromDouble(maxTime - minTime)]; ...

Despite setting xRange, data is plotted in the wrong place

core-plot

For this application, the barOffset should be zero (0). The offset is used to displace the bars from the location given by the datasource. The most common use is to separate the bars at the same location when plotting multiple bar plots on the same graph that might have overlapping...

How to show x-axis title?

ios,objective-c,graph,core-plot,ios8.1

The X Axis needs to know where to draw in relation to the Y axis. Try adding in this line: axisSet.xAxis.orthogonalCoordinateDecimal = CPTDecimalFromUnsignedInteger(35); ...

How to add symboles on my scatterPlot using Swift

swift,core-plot

The symbol datasource method signature in Swift is: func symbolForScatterPlot(plot: CPTPlot!, recordIndex: UInt) -> CPTPlotSymbol? Return a plot symbol object or nil to omit the symbol at that index....

How to hold axis when zoom into core plot?

ios,objective-c,graph,core-plot,ios8.1

Use a plot space delegate to constrain the plot ranges. Implement the -plotSpace:willChangePlotRangeTo:forCoordinate: method. Check the passed in range and make sure it falls in the desired range. If not, make a mutable copy and modify it to fit. Return the original or modified range as appropriate.

Custom axis labels for Core Plot

charts,core-plot,labeling

You're positioning the custom labels outside the visible plot range. The xRange covers values between 800 and 1,200 (length of 400). The labels are at 1, 2, 3, etc. Use the label value as the tickLocation: label.tickLocation = CPTDecimalFromString(string); [xLocations addObject:string]; ...

Error of '“_vDSP maxvD”, referenced from…' when implementing core-plot [duplicate]

ios,objective-c,xcode,core-plot,vdsp

You need to link with the Accelerate.framework

How do i control the zooming / scaling of the scatter plot graph to show both axes

ios,scale,core-plot,zooming,scatter-plot

If you always want the axes to cross at the same place, use the orthogonalCoordinateDecimal property. It defaults to zero for both axes, but you can change that if you want. If the crossing point is outside the visible range after calling -scaleToFitPlots:, you can adjust the location and length...

Why is my graph so slow in a view in iOS 8?

objective-c,ios8,core-plot

You are creating more than 100,000 axis labels. That takes time, plus puts a lot of memory pressure on your app. Choose the major and minor increments so that the app only generates a reasonable number of labels for each axis.

Core plot - Scatter graph used as trend graph

ios,objective-c,core-plot,scatter-plot

Try different style on your scatter plot CPTScatterPlotInterpolationLinear: This is the default. CPTScatterPlotInterpolationStepped CPTScatterPlotInterpolationHistogram CPTScatterPlotInterpolationCurved example: CPTScatterPlot *yourPlot = [[CPTScatterPlot alloc] init]; yourPlot.dataSource = self; yourPlot.interpolation=CPTScatterPlotInterpolationCurved; ...

Core plot CPTTimeFormatter fixed xAxis time interval

objective-c,core-plot

You answered your own question—you need to account for the timezone difference. One way would be to set the timezone of the NSCalendar in the -beginningOfDay: method.

Core Plot horizontal bar chart on negative y-axis

core-plot,bar-chart

I have found a historical article that's similar to my request (core-plot iOS reversed Y axis). I have got what I needed after using this: CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(-yMax-1) length:CPTDecimalFromFloat(yMax) P.S. you need to add the -1 to the Location parameter (-yMax-1) otherwise the horizontal bar at index 0 will not be...

Error in CorePlot 1.5.1

osx,cocoa,core-plot,quartz-graphics

I believe this issue has been fixed. Release 1.6 should be out soon, or you can pull the latest code from GitHub.

Core-Plot: Minor tick labels on axis disappear

core-plot

"Fixed Interval" means exactly that—the intervals between the ticks don't change no matter the scale of the plot space. If you want the labels to change as you zoom in and out, you have a couple of options: Use the automatic labeling policy. This policy changes the intervals dynamically to...

Core Plot getting the error “Too many arguments to function call”

objective-c,core-plot,cocoapods

The new version of Cocoapods enabled a new build option that broke Core Plot builds. It's fixed in the latest code. See issue 138 for details. Point your pod file at the repository head rather than a release number....

iOS Core plot - graph line not extending upto major interval

ios,core-plot

The time intervals are in seconds, so you should multiply the index by 10 to space the data points 10 seconds apart.

Labeling Bar Chart in CorePlot

objective-c,cocoa,core-plot

Knowing the bar length (from the xValue), you can use the plot space to determine its size on screen. After creating the textLayer, check its bounds size. Compare the two and decide whether to position the label inside or outside the bar.

X Axis is moving down when changing y axis value in core plot

cocoa-touch,ios7,core-plot

-scaleToFitPlots: adjusts the plot space to fit the plot data exactly. You can use it as a starting point to fit the data and then expand the resulting range to leave extra space around the edges or to fix the location of one of the ranges. For example, you could...

Core-Plot DataLabel Z-Ordering

ios,plot,core-plot

I came up with a solution by myself: I just remove the plot and add it back. In that way the plot is raised in the z-Hierarchy. [self.graph removePlot:plot]; [self.graph addPlot:plot]; ...

Core Plot with swift getting error : “Missing Argument for Parameter ‘frame’ in call”

ios,swift,core-plot

I experienced similar problems while developing another app. To my experience, CGRectZero is causing problems with Swift. Try with an actual CGRect or call var pie = CPTPieChart(frame: CGRectMake(x,y,width,height)) ...

How to draw Multiple line between x1,y,1,y2 using coreplot in ios8?

objective-c,core-plot,ios8.1

The -addPlot: method always adds plots to the default plot space. When setting up the plots, use the -addPlot:toPlotSpace: method to add the plots to the graph. Specify the "y2" plot space for the plots that should use the secondary scale....

How to determine that the Plot has been rendered by Core-Plot

ios,core-plot

Create a plot delegate and implement the -didFinishDrawing: method. The plot that finished a draw cycle is passed as a parameter to the method so you can keep track of which ones are finished.

Why is the text upside down?

ios,objective-c,core-plot

Core Plot applies a flip transform on iOS so we can use the same drawing code on both the Mac and iOS. This is the transform it uses: self.layer.sublayerTransform = CATransform3DMakeScale( CPTFloat(1.0), CPTFloat(-1.0), CPTFloat(1.0) ); ...

Gradient to solid color coreplot

ios,core-plot

+tubularBarPlotWithColor: is a short cut to create bars with a gradient fill. If you don't want the gradient, set the fill to a solid color. self.helloPlot.fill = [[CPTFill fillWithColor:[CPTColor redColor]]; ...

Add view to subView

ios,objective-c,core-plot,addsubview

As the error message suggests, you're trying to add an object that isn't of type UIView as a subview to the cell. Add the CTPGraph object to an instance of type CPTGraphHostingView, then add this as a subview to the cell: CPTGraphHostingView *hostingView = [[CPTGraphHostingView alloc] initWithFrame:frame]; hostingView.hostedGraph = graph;...

How to get color from slice index?

ios,objective-c,core-plot,pie-chart

Usually you fill out the DataSource function to provide the color, which means you already have the color. For you case, I think you could use this function: + (CPTColor *) defaultPieSliceColorForIndex:(NSUInteger) pieSliceIndex The doc is here. To get the UIColor of CPTColor, simply get the CPTColor's property uiColor. Detailed...

Core plot graph with grid lines in ios 8.1 [closed]

ios,objective-c,xcode,core-plot

//Add plot space CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace; plotSpace.delegate = self; plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(0.0) length:CPTDecimalFromInt(25)]; then change x axis label policy like this x.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; ...

Animation is not working as expected

ios,objective-c,core-plot,cabasicanimation

CAAnimation is KVC compliant, so we can store whether you're starting or finishing for lookup in the delegate methods: { CABasicAnimation *scaleAnimation = [CABasicAnimation animationWithKeyPath:@"transform.scale.x"]; [scaleAnimation setValue:@(YES) forKey:@"scaleAnimation"]; // set the delegate scaleAnimation.delegate = self; scaleAnimation.fromValue = [NSNumber numberWithFloat:1.0]; scaleAnimation.toValue = [NSNumber numberWithFloat:0.5]; scaleAnimation.duration = 1.0f; scaleAnimation.removedOnCompletion = NO; [self.pieChart...

customized xaxis labels with actions in coreplot graph

ios,graph,core-plot

You can use an axis delegate to detect touches on the axis labels. Implement the -axis:labelWasSelected: method or one of the other selection methods. The contentLayer of the axis label is a CPTTextLayer so you can add a background fill and border to make it look like a button. If...

Failed to install CorePlot 2.0 via cocoapod

core-plot,cocoapods

There is no 2.0 release of Core Plot (yet). Use the following line in your podfile to point at the release-2.0 branch: pod 'CorePlot', :git => 'https://github.com/core-plot/core-plot.git', :branch => 'release-2.0' There is a combined header file that works for both Mac and iOS apps. You can also use the CorePlot-CocoaTouch.h...

How to fix a gap between the x and y axes in core plot

ios,core-plot

Use the axisConstraints to position the x-axis at the lower edge of the plot area: x.axisConstraints = [CPTConstraints constraintWithLowerOffset:0.0]; ...

CorePlot with swift: there is no yAxis.majorIntervalLength

swift,graph,core-plot

Swift doesn't support NSDecimal values. We've made some changes to the Core Plot API, replacing NSDecimal with NSDecimalNumber. The changes are on the release-2.0 branch and not in a release package yet. See Core Plot issue #96 for more discussion of the issue.

Zooming in CorePlot on Mac OS X

osx,core-plot

Pinch and scroll gestures are also available on the Mac. I don't think this feature has been included in any release yet, so you'll need to get the latest source from GitHub.

How to get reference to a specific plot space in Core Plot

plot,core-plot,space

You have several options: Set the identifier for the new plot space and use -plotSpaceWithIdentifier: to retrieve a reference from the graph. Use -plotSpaceAtIndex: to refer to plot spaces in the order they were added to the graph. The default plot space is at index 0. Keep a reference to...

Coreplot Legend drawing outside of plot frame

cocoa,core-plot

Make sure the graph is masking its sublayers. Use masksToBounds to clip to the outside of the border line or masksToBorder to clip to the inside edge of the border.

Drawing tangent plot in Core Plot

ios,objective-c,core-plot

You need to leave a gap in the data (return nil or [NSNull null] from the datasource) to break the plot line at the discontinuity.

ios core plot increase CPTPlotSymbol clickable area

ios,graph,core-plot,increment,clickable

Use the plotSymbolMarginForHitDetection property on the scatter plot. This increases the size of the tappable zone around each plot symbol.

Dynamically fetch data for plot range in core plot iOS

ios,objective-c,core-data,core-plot

Ok I managed to figure it out :). Here is my solution, in case anyone else stumbles across this problem: I realised that the only way to fetch my visible date range is to extract the date values from the axis labels. I then used those date values to perform...

CorePlot allow user drag rotate PieChart

ios,objective-c,core-plot,pie-chart

The pie chart centerAnchor is given as fractions of the width and height. Be sure to multiply the anchor values by the corresponding dimension of the graph before computing dx and dy.

Why does the object appear before animation

ios,objective-c,animation,core-plot

When configuring the plot, set the initial endAngle to the same value as the startAngle. The default of NAN tells the plot to draw a full circle starting from the startAngle.

Cannot invoke an Objective-C method in Swift [duplicate]

objective-c,swift,core-plot

expandRangeByFactor exists, but it takes an NSDecimal. You are trying to supply an NSDecimalNumber, which is not the same thing. (Another problem with your code - irrelevant in this situation, but still a problem - is that you cannot say NSDecimalNumber(1.1). There is no such initializer.) You need to pass...

Creating a line graph with arbitrary X axis sample positions on iOS

ios,objective-c,core-plot,jbchartview

Core Plot can absolutely do this. The scatterplot pulls data from its datasource independently for the x- and y-values. Most of the included examples just use the data index for the x-value, but that choice was only to make the examples easier to follow. The x-values can be anything. The...

Usage for plotAreaViewPointForPlotPoint in CorePlot 1.5.1

ios,swift,core-plot

Try this: var popPoint = graphView.hostedGraph.defaultPlotSpace.plotAreaViewPointForPlotPoint(&pointers, numberOfCoordinates: idx) ...

Why is this not animating?

ios,objective-c,animation,core-plot,pie-chart

I finally got it thanks to @RoryMcKinnel. [CPTAnimation animate:pieChart property:@"endAngle" from:pieChart.startAngle + M_PI * 2 to:pieChart.startAngle duration:2.0]; This will animate your pie chart like this: http://jsfiddle.net/ozgr1wfx/. Again. Thanks to @RoryMcKinnel who put me on the right track to get it!...

Core Plot axis lines not appearing

objective-c,core-plot

Instead of replacing the default axis set, just set your new axes array to it: _graph.axisSet.axes = @[_xAxis, _yAxisLeft, _yAxisRight]; You are replacing a CPTXYAxisSet with a CPTAxisSet that doesn't know how to lay out and draw the x-y axes....

CorePlot Visible Range Not Working As Expected

ios,core-plot,visible

Since the x data points are one unit apart, giving the xRange a length of 6 (plus a bit for the plot symbols) will do what you want. In the code you posted, the xRange is set up with -scaleToFitPlots: before expanding the range. This makes it fit all of...

iOS CorePlot x-axis DateTime interval proportional

ios,core-plot,datetime-format

There are several example apps included with Core Plot that demonstrate working with dates. See, for example, the "Date Plot" demo in the Plot Gallery app. You need to convert the date value to numeric values and use those for the x-values instead of the data index. Be sure to...

Unknown large spacing between x-axis label and base of plot in core-plot

ios,core-plot

By default the axes always cross at (0, 0), which is far below the starting location of the yRange (9,000). The large bottom padding pushes the graph up so that y = 0 is visible, although with a large empty space below the graph. You have several options: Use axisConstraints...

draw a dotted line on CorePlot graph in iOS

ios,core-plot

This is what I used for such situation: @property (nonatomic, retain) CPTScatterPlot *myLine; @property (nonatomic, retain) CPTGraph *graph; -(void) configureHorizontalLine { // 1 - Create plot space CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *) self.graph.defaultPlotSpace; // 2 - Create the plot self.myLine = [[CPTScatterPlot alloc] init]; self.myLine.dataSource = self; self.myLine.identifier = @"myLine";...

Using alternating band fills to color background in coreplot graph

ios,colors,core-plot,graphing

Add "alpha" (transparency) to the color: CPTColor *color = [[CPTColor redColor] colorWithAlphaComponent:0.1]; ...

Add long gesture recognizer to the hostView CorePlot

ios,objective-c,core-plot

I too tested your code -(void)viewDidLoad { UILongPressGestureRecognizer *longPressGesture = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTap)]; [longPressGesture setMinimumPressDuration:1]; [self.tempView addGestureRecognizer:longPressGesture]; [self.tempView setUserInteractionEnabled:YES]; } -(void)longTap { NSLog(@"tapped"); } my longTap method is getting called... If your stil not working ,you could provide more code so I could have more look in it for...

How to add prefix to Axis label in core plot

cocoa-touch,ios7,core-plot

Configure the labelFormatter on the y-axis to add the currency symbol. NSNumberFormatter gives you many options. You need to add padding on the plot area frame to leave room for the labels, e.g., graph.plotAreaFrame.paddingLeft = 50.0;....

Match indexOfVisiblePointClosestToPlotAreaPoint to one axis?

osx,core-plot

The plot data is sorted from left to right. Find the data points on either side of the green line. It's trivial to determine which one is closer to the line. A simple linear search is fine if you don't have a lot of data. Use something more efficient like...

How do I convert CPTColor to UIColor?

ios,objective-c,core-plot,uicolor

CTPColor has a property which allows you to obtain a UIColor object from itself. Assuming your CTPColor object is called myColor: UIColor myUiColor = myColor.uiColor; This can be found really easily by checking out the documentation for CTPColor, found here. Documentation is written for a reason! Hope this helps!...

iOS CorePlot how to install

ios,objective-c,core-plot

Foundry's answer is great if you use Cocoapods, but I'll will provide you a step-by-step guide to do it manually : Create a folder named Workspace, and create a new "testCoreplot" project in it from within Xcode. Download CorePlot, and copy the "Source/framework" folder into your workspace folder. Rename it...

Axis label modification in Coreplot

ios,cocoa-touch,core-plot,nsnumberformatter

The answer is to set the label formatter on the axis. From a quick look at the documentation for NSNumberFormatter, it seems you should be able to do what you're looking for with a combination of setPositiveFormat, setMultiplier, and setPositiveSuffix. Something like: NSNumberFormatter *labelFormatter = [[NSNumberFormatter alloc] init]; [labelFormatter setPositiveFormat:@"#.##"];...

Coreplot 1.5.x arm64 - Undefined symbols for architecture arm64:

ios8,core-plot

This is fixed in later Core Plot releases. Release 1.5.1 has been out since March 2014.

Core Plot CPTBorderedLayer not animating

calayer,core-plot,cabasicanimation

The issue was that I had the collapsesLayers property on my CPTGraphHostingView set to YES. Setting it to NO fixed the issue.

multiple function curves in core-plot

objective-c,core-plot

(Answering the question based on comments above) Save a copy of each dataset separately. It looks like the calculated plot data gets overwritten each time you call -getDataForPlot1:. Also, set a unique identifier for each plot so the datasource can know which one is requesting data....

Implement Pull to Refresh feature in Core Plot

ios,objective-c,core-plot

You can configure a graph to bounce back if the user pulls the plot past the global plot range (set allowsMomentum to YES on the plot space). However, this doesn't give you enough control of the bounce to pause it and display the spinner that is normally displayed during the...

Is it possible to add a UIImage to CPTGraph?

ios,objective-c,uiimage,core-plot

Use a plot space annotation: CPTBorderedLayer *imageLayer = [[CPTBorderedLayer alloc] initWithFrame:imageFrame]; imageLayer.fill = [CPTFill fillWithImage:[CPTImage imageNamed:@"image.png"]]; NSArray *plotPoint = @[xCoordinate, yCoordinate]; CPTPlotSpaceAnnotation *imageAnnotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:plotSpace anchorPlotPoint:plotPoint]; imageAnnotation.contentLayer = imageLayer; ...