I am working on getting multiple line charts displaying on the same graph. The problem is, when there are missing data points, the graph doesn't fill in gaps. Is there a way for it to automatically do this?
The first and second images show the same graph, only a slightly different frame for the x-axis. Has anyone else run into this same problem? I believe the problem stems from lacking enough data points. The graph displays accurately when zoomed out, but runs into this problem when I zoom between two known data points where no data point is present. The solution I'm currently exploring is to interpret the slope between points and fabricate data points for the missing x-axis points. This process is quite extensive and seems a little impractical. Does anyone have a better solution for this?
These lines fill based on having adequate data. The standard for these charts is to be undefined where there is no Y value present. If you were to fill in more data, your graph would maintain its continuity.
Related
Ok, I've done some reading around the subject, have an idea of how I'd tackle my problem, but want to find out of this is the most efficient way, or if I'm missing something simple.
I have a line diagram of a section of railway that I'd like to plot the users location onto (the user being someone on a train moving up/down the railway).
Now, I initially went down the route of geo-referencing, but quickly realised this probably wasn't the way to go, as my image is not a real reflection of the area + I want the line diagram to be what the user sees.
OK, my though process of how I will tackle it:
I know the physical area so I could extract the coordinates along the railway, every x meters (my line diagram has a resolution of around 5m). Stick this into an array. Can anyone suggest a tool to do this?!
Allocate my line diagram a start and end, then match the image coordinates with the physical coordinates for the entire line.
Read in the users position and update where to draw the position based on the closest match in the array?
Does this sound doable, and would it give me decent results?
If you have more sophisticated answers, please do share.
It sounds reasonable in general. As the user is supposed to be on a train a simpler option may work where you just keep track of the physical distance moved and use that as a percentage distance along the line. This is a lot simpler to manage and could be backed up with some coordinate checkpoints to ensure you don't have a drifting error. I'd aim for a simpler implementation if you can.
I am working on an iOS application which uses GTFS data. The data is provided by the local transit authority. When plotting the route overlays onto a map, I have found a number of outlying data points as seen in the image below:
Screen Shot (Imgur)
*Sorry I didn't have enough reputation to post an image
In order to make the data more managable I have filtered the shape data through the Ramer-Douglas-Peucker Algorithm to remove redundant data points.
I am unsure of how to process the data further to remove these obviously incorrect points. Could someone offer some advice on to filter out these data points?
It looks like the agency has maybe added extraneous segments from the road to each stop's location on the side of the road? You might try filtering small segments that pop out to a stop location and back.
I have been looking all around the net for open source graph plot framework for iOS, but I am struggling with it as of now. I have worked on an app and used PowerPlot Graph Plot framework http://powerplot.nua-schroers.de/examples/webtraffic.html
I am trying to draw a bar graph chart showing two years at once without stacking each, like in the image below: As you can see there is a problem of resizeing and the scaling isnt uniform. I would like to make the chart look bigger and the y axis be more formatted.
Any suggestions because I always hear about core plot also by which you can achieve such(see below), but all i hear about coreplot is flexibility and customization issues.
You can easily produce a bar plot like that with Core Plot. Give it a try and ask specific questions here on StackOverflow if you get stuck.
I have a simple scatter plot with ~500,000 points on it. Having this many points on the graph really makes my app lag, which isn't surprising. I was wondering if there was a way to only draw the points for a specific x range (like 0-100 or 500-1000). The user will only be looking at certain points of the graph (via zooming in), so it would make it much less laggy if the program only had to plot a small amount of those points.
I've tried having the graph re-draw itself, every time the user zooms in/out or moves the axis, but this actually seems to make the app run slower. Is there a solution to this issue?
You'll have to filter the data and only provide the visible points to the plot in your datasource. Use a plot space delegate to detect when the visible area changes and adjust the data as needed. The best way to do this will depend on how your app stores its data internally. You'll want to use a data structure that lets you quickly determine which points need to be plotted.
You don't want to reload all of the data every time something changes. The plots have methods to insert and remove ranges of data points while preserving the rest of the data. If you're only changing a few points at a time, this is much faster than reloading all of the data every time. The "Real-Time Plot" demo in the Plot Gallery app shows one way to use these methods.
I'm coding iOS app that will explain complex numbers to the user. Complex numbers can be displayed in Cartesian coordinates and that's what I want to do; print one or more vectors on the screen.
I am looking for the easiest way to print 3 vectors into a coordinate system that will adjust itself to the vector-size (if x-coord is > y-coord adjust both axis to x-coord and vice versa).
I tried using Core Plot, which I think is way too multifunctional for my purpose.
Right now I am working with PowerPlot and my coordinate system looks okay already, but I still encounter some problems (x- and y-axis are set to the x and y values which results in a 45 degree angled line, no matter the user input).
The functionality of the examples in CorePlot and PowerPlot don't seem to meet my needs.
My last two approaches were using HTML and a web view, and doing it all myself with Quartz (not the simple way...)
Do you have any advice how to do this the simple way, as it is a simple problem, I guess?
If you're not wanting to do much actual graphing and plotting, then using Core Plot or similar sounds like overkill to me. The extra bloat of adding coreplot to your project, not to mention the time taken for you to understand how to use it, might not be worth it for some simple graphics.
Quartz is well equipped for the job of showing a few vectors on the screen, assuming you're not interested in fancy 3D graphics. There are plenty of tutorials and examples of using Core Graphics (AKA Quartz) to draw lines etc. If you're going the Quartz route, perhaps get some simple line drawing going in Quartz, then ask more questions if you need help with the maths aspect of it.
The typical technique used when rendering with Quartz is to override drawRect in a subclass of UIView and place calls to Core Graphics drawing functions in there.
A decent question and example of Quartz line drawing is here:
How do I draw a line on the iPhone?
If you aren't adverse to using Google Chart Image you can load reasonably complex data sets in a simple manner by calling the appropriate URL and then putting the image in a UIImageView. It takes very little code: here is a blog post explanation with sample code.
The limitations are
length of the data set is restricted by the max URL length you can request from Google (2048 characters, with encoding is large), though I've plotted with 120 data points in 4 series.
a net connection is required (at least to get the initial chart)
and perhaps the biggest problem, API is deprecated and will be discontinued in 2015 at some point. You would then have to switch to the UIWebView/Javascript Google Chart API implementation...
Sample image: