I am working on core Plot library in ios.I was able to add mutliple scatter plots to graph.I am not able to achieve following customizations(Pls refer attached image):
Need to connect multiple Y-axis points and draw a vertical line.
On X-axis,need to add number of tasks(Custom UI views) for every month.
Thanks for any help you can give.
Use a third scatter plot to draw the vertical lines.
Don't add subviews to the Core Plot hosting view. Add them to the hosting view's superview. You can use the plot space to find the coordinates along the x-axis to anchor your custom views.
Related
I need to show a graph in my iOS app something like
We have been using CorePlot for all the graphs and now I need to add a new kind as shown above. I found I could draw a graph like the above with CPTRangePlot. My problem is I can only draw a horizontal graph as shown below.
Is there any way to make it vertical? For a single curve we can easily do that by switching the value on X-axis and Y-axis. But for this kind of "range plot", I could not find a way to make it work for drawing the upper-bound and lower-bound lines and filling range with color can only be achieved on a normal horizontal graph. And yes, I can easily rotate the container view by 90 degrees, as I did in my testbed app. But I just cannot do this in our current app because this new added "range plot" graph is not the only one on the view. We have many other curves sharing the same plot space. So is there any hidden property or method to achieve the job? Thanks in advance!
I just added a fillDirection property to the range plot to enable this feature. You'll need to use the latest code from the release-2.3 branch.
I am trying to add the CPTLegend in uiview how can i add.Basically many people adding in Graph hosting view. Any idea?
All visible parts of a Core Plot graph, including the legend (drawn by CPTLegend), are Core Animation layers that are derived from a common superclass, CPTLayer. These layers rely on the hosting view to set up the coordinate transform and event handling and to handle layout changes.
Why do you need to have a legend that is not attached to a graph? CPTLegend depends on plots both to determine the contents of the legend and to actually draw it. These plots are normally part of a graph, so you should have one available to use as a host for the legend.
Enlarge the hosting view to cover the whole area where the pie chart and legend should appear. Change the centerAnchor of the pie chart to move it away from the center of the hosting view and position the legend on the other side of the graph. The separator view can be placed on top of the hosting view to separate the plot from the legend. Note that Core Animation hosting views don't allow subviews, so it needs to be a sibling (i.e., have the same superview) of the hosting view, not a subview.
I have previously used core plot and jawbone line chart view but now I want grid (background) on graph.
I wanna make exactly like above image any help would be appreciated and also please be specific while posting some third party libs and all.
How can I achieve the above graph (if selected dot/value to show callout) with callout?
Note- In X- axis (dates) and Y- axis (values) are there.
Edit 1:
Is it possible to achieve in core plot? If Yes, How and please be specific.
Thanks in advance.
You can use a plot space annotation to label the callouts. A simple rounded rectangle shape for the labels is easy—set the fill, borderLineStyle, and cornerRadius of the Core Plot text layer used for the annotation. If you need the little arrow on the side of the annotation, you should be able to draw that by using a stretchable image for the fill.
I'm drawing a chart in an iOS app and I want the gridlines to start in the x axis but end in the data point instead of extending all the way up to the top.
Is this possible?
Thanks in advance.
NC
Disclaimer: I work for ShinobiControls
The shinobicharts framework doesn't currently support this as an out-of-the-box feature.
A workaround may exist though. You may be able to add your own gridline subviews by using the SChartAxis method pixelValueForDataValue: to work out where in the plot area coordinate space you should draw your vertical line up to for a given data point.
Once you have your coordinates there are various ways you could draw your gridlines:
Add a canvas view behind or in front of the chart (depending on what effect you want). Then use your coordinates to draw your gridlines using CoreGraphics or some other drawing technique.
Create individual UIViews that each represent a gridline using your coordinates and add these behind or in front of the chart.
One thing to be aware of with this technique is that the gridlines will not automatically update when you pan and zoom. In order to do this you will need to override one of the chart's delegate methods that notify you of range changes and update your drawn gridlines to match the new data point positions.
Another potential workaround could be to use a column series to mimic gridlines. If you create a column series and feed it the same data points as your original series this will result in columns that go up to the y-value of each data point. You could then use the property interSeriesSetPadding on SChartAxisStyle to cause the columns to appear very thin.
I hope that information is useful!
I am using core plot framework for drawing the line graph in iPhone and it is working fine.I am displaying system time on X- axis and Temperature on Y- axis.I need to draw the cross hair vertical line that indicate the selected value on the line graph. for example
I would highly appreciate if someone can give me some suggestion to solve this issue.
Thanks in advance.
You can use another axis or scatter plot to draw the line. Using an axis is simpler if all you need is a single horizontal or vertical line. Set all of the tick and grid line styles to nil and use the orthogonalCoordinateDecimal to position it in the correct location. There is a demo using a scatter plot to draw a crosshairs over the selected point in the Mac version of the CPTTestApp example app.