Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
Donovan
Client



Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Tue Mar 03, 2009 10:17 am Reply with quote

I have this graph that I am STILL working on.

I made an array and am loading data into it. I want to then extract the data and use this data to graph.

The count of descriminator values is on the Y axis and the ranges are the X axis.

Here is what the array looks like.

Code:
$data = array("nP4_nP31" => array(

   
      "range" => "-.4 to -.31",   
      "descri" => 0),     
      
                  "nP3_nP21" => array(   
      "range" => "-.3 to -.21",   
      "descri" => 0),
 
                  "nP2_nP11" => array( 
      "range" => "-.2 to -.11",   
      "descri" => 0),
 
                  "nP1_nP01" => array( 
      "range" => "-.1 to -.01",   
      "descri" => 0),
    
                 "P0_P10" => array( 
      "range" => ".0 to .10",   
      "descri" => 0),
    
                 "P11_P20" => array( 
      "range" => ".11 to .20",   
      "descri" => 0),
    
                 "P21_P30" => array( 
      "range" => ".21 to .30",   
      "descri" => 0),
    
                 "P31_P40" => array( 
      "range" => ".31 to .40",   
      "descri" => 0),
    
                 "P41_P50" => array( 
      "range" => ".41 to .50",   
      "descri" => 0),
    
                 "P51_P60" => array( 
      "range" => ".51 to .60",   
      "descri" => 0),
    
                 "P61_P70" => array( 
      "range" => ".61 to .70",   
      "descri" => 0),
    
                 "P71_P80" => array( 
      "range" => ".71 to .80",   
      "descri" => 0),
    
                 "P81_P90" => array( 
      "range" => ".81 to .90",   
      "descri" => 0),     
 
      );


I know how to populate the discri_data but how do I load the range_data with these values

.81 to .90


Code:
$chart = $db->sql_query("SELECT `discri` FROM question_stats WHERE quiz_id = '$qid' ORDER BY `discri`");    

while( $row = $db->sql_fetchrow($chart)) {   
    $discri = $row['discri'];     
   
if ($discri >= -.40 AND $discri <= -.31){
$discri_data['nP4_nP31']['descri'] += 1;
$range_data['nP4_nP31']['range'] = ;
}
 
View user's profile Send private message Visit poster's website ICQ Number
Donovan







PostPosted: Tue Mar 03, 2009 10:55 am Reply with quote

If this...

Code:
$range_data = (array_keys($discri_data));


echo"<pre>";
print_r ($range_data);
echo"</pre>";
die();



gives me


Quote:
Array
(
[0] => nP2_nP11
[1] => nP1_nP01
[2] => P0_P10
[3] => P11_P20
[4] => P21_P30
[5] => P31_P40
[6] => P41_P50
[7] => P51_P60
)


Then I don't understand why I can't get these values.

Code:
foreach ($range_data as $key => $range){

    $ranges[] = $range;   
}


I need to do this $x->set_labels($ranges);

So that $ranges is displayed as my X axis.
 
eldorado
Involved
Involved



Joined: Sep 10, 2008
Posts: 424
Location: France,Translator

PostPosted: Sat Aug 15, 2009 7:26 am Reply with quote

*bump*
have you resolved this? I'm having some issues with two-dimensional array.
here is the example of what i'm talking about
Code:
$SKILL_ID = array (

'a touch of guile'=>2357,
'accumulated pain'=>1052,
'aegis (pve)'=>257,
'aegis (pvp)'=>2857,
'aftershock'=>174,
'aggressive refrain'=>1774,
'agonizing chop'=>1403,
'agony (pve)'=>2205,...}

Code:
$SKILL_ARRAY = array (

2993=>
array (
'name'=>'Predatory Bond (PvP)',
'chapter'=>2,
'profession'=>'Ranger',
'prof'=>'R',
'attribute'=>'Beast Mastery',
'attr'=>'bea',
'type'=>'Shout',
'ty'=>'sh',
'energy'=>10,
'adrenaline'=>0,
'eregen'=>0,
'sacrifice'=>0,
'casting'=>0,
'recharge'=>30,
'pve_only'=>0,
'elite'=>0,
'desc'=>'For 5..20 seconds, attacks by your animal companion heal you for 1..31 Health.',
'name_id'=>'predatory bond (pvp)',
),...

for example , I would like to be able to search for specific attribute in the array. eg. , create a search box in which I can search for 10 'energy' and it gives me a list of the skills with 10 'energy'.
I already know how to search for 'name'
would be this
Code:


/*search form above which returns a value for $skill , e.g. $skill = $SKILL_ID['a touch of guile'];// $skill=2357; /*
foreach($SKILL_ARRAY[$skill] as $cle=>$valeur)
    {
    echo $cle.' : '.$valeur.'<br>';
    }

which returns
Quote:
name : A Touch of Guile
chapter : 4
profession : No Profession
prof : ?
attribute : Norn rank
attr : nor
type : Hex Spell
ty : he
energy : 5
adrenaline : 0
eregen : 0
sacrifice : 0
casting : 0.75
recharge : 15
pve_only : 1
elite : 0
desc : Target touched foe takes 44..80 damage. If target foe was knocked down, that foe cannot attack for 5..8 seconds.
name_id : a touch of guile

...i hate arrays

_________________
Only registered users can see links on this board! Get registered or login! (My RN site)- Only registered users can see links on this board! Get registered or login!(cod4 clan) - Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©