CorePlot: unable to change pie chart position (displacement)


I am unable to change the <strong>pie chart position</strong> (I would like it to be <strong>more left in respect to the legend</strong> so that the legend does not overlay the pie chart). Basically I would like to shift it towards the left to allow the legend to display.

I tried <strong>modifying the following properties</strong> (but with no apparent effect on the pie graph position):

// pieChartGraph is a CPTPieChart object pieChartGraph.graph.position = CGPointMake(-100, 0); // I also tried: pieChart.position = CGPointMake(-100, 0); // and also playing with: pieChart.anchorPoint <hr />

Here is what I get and also <strong>my code</strong> (by the way, the title does not show either):

<a href="https://i.stack.imgur.com/O9zwy.png" rel="nofollow"><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/O9zwy.png" data-original="https://i.stack.imgur.com/O9zwy.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

pieChartGraph = [[CPTXYGraph alloc] initWithFrame:self.pieChartgraphHostView.bounds]; self.pieChartgraphHostView.hostedGraph = pieChartGraph; pieChartGraph.plotAreaFrame.masksToBorder = NO; pieChartGraph.axisSet = nil; pieChart.title = @"title"; // <-- BTW, the title does not show either // 2 - Create chart pieChart = [[CPTPieChart alloc] init]; pieChart.dataSource = self; pieChart.delegate = self; pieChart.pieRadius = self.pieChartgraphHostView.bounds.size.width; pieChartGraph.delegate = self; pieChart.identifier = pieChartGraph.title; pieChart.startAngle = CPTFloat(M_PI_4); pieChart.sliceDirection = CPTPieDirectionClockwise; pieChart.borderLineStyle = [CPTLineStyle lineStyle]; // 3 - Create gradient CPTGradient *overlayGradient = [[CPTGradient alloc] init]; overlayGradient.gradientType = CPTGradientTypeRadial; overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:0.0] atPosition:0.9]; overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:0.4] atPosition:1.0]; pieChart.overlayFill = [CPTFill fillWithGradient:overlayGradient]; // 4 - Add chart to graph pieChart.pieRadius = pieChart.pieRadius / 2.3; [pieChartGraph addPlot:pieChart]; self.dataForChart = [@[@(self.displayedLastDataPoint.percentageUnder), @(self.displayedLastDataPoint.percentageOver), @(self.displayedLastDataPoint.percentageClean), @(self.displayedLastDataPoint.percentageRemaining)] mutableCopy]; // Add legend CPTLegend *theLegend = [CPTLegend legendWithGraph:pieChartGraph]; theLegend.numberOfColumns = 1; theLegend.fill = [CPTFill fillWithColor:[CPTColor whiteColor]]; theLegend.borderLineStyle = [CPTLineStyle lineStyle]; theLegend.entryFill = [CPTFill fillWithColor:[CPTColor lightGrayColor]]; theLegend.entryBorderLineStyle = [CPTLineStyle lineStyle]; theLegend.entryCornerRadius = CPTFloat(3.0); theLegend.entryPaddingLeft = CPTFloat(3.0); theLegend.entryPaddingTop = CPTFloat(3.0); theLegend.entryPaddingRight = CPTFloat(3.0); theLegend.entryPaddingBottom = CPTFloat(3.0); theLegend.cornerRadius = 5.0; theLegend.delegate = self; pieChartGraph.legend = theLegend; pieChartGraph.legendAnchor = CPTRectAnchorRight; CGFloat legendPadding = +(self.view.bounds.size.width / 16); pieChartGraph.legendDisplacement = CGPointMake(legendPadding, 0.0); pieChartGraph.graph.position = CGPointMake(-30, 0);


Set the centerAnchor to position the pie chart within the graph. It is a CGPoint. Both coordinates range between 0 and 1, similar to the anchorPoint of a CALayer.


  • CakePHP 3.0 not running without intl extension
  • how to install mysqli on windows iis server?
  • cakephp emails not working
  • Warning: mail(): Failed to Receive in
  • How to mail a log file to yourself using PHP from a Windows machine ?
  • error: expected unqualified-id before string constant
  • Autoloading classes when not in same directory as zend library
  • Pip behind a proxy with a custom certificate file
  • Increase the limit of file upload size in Heroku while uploading to Dropbox
  • Share session on subdomains in php
  • FolderBrowserDialog crashes the application
  • Kill Active Session if User Is Banned
  • Get highest value from a file using mSL and mIRC
  • Enabling domxml in php
  • Change of MySQL database location not working
  • Changing MySQL charset to UTF8 on linux so it will work with JDBC
  • Fraction length
  • Is is safe to use HSQLDB for production? (JBoss AS5.1)
  • Is there a way to disable a specific event in kendo ui scheduler?
  • Install PHP intl extension on MacOS
  • Word Open XML Mail Merge
  • How do I alternate colors in Flat List (React Native)
  • Row Count Is Returning the incorrect number using RaptureXML
  • Pass value from viewmodel to script in zk
  • Obtain ObjectIdHex value from mgo query
  • 'TypeError' while using NSGA2 to solve Multi-objective prob. from pyopt-sparse in OpenMDAO
  • Eraser for UIBezierPath
  • Compare two NSDates in iPhone
  • Comma separated Values
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • Load html files in TinyMce
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • how does django model after text[] in postgresql [duplicate]
  • Bitwise OR returns boolean when one of operands is nil
  • MATLAB: Piecewise function in curve fitting toolbox using fittype
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal