I'm trying to use a scatter plot from Core Plot in my iOS application. I set up Core Plot as the Core Plot wiki says, and then I copy PlotItem.h/m, PlotGallery.h/m and SimpleScatterPlot.h/m from the included Plot Gallery project into my project. The code
CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme];
SimpleScatterPlot *scatterPlot = [[SimpleScatterPlot alloc]init];
[scatterPlot generateData];
[scatterPlot renderInLayer:hostView withTheme:theme];
runs, and the graph view is shown in my app. But I cannot move the graph view around or tap the plot points as in the Plot Gallery project. How do I set this up right?
The Plot Gallery is a poor starting point for a simple Core Plot demonstration. It has a lot of extra "stuff" to support generating a table view with thumbnails of all the different plots. The -renderInView:withTheme: method is used to make the thumbnail images for the table view. It renders the graph as an image which is why you lose interactivity. Unless you need the flexibility to quickly add new plots to your app and easily support both MacOS and iOS, I would recommend using one of the other examples as a starting point. The architecture is much simpler and easier to understand.
You need to have a CPTGraphHostingView in the visible view hierarchy. Set your graph as its hostedGraph. Look at any of the other example apps to see how to set up the hosting view. The graph setup and datasource code in the Plot Gallery plots (e.g., SimpleScatterPlot) is fine and should work anywhere.
Related
I am Developing an Application which requires the following kind of the Thermometer. I am using the CorePlot.
Should I use the Core-plot or any other alternative or Any custom framework like this is already been developed?
I asked to use views because its easier and quick to implement. With core plot, It would be good if you go through documentation and understand how it works first.
"Vertical Bar Chart" in the Plot Gallery example app demonstrates this.
In your code, You need to set
CPBarPlot * barPlot = [CPBarPlot ...];
[barPlot setBarsAreHorizontal:YES];
I've created a basic graph with Core Plot.
The graph succesfully showed in the center of the view, only I would like to show the Graph in fullscreen. Where can I change the frame size of the Graph?
I hope someone can help. Many thanks!
The graph will always fill its hosting view. Since the hosting view is a subclass of UIView, you can position and size the same as you would any other view.
I have a Core-Plot Graph within a Mac Application. But the inside table is appearing shifted down and to the left of the containing "frame/border" so that neither of the axis' are showing. I cannot figure out how to change this does anyone know what parameters I need to change to fix this?
Update: Sorry I did not realize I could upload an image, I have done so know and will try your suggestions in the mean-time.
Not sure what you mean by "inside table". It would be easier to offer suggestions if you could post a screenshot.
Without seeing what's wrong, here are some common areas to look at:
If you haven't already done so, look at the example apps included with Core Plot for ideas. The Plot Gallery app has many sample plots and the others are useful, too.
You may need to add padding (paddingLeft, paddingBottom, etc.) on the graph and/or plot area frame. Padding the graph pushes everything in away from the edges of the graph. Padding the plot area frame pushes the plot area in so the axes and titles can hang outside the plot area (the area where the plots are drawn).
If you want to keep an axes pinned to a specific place, e.g., the edge of the graph, set up a floating axis. Otherwise make sure the orthogonal coordinate is set (it defaults to 0). For example, the orthogonal coordinate for the x-axis is the y-value where the x-axis crosses the y-axis.
In my application I have to read data from a file or core data and draw a bar graph using that data. Can any one help me in drawing the bar graph in a simple way?
I have used the Core Plot library successfully. Here are some basic tutorials, but you will have to adjust to suit your particular scenario:
Using Core Plot in an iPhone Application
High Level Design Overview
Visualizing Data with Core Plot
check out this:
http://code.google.com/p/core-plot/
I'm completely new to ArcGIS and ArcMap, but someone suggested this program to me for a project I'm working on.
I would like to animate individual entities on a map, and was wondering if it is possible to do so in ArcMap. I asked this earlier here and a member directed me to a tutorial on animating in ArcGIS. The animation in the guide was over a map spread (ie. each pixel on the map displays, say, a different color to indicate population data in the area). However I realized that if I zoom in a lot, eventually the image will degenerate into pixels, which is why I need an actual object to mark a certain point. I checked some online tutorials and it seems like we can place markers on the map. Can someone tell me if it is possible to animate these markers (for example via a for-loop)? And if so, could you point me in a direction where to start?
Thanks in advance!
You can animate layers in ArcMap is the short answer. Its not as simple as using the timeline feature in Google Earth for example though. But then ArcMap is much more than just a visualization tool.
This help page on the ESRI web help looks like a good place to start.
I'm not 100% sure what you mean by the image degenerates into pixels. Are you saying that the markers were single points in the layer. Unlike Google Earth you are not confined to simply plotting points on the map. You can draw completely arbitrary shapes in ArcMap, which can be defined to cover actual areas of the map, so when you zoom-in the shape gets larger.
The way you need to load data into ArcMap to produce an animation isn't too simple. There might be other ways to do this, but the way I know of is to generate a NetCDF file. This file contains a 3D matrix of layer data, where each layer is separated through time. Because you generate a matrix, you are effectively placing a raster image over the map. Thus if you want to cover a large area, each matrix becomes large, and you multiply that by the number of time slices you wish to animate over.
Once you have a NetCDF file with your data in however, getting ArcMap to animate it and produce say a .avi file is pretty simple.
You could try just loading some of the example NetCDF datasets into ArcMap to see how/if they will work to get you started.
Hope that helps.
The upcoming v10 will have better time-aware capabilities, which will allow for animation.