stadistics graphics with xcode ?

Member
Posts: 178
Joined: 2008.09
Post: #1
Hi again.
just to know some idea how can I make a real graphic like the photo down here, (stadistics), i mean, the user introduce some numbers then the xcode make the graphic ..... some idea please ?

thanks a lot !!!

[Image: estadisticas.jpg]

my iphone website: http://www.elsalvadorguia.com
intel Imac 20", iphone 8GB (2G)
Quote this message in a reply
Member
Posts: 283
Joined: 2006.05
Post: #2
You'll want to add a custom view in IB (or addSubview in code) that's a subclass of UIView. Then you can write the code for that class, overriding drawRect to add your custom drawing commands. For that you'll probably want to look at the documentation for Quartz.

There's useful sample code in the QuartzDemo project.

One other option would be to use a web view and work on a canvas object, but that might be quite a bit slower.
Quote this message in a reply
Member
Posts: 178
Joined: 2008.09
Post: #3
so sorry, on web view, what could be a canvas object ?
thanks again !

my iphone website: http://www.elsalvadorguia.com
intel Imac 20", iphone 8GB (2G)
Quote this message in a reply
Member
Posts: 283
Joined: 2006.05
Post: #4
It's an HTML element that you can draw to using J http://developer.apple.com/webapps/artic...anvas.html

I only suggested it because I thought you might already be familiar with it (though it would have the benefit of providing scrolling and zooming for free). If you're not, it's probably better to learn Quartz.
Quote this message in a reply
Member
Posts: 178
Joined: 2008.09
Post: #5
thanks one more time for your valuable help.
i will learn Quartz (take me more 2 month i think)

but i will try right now web option.
i like scroll and zoom for free, I have done that before.
very nice. jajajja

thanks

my iphone website: http://www.elsalvadorguia.com
intel Imac 20", iphone 8GB (2G)
Quote this message in a reply
Member
Posts: 178
Joined: 2008.09
Post: #6
HI again,
so sorry for this post, i am trying to make a very, very simple graphic on the iphone
but not work....

I do this:
copy the last code of the page you gave me

Quote:<html>
<head>
<meta name="viewport" content="width=320;height=420;user-scalable=no;initial-scale=1.0;">
<script src="MochiKit/lib/MochiKit/MochiKit.js"></script>
<script src="CanvasGraph.js"></script>
<style>
body { padding:0px; margin:0px; }
</style>
<script>
function startup() {
var graph = new CanvasGraph("canvas");
graph.setDataset("pages", [[0,2200], [1,2400], [2,3000], [3,1800], [4,1400], [5,1200]]);
graph.setDataset("wsrequests", [[0,600], [1,900], [2,1100], [3,400], [4,200], [5,700]]);
graph.drawLinePlot({"pages": Color.blueColor(),
"wsrequests": Color.redColor()});
}
</script>
</head>
<body onload="startup()">
<canvas id="canvas" width="320" height="420"></canvas>
</body>
</html>

then paste on a working UI WebWiew
but i can not see anything....
why, i know i am wrong, but i dont know what to do, i am very new on this.

i put the complete project here to download
could you (some one) download , and check , and tellme (or fix) what is wrong or what i have to do please to see line-graph on that project please ?

thanks one more time, here is the link to download the project

http://www.1572-8.com/aaaa-iPhone-Dev-fo...w_html.zip

my iphone website: http://www.elsalvadorguia.com
intel Imac 20", iphone 8GB (2G)
Quote this message in a reply
Member
Posts: 283
Joined: 2006.05
Post: #7
Probably because those <script> elements link to files that aren't included in your project. (You can find them linked from that page).

You can see that the web view is working if you replace index.html with a simple page. But it's positioned slightly wrongly; the top is cut off by the nav bar.
Quote this message in a reply
Member
Posts: 178
Joined: 2008.09
Post: #8
i find this url, that contains the canvasgrph.js

http://media.liquidx.net/static/canvasgr...asGraph.js

what i have to do to make it works?
copy and paste on a txt ? and call CanvasGraph.js ?
please help ?
thanks a lot !

my iphone website: http://www.elsalvadorguia.com
intel Imac 20", iphone 8GB (2G)
Quote this message in a reply
Member
Posts: 283
Joined: 2006.05
Post: #9
Yes.Â*Â*Â*Â*Â*Â*Â*
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #10
maximile Wrote:Yes.�*�*�*�*�*�*�*

Zero-width non-breaking space (U+FEFF) works better. :-)

Edit: Looks like you were only off by 0x100.
Quote this message in a reply
Member
Posts: 178
Joined: 2008.09
Post: #11
sorry, i was trying for some days but nothing.
could you xplain to me the DUMMIES (me) way please ?

i dont know how to import this to make graphics . please help !

http://media.liquidx.net/static/canvasgr...asGraph.js

my iphone website: http://www.elsalvadorguia.com
intel Imac 20", iphone 8GB (2G)
Quote this message in a reply
Member
Posts: 283
Joined: 2006.05
Post: #12
Is your problem importing the file or using it afterwards?

If you can't import it, post the code (and any errors) and it should be easy to sort out. If your problem is what to do once you've imported it, you might be on your own. But if you start with the example code on that Apple page, it shouldn't be too tricky, and any specific problems you come across you can ask here.
Quote this message in a reply
Post Reply