21
tank1955
Re: X Basic Graphs
  • 2009/2/10 11:56

  • tank1955

  • Module Developer

  • Posts: 276

  • Since: 2007/9/7 1


Thanks Mamba. I am hoping to wrap things up and have a release prepared within the week. One question I have is since the zipped module is pretty large (6.5 Meg) do you think I should also build a package without the JPGraph user's manual included? Without the manual documentation the zipped module is (2.5 Meg).



22
tank1955
Re: X Basic Graphs
  • 2009/2/10 2:09

  • tank1955

  • Module Developer

  • Posts: 276

  • Since: 2007/9/7 1


I have proven my theory that data can be extracted from any database table including the core tables within the graph generating php file. In the first example I extracted data from another module's tables and then in the second example I extracted the user registration data from the core's user table.

You can see the examples displayed at X Basic Graphs

Here is what the code looks like for generating the number of new user registrations for the last 6 months:

include ("../../../../mainfile.php");
include (
XOOPS_ROOT_PATH."/modules/basicgraphs/class/xgraphs/jpgraph/jpgraph.php");
include (
XOOPS_ROOT_PATH."/modules/basicgraphs/class/xgraphs/jpgraph/jpgraph_bar.php");

global 
$xoopsDB;

$datay = array();
$datax = array();

// Get the data
$result $xoopsDB->query("SELECT * FROM ".$xoopsDB->prefix("users")." WHERE level > 0 ORDER BY user_regdate");

$regarray = array();

while (
$row $xoopsDB->fetcharray($result)) {
  
$registration_date $row['user_regdate'];
  
  
$tempDate $dateArray=explode(',',strftime("%Y,%m,%d,%I,%M,%p",time()));
  
$currentmonth = (int)$tempDate[1];
  
$currentyear $tempDate[0];

  
$startDate mktime(000date("m")-6date("d"),   date("Y"));
  
$tempDate $dateArray=explode(',',strftime("%Y,%m,%d,%I,%M,%p",$startDate));
  
$startmonth = (int)$tempDate[1];
  
$startyear $tempDate[0];

  
$tempDate $dateArray=explode(',',strftime("%Y,%m,%d,%I,%M,%p",$registration_date));
  
$month = (int)$tempDate[1];
  
$year $tempDate[0];
  if (
$year == $startyear && $month >= $startmonth) {
    
$regarray[$month $startmonth] = $regarray[$month $startmonth] + 1;
  }elseif (
$year $startyear) {
    
$regarray[(12 $startmonth) + $month] = $regarray[(12 $startmonth) + $month] + 1;
  }
}

$datay $regarray;

// Generate the month with year labels for the x axis
while ($count 7) {
  
$count++;
  
$labelDate mktime(000date("m")-(7-$count), date("d"),   date("Y"));
  
$tempDate $dateArray=explode(',',strftime("%Y,%m,%d,%I,%M,%p",$labelDate));
  
$tempDateString date('M Y'mktime(000$tempDate[1], $tempDate[2], $tempDate[0]));
  
$datax[] = $tempDateString;
}

// Create the graph. These two calls are always required
$graph = new Graph(500,300,"auto");    
$graph->SetScale("textlin");
$graph->yaxis->scale->SetGrace(30);

$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetLabelAngle(90);

// Add a drop shadow
$graph->SetShadow();

// Adjust the margin a bit to make more room for titles
$graph->img->SetMargin(50,50,40,100);
$graph->SetMarginColor('lightred');

// Create a bar pot
$bplot = new BarPlot($datay);

// Adjust fill color
$bplot->SetFillColor('darkred');
$bplot->value->Show();
$bplot->value->SetFormat('%d');
$graph->Add($bplot);

// Setup the titles
$graph->title->Set("New User Registration at CVD In Last 6 Months");
//$graph->xaxis->title->Set("Month");
$graph->yaxis->title->Set("Number of New Users");

$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);

// Display the graph
$graph->Stroke();



23
tank1955
Re: X Basic Graphs
  • 2009/2/9 18:10

  • tank1955

  • Module Developer

  • Posts: 276

  • Since: 2007/9/7 1


Thanks Mamba for the feedback.

To be honest I began development by just placing the JPGraphs library in the root /class/ directory. But this would then be considered a hack and then I was faced with where should the graph generating php files be placed. Creating X Basic Graphs module provides the advantage of storing the graph files in a central location as well as providing local access to the user's manual and the long list of examples available.

No matter where the data comes from it can easily be coded in the graph file and the image tag to display the graph can be placed anywhere throughout the site.

Plus I am sure after I release the first version there will be lots of feedback for improving it's functionality.



24
tank1955
X Basic Graphs
  • 2009/2/8 16:12

  • tank1955

  • Module Developer

  • Posts: 276

  • Since: 2007/9/7 1


I have been experimenting with adding JPGraph functionality into XOOPS sites. I believe I have finally figured out a good approach. At the top of my priority list was to keep it as simple as possible and avoid the need for any hacks.

We have created a module we call X Basic Graphs and we have the module prototype installed and functioning on the CVD site. The module contains the JPGraph library, coding examples and the JPGraph user's manual.

After installing the module you can set the group permissions for the module so only webmasters have access. You can then create graph php files in the module's graphs subdirectory and call these files in an image tag as the source definition from any module or block throughout the site.

Advantages of this approach are (1) No hacks to core code are required which is a good thing (2) JPGraph examples work right out of the box, no special translation to a different format required (3) Webmasters have easy access to all resource information for graph and chart creation.

Looking for feedback to ensure there is user interest before I take the time to prepare this as a downloadable package.



25
tank1955
Re: Any Progress on XoopsGraphs?
  • 2009/2/7 2:02

  • tank1955

  • Module Developer

  • Posts: 276

  • Since: 2007/9/7 1


XoopsGraphs shows a great deal of promise and I am continuing development assistance to Wishcraft but this prompted me to consider if there might be a simpler approach. As an experiment I am building a different prototype called XGraphs which I will be releasing for review. The basic structure will be to use JPGraph right out of the box without additions. Along with the JPGraph library an example module will be provided that can be used by developers as a base for building their own module creation. To see the status of this development you can visit Custom Virtual Designs



26
tank1955
Re: VideoTube. Missing buttons in User View
  • 2009/2/5 23:43

  • tank1955

  • Module Developer

  • Posts: 276

  • Since: 2007/9/7 1


Thanks peekay,
Your fix for the buttons in User View will be added to the next release. And you are correct, the rating button is still under development and will also be available in the next release.



27
tank1955
Re: Any Progress on XoopsGraphs?
  • 2009/2/4 1:49

  • tank1955

  • Module Developer

  • Posts: 276

  • Since: 2007/9/7 1


Here are a few more graph and image examples which were recently completed.

Resized Image



28
tank1955
Re: Any Progress on XoopsGraphs?
  • 2009/1/30 2:43

  • tank1955

  • Module Developer

  • Posts: 276

  • Since: 2007/9/7 1


Thanks wishcraft. I have installed the XoopsGraphs Demo at Custom Virtual Designs. For those who are interested in seeing the progress you can visit here.

We just got the Gantt Chart working and I believe examples such as this show the real power of JPGraph.



29
tank1955
Fix For Missing Table Row Tag VideoTube v1.84
  • 2009/1/27 2:39

  • tank1955

  • Module Developer

  • Posts: 276

  • Since: 2007/9/7 1


A bug was reported in VideoTube v1.84 that causes right blocks to display twice. This only seems to affect certain themes and when video display format is set to 4-column.

The index.php file tracks the video thumbnail placement by assigning table cell numbers and row numbers to each thumbnail. When this data is passed to the video_display.html template, the template uses these assignments to determine where to place the <tr> and </tr> tags.

First open the modules/videotube/index.php file. Go to line 1049 and you will see the following code:

$video_array['rownum']=$rownum;
              
  
// Pass the video thumbnail information to the template
  
  
$xoopsTpl->append('videos'$video_array);


Now comment out the video row assignment line by placing two forward slashes at the start of the line. After your changes the code should look like this:

//$video_array['rownum']=$rownum;
              
  // Pass the video thumbnail information to the template
  
  
$xoopsTpl->append('videos'$video_array);


Next go to line 977 in the same file. You will see the following code:

while ($row $xoopsDB->fetcharray($result)) {
    
$postnum++;
    
$video_array['toprow']=$toprow;
    
$video_array['postnum']=$postnum;
    
$video_array['ref'] = $row['id'];


Now insert a new line containing the video row assignment. After your changes the code should look like this:

while ($row $xoopsDB->fetcharray($result)) {
    
$postnum++;
    
$video_array['toprow']=$toprow;
    
$video_array['postnum']=$postnum;
    
$video_array['rownum']=$rownum;
    
$video_array['ref'] = $row['id'];


This should take care of the missing tag issue.



30
tank1955
Any Progress on XoopsGraphs?
  • 2009/1/25 18:18

  • tank1955

  • Module Developer

  • Posts: 276

  • Since: 2007/9/7 1


Can anyone tell me if there has been any progress on XoopsGraphs since the prototype release last year? I have downloaded the Prototype and have had to make several modifications in order to get certain jpgraph features working.

Here is a screenshot to show some examples of what we have managed to accomplish so far.

Resized Image




TopTop
« 1 2 (3) 4 5 6 ... 11 »



Login

Who's Online

150 user(s) are online (108 user(s) are browsing Support Forums)


Members: 0


Guests: 150


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