WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Drawing a Graph (https://www.wowinterface.com/forums/showthread.php?t=54950)

Lolzen 12-23-16 09:59 AM

Drawing a Graph
 
I'd like to draw a Graph, but i have no clue how to accomplish this.
To be more specific, i'd like to make something like the DPSgraph in recount.

I do have the data gathered in combat, also the time spent in combat, however when i google search i get various results like libraries for handling it, or different forms of graphs, etc.

The closest i've come is to think it may have to do with some kind of x and y axis, a periodic update functon and something to draw a line. And here comes my misery, i really don't know how to accomplish this with the API given and when i look at the code from Recount or CombatGraph i don't really get it either.

So if anyone could give me a simple example in that direction that would be enough to get me going, thanks in advance!

SDPhantom 12-23-16 06:44 PM

The type of graph you want to show would determine the complexity of creating it. Bar graphs are the easiest to make. You can just line up textures next to each other, stick them in a table, and iterate over them, setting their width or height according to the data you're representing. Line graphs are a little more tricky. In the past, you had to make an image file with a line in it, and manipulate the rotation. Then you had to position the texture between the previous and current data points when iterating over your lines. New in Legion are Line objects, which would make this task easier. You create them, set their width along with starting and ending anchors, and you're set. Pie charts are by far the most complex. They involve creating a half-circle image, sticking textures in ScrollFrames to crop one end of the half-circle while you rotate the textures inside to adjust the angle of the pie piece.

Ketho 12-24-16 01:58 PM

There is LibGraph-2.0, but the documentation is in the source code

Here is a list of addons using it, including Recount
https://www.wowace.com/projects/libg...ons/dependents

Myself I was able to make some simple, static graphs with it in ReadySetDing



Code:

/run LibStub("LibGraph-2.0"):TestGraph2Lib()

Lolzen 12-24-16 05:03 PM

Thanks for the input on both Line objects and LibGraph!

Now i have actually something to work with, thanks a ton!! :)


All times are GMT -6. The time now is 09:40 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI