- Home /
Draw Graph with Vectrosity in NGUI window
Hi!
I actually make a chemical reaction simulator for a game, and I would like to draw graphs that will represents the concentration of each molecules.
So I bought NGUI and Vectrosity because Vectrosity seems to be the best way to draw graphs. For now I have some 2D curves (VectorLines) made with Vectrosity and it works fine. I also have my window made of sprites and labels wich was built with NGUI.
So now, I wondering me how can put this curves in the window.
The main problem is to cut the curves at the edges of the window (NGUI sprite). One of my ideas was to create 3D VectorLines and modify the depth view of the camera to hide some points by assigning them a huge (or not) Z position. But for now it seems really hard to do that and not really fancy.
Can somebody help me or give me advices?
Thanks in advance for your answers
That makes this harder. I was going to suggest RenderTextures, but they're a Unity Pro thing. You can draw the Vectrosity lines within the window border yourself and keep updating them so they stay within the window when the window moves and gets resized, but it won't be robust because I'm positive there will be layering issues if another window should ever cover the graphing one. So I won't post this solution as an answer.
Ok thanks. I dont think that something will cover the graph curves. I will try to do something by cutting curve by alternating Continious and discrete LineType when maximum height is reach.
Any other ideas? =)
You could consider carefully maintaining the vectrosity camera's normalized view port rect so that it always fits inside the NGUI window. This will clip the vectrosity lines against the window properly.
Answer by etoreo · Nov 17, 2013 at 03:15 AM
I know this is years late, but you could try NGraph out. I have just released a graphing utility for NGUI (and soon other GUI toolkits) called NGraph: