Quantcast
Drawing a Graph - WoWInterface
Thread Tools Display Modes
12-23-16, 09:59 AM   #1
Lolzen
An Aku'mai Servant
 
Lolzen's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 36
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!
  Reply With Quote
12-23-16, 06:44 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,964
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.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
12-24-16, 01:58 PM   #3
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 942
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()

Last edited by Ketho : 12-24-16 at 03:26 PM.
  Reply With Quote
12-24-16, 05:03 PM   #4
Lolzen
An Aku'mai Servant
 
Lolzen's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 36
Thanks for the input on both Line objects and LibGraph!

Now i have actually something to work with, thanks a ton!!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Drawing a Graph

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off