I am having pie chart in my application. Data labels are overlapping in coreplot whenever slice is very small.
Is there any way of adjusting frame of label or any other way of achieving this?
No, currently there's nothing you can do to improve the labelling. You could however rotate the pie chart to avoid the worst overlapping and show only pieces down to a minimum size. I have opened a bug report for this problem a while ago already.
Related
I need to display several vertical bar graphs, side by side, on an iPhone.
The graphs may be different, simple colors (red, green, yellow).
The length of each graph may vary.
I'll be updating no more often than once a second.
I'm planning to use UILabel for each bar graph, because that's the way I did it as an iOS newbie several years ago. It was simple and looked great.
Is there a faster/better way in iOS?
Perhaps using animation tools?
Personally, I don't see what a bar graph has to do with UILabel at all. I'd use rectangular layers or views (either of which could easily be animated as the graph changes), or even just draw the bar graph in code.
I want to draw graph in iOS native app (Making app using auto layout and Xcode 6.1)..after googling I found core plot lib for drawing graph.
I am struggling with this library to do make pie,bar,donut and line chart as I want.
I used the examples which are in 'examples' folder of this library.
How do I make graph to adjust when app is rotating and takes auto
layout constraints?
For bar/line chart-I don't get idea to make graph compact or make
scroll when there is large data to show on x or y axis?
For any chart- How do I show legends(title or explanation for
graph)?
How do I show values on bar/pie/line itself(Value on each
pie slice / every bar/ every line point)?
Can I set X and Y axis start and end point?
Please help if anybody have an idea? Thanks in advance.
The Plot Gallery example app demonstrates all of these things. You'll need to use the latest code from GitHub (release 1.5.1 doesn't have some of the newer features like auto layout; 1.6 will be out soon, but isn't quite ready yet).
The iOS version of the Plot Gallery uses a storyboard and auto layout to control the UI.
Set allowsUserInteraction to YES on the plot space to enable pinch zoom and scrolling behavior. You can disable pinch gestures and keep the scrolling behavior with the allowPinchScaling property on the hosting view.
Many of the Plot Gallery demos have legends. Look for CPTLegend in the code. Ask a more specific question if you need more help with this.
These are known as "data labels" in Core Plot. Many of the Plot Gallery demos have them. You can set a formatter and text style on the plot to turn them on, or use a plot delegate to have more control over each label.
Set the xRange and/or yRange of the plot space associated with the axes to control the coordinate space of the plot area.
i am new to core-plot frame work, i have few doubts about the feature of this frame work. May be my question very simple or unwanted, but still i am posting here for my clarification.
Its possible to drag and drop plot in core-plot framework.
Can i achieve smooth scrolling (like: UIScrollView) in core-plot?
If my graph size is beyond screen size means, how i can handle to scroll the graph to see fully?
If Its possible means kindly guide me to which Class or API provide this features, or any other things i have to follow. Thank you in advance....
Short answer, yes.
Set the allowsUserInteraction to YES for each plot space you want to respond to touch scrolling and pinch zoom events. Set allowPinchScaling to NO on the hosting view to keep the scrolling behavior and disable pinch gestures.
The xRange and yRange of the plot space determine the visible are of the plot area. Any plot data outside these ranges will be clipped and invisible. The plot ranges can be changed by the user (via scrolling and/or zooming) or directly in code by the app.
Be sure to look at the example apps included with Core Plot. Many of them include scrolling graphs.
I've developed a Pie Chart with animating pie segments. Each segment s a sublayer with custom drawing. The start and end angles are dynamic properties. The parts and their labels are drawn with core gaphics.
However, i notice bad performance with lots of red layers in the simulator. I cannot you opaque layers with pie parts obviously. i've set the ShouldRasterize to yes, that helped a bit. I also tried using instruments to spot the problem to no avail.
Core Plot
This open-source project may bring some thoughts about perfomance.
I've used this with animations in production and have great results
I couldn't solve the problem, so i took a totally different approach by using smaller layers.
I have a Core Plot scatter plot in an iOS app that I'm using to show some data. When the view loads I calculate the ideal ranges for the plot to fit its data on screen. I allow the user to zoom and pan, but include a button to return the graph to those ideal ranges.
The button works and the ranges change appropriately, but the change can be a bit jarring. One loses their mental 'map' of the plot because of the abrupt change. It would be much nicer to animate the pan and scale as necessary, like maps apps do.
I didn't see anything built into Core Plot that allows animation of this, but I may have missed something. Is there a way to do this with Core Plot (or a fork of it) or a reasonably easy way to do it manually?
In case anyone is wondering about this now, Eric's fix has been put in place and you can now animate a range using the following code:
CPTPlotRange *xRange = [CPTPlotRange
plotRangeWithLocation:CPTDecimalFromDouble(location)
length:CPTDecimalFromDouble(length)];
[CPTAnimation animate:plotSpace // CPTPlotSpace *
property:#"xRange"
fromPlotRange:plotSpace.xRange
toPlotRange:xRange
duration:5.0
withDelay:0
animationCurve:CPTAnimationCurveCubicInOut
delegate:nil];
The best solution available for now involves using a timer to adjust the range in small steps. I'm working on a more general solution, but it's not ready to include in the public code yet. Watch the status on Core Plot issue #398 to find out when the fix becomes available.