So I’m currently working for a client on a project. The client wants to add some graphing functions similar to Microsoft Excel to the game’s evaluation menu. Interest has been expressed for bar graphs and line plots. I feel that making a bar graph would not be too difficult by stretching out square textures, but I don’t even know where to start when it comes to getting a line connecting two points on the screen.
Any help?
If you have Unity Pro, use GL.LINES.
–Eric
I’ve used Google Chart API and WWW.LoadImageIntoTexture to display statistics graphs in a web player once.
Texture2D.SetPixel could also be used to generate some sort of graphs I guess. And it would not require an internet connection in order to work opposed to google charts.
Could be other ways as well that I haven’t thought about 
You could also generate meshes at runtime to represent your data if you need to.
Also if it’s a web player, in the same vein as the Google charts suggestion you can set up a simple PHP script that takes a set of parameters and spits out an image using ImageMagick or GD.
Generating textures in Unity could work quite well for you if your graphs are small-ish, and/or you don’t need killer speed for the generation.
-Jeremy
My current projects spits out the PHP-GD graphs, but I don’t load them back into Unity. Would work though.
Hi all,
Sorry to reuse an old thread, but i thought it just as good as starting a new one for the same topic.
My issue:
I have an iPhone project that requires the user to look at quite a bit of data. At present I am outputting this as a page full of text, which whilst ok, is not very cosmetically agreeable.
I only have iPhone Basic so i think drawing graphs directly is out of the question and I don’t really fancy linking to the web for this (seems a bit overkill)
What options for graphs/data output would you suggest. Most of the data is time related, hence my thought of graphs.
Kind Regards,
Matt.
If all else fails, a scatter plot is a pretty effective way to plot two or three variables. You could probably do this quite efficiently using particles. A LineRenderer is probably acceptable for a simple line graph, and you could use rectangles of varying sizes (done with GUI.Box or a procedurally generated mesh, say) for a bar chart.
I used a single pixel texture and simply scaled and rotated it between two points to get a line graph. It works really well; although I am using Unity iPhone advanced and am not sure of the performance differences.
Perhaps you can use the texture drawing capabilities to use your text-based data to draw on the fly? Look at the Texture2D class and the SetPixel and SetPixels functions in particular as a starting point. Then you can draw and display a texture using a GUITexture in your iPhone app.