iOS SDK : How to draw Line Chart with marker using Google Chart API - objective-c

I am trying to draw Line chart with Google Chart API on iPad like the one shown below :
I am able to draw a simple chart with following URL :
http://chart.apis.google.com/chart?chxl=0:%7CJan%7CFeb%7CMar%7CJun%7CJul%7CAug%7C1:%7C10%7C20%7C30%7C40%7C50&chxt=x,y&chs=600x400&cht=lc&chd=t:22,3,89,54,65,45&chg=25,50&chls=0.75,-1,-1%7C2,4,1&chm=o,FF9900,1,-2,8%7Cb,3399CC44,0,1,0
Now I need to show marker like the one shown in the figure below where X and Y intersects.
How can I implement the same thing?

Finally I am able to do the same. Posting the link for reference.
For symbolic notation :
http://chart.apis.google.com/chart?chxl=0:%7CJan%7CFeb%7CMar%7CJun%7CJul%7CAug%7C1:%7C100%7C50%7C0&chf=bg,s,CCFFCC&cht=lc&chs=600x400&chxt=x,y&chxl=0:%7CTimeJan%7CFeb%7CMarch%7CApril%7CMay%7CJune%7CJuly%7C1:%7C0%7C10%7C20%7C30%7C40%7C50%7C60%7C70%7C80%7C90%7C100%7CScore&chd=t:20,50,70,90,45,50,80&chg=18,20&chdl=Score&chm=o,000000,0,-1,10.0
For Numeric Value refer the below one :
http://chart.apis.google.com/chart?chxl=0:%7CJan%7CFeb%7CMar%7CJun%7CJul%7CAug%7C1:%7C100%7C50%7C0&chf=bg,s,CCFFCC&cht=lc&chs=600x400&chxt=x,y&chxl=0:%7CTimeJan%7CFeb%7CMarch%7CApril%7CMay%7CJune%7CJuly%7C1:%7C0%7C10%7C20%7C30%7C40%7C50%7C60%7C70%7C80%7C90%7C100%7CScore&chd=t:20,50,70,90,45,50,80&chg=18,20&chdl=Score&chm=N,000000,0,-1,10.0

Related

Removing background on a 3d plot Julia

I am having some real trouble trying to plot nice things with Julia.
I first used PyPlot which I was happy with but I had to be able to change the angle on a 3D plots (in that case using surface) so I now use Plots directly with the camera speficication. I would like to remove the background on a 3D plot.
using PyPlot, the following command :
ax=gca(); ax:set_axis_off
works fine.
When using Plots, I tried the following :
using Plots; pyplot(grid=false)
and then my code for the surface, and it does not change the output.
I also tried the first example on this page :https://github.com/JuliaPlots/Plots.jl/pull/695 and grid specification does not work (grids are the same on every area of the layout).
I tried after updating every package and it still does not work.
Does anyone have an idea about what would the problem be please?
Thank you in advance !

Gray out entire map except a portion in Google maps iOS

I am using Google maps in iOS using iOS SDK, letting users mark an area using few markers, creating a polygon.
I want to highlight that area and gray out the rest of the map, something like this:
Is this possible somehow?
You have to draw your own UIImage where you create the gray area, clear area, and polygon borders. After that add it as an overlay tile using GMSGroundOverlay. This will fix it in place for when the user scrolls.
https://developers.google.com/maps/documentation/ios/overlays
This is similar to how radar overlays are drawn for weather apps.
I would approach this problem using several steps.
1) collect your points from the user that will define your polygon.
2) send the collection of points to your server.(ajax post)
3) server side, dynamically create a grey image with a transparent hole in it that is your polygon.
4) store image on server, send back response with info telling browser how to retrieve it(url,id,whatever).
5) using javascript + google maps api, apply an overlay referencing your newly created image.
each step may have its challenges but the problem becomes manageable if you focus on the different steps.
1) and 2) will involve using javascript, capturing 'clicks' and having feedback to the user in the form of a line or something on the map. Once finished, the server call can be initiated by the user or by your programming.
3) I would use python with an image library(skimage, etc.) and a mapping library (gdal). Making an image is not hard but combining it with GIS and getting the right projection, etc. will take some fiddling.
4) shouldn't be a problem once you've got that far.
5) using zimmryan's comment about creating a ground overlay could be helpful for this step.
good luck!

Core Plot Multiple Selection

i'm creating a stock chart, where i need to be able to select a period range from a chart and display that period on other chart. To do that i need to be able to have 2 select points on first chart to select values.
I saw this similar question, but it doesn't have enough explanation on how to do it, since i'm a newbie regarding to Core Plot and chart manipulation.
Can someone provide some sample code about this question?
thanks in advance.
Use scatter plots to draw the selection lines. You can draw them both with the same plot if you want the same line style. The Mac version of the CPTTestApp example app includes a selection demo that uses a scatter plot to draw a cross shape over the selected point. You could easily modify that to draw only the vertical line.
Ended up using HighStocks Chartsand embedded it on a webview and load HTML pages with JS.
Thank You all for your help.

Titanium Appcelerator - Creating Directions Using a Map?

I'm creating a simple Map application in Titanium Appcelerator, right now focusing only on iOS. I have 2 Annotations specified by the latitude and longitude. I want to draw the directions between the 2 points on the Map.
I see the
mapview.addRoute();
method on the MapView object, but it requires you to input all the points in the route to draw it properly?! That doesn't sound right at all - why would it require me to find all the points when the Google Map can do that already.
Is there a way that I'm missing to simply say "here's point A, here's point B, draw the route between the 2 points on the map".
Drawing routes on the map is nothing more than a vector drawing. The same does the mapsapp on your phone.
You will have to interrogate the maps apis for directions,get the directions (points) and use it in your code to draw the route.
If you don't want to do it yourself there is a free module in the marketplace that can help
https://marketplace.appcelerator.com/apps/2580?87150712
If you want to get your hands dirty, this post might help you:
http://developer.appcelerator.com/question/74221/mobile-map-route-from-google-server

How to put y axis number in Core Plot?

I would like my Scatter graph I am making with Core Plot library to show Y value near every point relative to X data.
I looked at CPTTestApp project from Core Plot examples, but I simply don't get it. First I thought the secret lies in
-(CPTPlotSymbol *)symbolForScatterPlot:(CPTScatterPlot *)plot recordIndex:(NSUInteger)index
method and I have implemented it in my project. Yes, I got points drawn, which is nice, but I found out this probably has nothing to do with values being shown near points....
This suspicion was confirmed when I opened Candlestick demo from Plot_Galley_Mac demo. There is no method from above and it shows numbers nicely!
If anyone can, please, help me. Otherwise, I would like to thank developers for sharing this library with us. Beside over usage of NSDecimal structure and a bit thin manual and reference data, this is fabulous project.
You're looking for "data labels". CPTPlot has a number of properties that control the built-in labeling functions:
labelOffset: distance between the point and the label
labelRotation: rotation angle
labelTextStyle: text style used to draw the labels
labelFormatter: number (or date) formatter used to format the labels
labelShadow: shadow properties applied to the labels
If the built-in labels don't meet your needs, you can create your own. Implement the -dataLabelForPlot:recordIndex: datasource method and return the desired label for each point. Custom labels can be any CPTLayer so you can make anything you want—text, images, or any custom layer that you create.