Go Back   EQ2Flames Forum > Information and Resources > EQ2 Fan Site and Resource Provider Forums > Advanced Combat Tracker Forum

Reply
 
LinkBack (2) Thread Tools Search this Thread
Old 03-24-2008, 11:17 PM  
Purple Monkey
 
Character: Kalirasha
Guild: Clan Lynx
Server: Steamfont

Posts: 9
Photos: (14)

Default Graphing from ODBC exports

Quote:
Originally Posted by Pinski View Post
Anyway you'd be willing to part with your code to allow others to host their own site and/or tweak the code to their own liking?
I got a little frustrated with screen shotting parses for posting today so here's part of my solution.

Assuming that you can grok the included MySQL PHP Templates in ACT that Aditu was so kind to provide and that you grok how to do ODBC exports to MySQL, I stumbled across a simple (and free) graphing solution for making parses pretty. Like this (names changed to Anon to protect the innocent!):



The graphing package used is available here: PHPGraphLib Lightweight PHP Graphing Library

The files should be extracted in the same location as the sample ACT files (or you'll need to change the path). A new file should be created named combatant_graph.php (for consistency, though truly, the name doesn't matter). The combatant_graph.php creates a png image, so in order to display it, you need to use image tags. In other words, if you wanted it to show here:

HTML Code:
[img]http://www.yoursite.com/path/to/ACT/files/combatant_graph.php[/img]
Note that the above will simply graph the latest parse in your database. In order to do a specific encounter with a restricted number of particpants, it would be something like:

HTML Code:
[img]http://www.yoursite.com/path/to/ACT/files/combatant_graph.php?encid=12345678&count=6[/img]
The file is set up to grab and graph the latest exported parse if you don't specify an encounter ID (encid). The encid is the same that ACT uses.

The actual content of the file (combatant_graph.php) that generates the image:
PHP Code:
<?php

include 'actdb.php';
include 
'phpgraphlib.php';

//If encid is not specified, get latest encounter.
if(!isset($_GET['encid']))
{
    
$query "SELECT encid FROM encounter_table ORDER BY endtime DESC LIMIT 1";
    
$result mysql_query($query);
    
$row mysql_fetch_row($result);
    
$encid $row[0];
}
else
    
$encid mysql_real_escape_string$_GET['encid'] );

//count is number of people to be graphed. Usually doesn't need to be used unless there are oddities with ally detection.
if(!isset($_GET['count']))
    
$count 24;
else
    
$count mysql_real_escape_string$_GET['count'] );

$query "SELECT name,extdps,exthps FROM combatant_table WHERE encid = '$encid' AND ally = 'T'";
$query .= " ORDER BY extdps + exthps DESC";
$query .= " LIMIT $count";

$result mysql_query($query);

$data = array();
$data2 = array();
$data3 = array();

while(
$row mysql_fetch_row($result))
{
    
$name $row[0];
    
$extdps $row[1];
    
$exthps $row[2];
    
$data[$name] = $extdps;
    
$data2[$name] = $exthps;
    
$data3[$name] = $exthps $extdps;
}

$query "SELECT title,starttime FROM encounter_table WHERE encid = '$encid' LIMIT 1";

$result mysql_query($query);
$row mysql_fetch_row($result);
$title $row[0] . " " substr($row[1],0,10);

$graph = new PHPGraphLib(800,300);
$graph->addData($data,$data2,$data3);
$graph->setTitle($title);
$graph->setTitleColor("white");
$graph->setupXAxis(28,"white");
$graph->setupyAxis("","white");
$graph->setGradient("200,0,0""100,0,0""0,200,0""0,100,0""64,64,64""black");
$graph->setBarOutline(false);
$graph->setBackgroundColor("122,119,114");
$graph->setTextColor("white");
$graph->setLegend(true);
$graph->setLegendTitle("Damage""Healed""Total");
$graph->setLegendColor("114,122,122");
$graph->setLegendTextColor("white");
$graph->createGraph();

?>
I'll probably clean this up a bit more over the next few days, if anyone is interested or needs a feature or what have you.
Garth is online now   Reply With Quote
Old 03-25-2008, 08:26 AM  
Visitor
 
Character: Acquisitor
Server: Vox

Posts: 30
Photos: (0)

Default Re: Graphing from ODBC exports

Your welcome to registar at EQ2.ca Real Life Quest and try implementing your graphing solution with the code that is working although it already has a working graphing solution courtesy of Coerelius of Kithicor.
rtwodeetwo is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
Trackbacks are Off
Pingbacks are Off
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.EQ2Flames.com/advanced-combat-tracker-forum/23055-graphing-odbc-exports.html
Posted By For Type Date
EQ2Flames Forum This thread Refback 03-28-2008 11:52 PM
Graphing from ODBC exports - EQ2Flames Forum This thread Refback 03-28-2008 11:52 PM

Sponsor Ads


All times are GMT -4. The time now is 03:09 PM.


Design By: Miner Skinz.com Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0