11
tank1955
Re: XoopsGraphs - Prototype for 3.0 release available!
  • 2009/1/22 2:58

  • tank1955

  • Module Developer

  • Posts: 276

  • Since: 2007/9/7 1


I recently received a client request to build a custom module incorporating jpgraph so I downloaded the latest development you created for a test run. Everything works great that I have tried so far. Very impressive work Wishcraft. Thanks so much for all of your hard work.

12
tank1955
Re: XoopsGraphs - Prototype for 3.0 release available!
  • 2009/1/24 18:15

  • tank1955

  • Module Developer

  • Posts: 276

  • Since: 2007/9/7 1


I realize this thread is several months old so someone may have already discovered and corrected the items I have found but I thought I would report it anyway.

I found some functions that didn't work properly such as adding title to an axis and adding tick labels.

The problems I found were in /class/graphs/graphjpgraph.php

The first problem was in the function set_options_element_b. The following code contains my modifications:

function set_options_element_b ($graph$option_element$element) {
  if (
is_object($graph)){
    if (!empty(
$option_element)){
      foreach (
$option_element as  $key => $value){
    
$this->set_object_func($graph$element$key$value);
      }
    }
  }
  return 
$graph;
}


The other problem was located in the function set_object_func. The comparison to determine if the passed $value parameter is an array was insufficient. An additional comparison was necessary to determine if the $value parameter was actually an associative array.

Here is the additional function I added:

function is_associative(&$array) {
  
$next 0;
  foreach (
$array as $k=>$v) {
    if (
$k !== $next)
      return 
true;
    
$next++;
  }
  return 
false;
}


Then in the third line of the set_object_func function the additional comparison was added for this situation.

function set_object_func($obj$subelem$finalele$value){
    
                if (
is_object($obj)){
                    if (
is_array($value)&&!in_array($finalele,$this->get_func_that_array())){
                        if (!
$this->is_associative($value)&&!is_array($value[0])&&!is_array($value[1])&&!is_array($value[2])&&!is_array($value[3])&&!is_array($value[4])&&!is_array($value[5])&&!is_array($value[6])&&!is_array($value[7])){

.....


Now everything appears to be working but lots more testing to be done.

Login

Who's Online

236 user(s) are online (156 user(s) are browsing Support Forums)


Members: 0


Guests: 236


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits