JpGraph Community
September 08, 2010, 12:37:47 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1] 2 3 ... 10
 1 
 on: September 04, 2010, 04:57:01 am 
Started by tsx11 - Last post by tsx11

I looked at the code and found the answer....

You can access the secondary Y2 axis because its a public member.

I did it like this:
Code:
$graph->AddY2($totalPlot);
$graph->y2axis->HideLabels(true);
*poof* labels gone!

HTH

 2 
 on: September 02, 2010, 10:15:57 am 
Started by james555 - Last post by james555
if I hard code an xaxis array such as $datax=array("Jan","Feb","Mar","Apr","May","June"); it works fine.  But I'm trying to bring in an array from the querystring such as state[]=33004&state[]=33009

So I run a foreach against the querystring to get the state data like so:
Code:


foreach($_GET['state'] as $myrs ) {
//echo $myrs ;
$states = $states."\"".$myrs."\","; 
}
$states = rtrim($states, ",");

But when I try to add it that array to the xaxis using:
$graph->xaxis->SetTickLabels($states);

It will display " 3 3 0 0 4 " with the quote and each number showing up on each individual tick.  so " for bar one, 3 for bar two, etc.  rather than 33004 for bar1, 33009 for bar2

Does that make sense? 

What am I doing wrong in the Querystring array that should be working the same way as my hard coded test array.  Same formatting.  I don't get it.

Any help is appreciated!

 3 
 on: September 02, 2010, 07:23:11 am 
Started by euphoria - Last post by euphoria
Oh so its a PHP issue Sad that isn't good as I cannot go back.  Oh well I will have to explain it and change the label.

Thanks anyway

 4 
 on: September 02, 2010, 01:22:46 am 
Started by euphoria - Last post by paulcrawford
You simply need to go back to php 5.2.11 and all will be fine

 5 
 on: September 02, 2010, 12:29:20 am 
Started by tsx11 - Last post by tsx11
Hi,

I searched the forum but couldn't find exactly what I was looking for; apologies if this is a common question.

What I'm trying to achieve is a BarPlot that has monthly data in it, and the background of the graph is the cumulative total (I added a format function that looks for the "max" of the dataset so a label will be displayed for the maximum value). Because I have the "cumulative total" in the graph, I'd like to eliminate the Y-Axis labels.

I have seen the sample code where you can access the different Y-axis directly (the $graph->yaxis array), but it looks like this is only the case for multiple LinePlots, perhaps? Because I use AddY2() to insert the other graph, I would think that I would need to somehow use an access function to turn the second axis off.

Does anyone have a suggestion?

Here's my code:

Code:
    // Create the graph. These two calls are always required
    $graph = new Graph(300,300,'auto',1);
    $graph->SetScale("textlin");
    $graph->setY2Scale('lin');

    $graph->SetShadow();
    $graph->img->SetMargin(40,30,30,40);
    $graph->img->SetTransparent("white");
   

    // Create the bar plots
    $b1plot = new BarPlot($webData);
    $b1plot->SetFillGradient('AntiqueWhite2','red',GRAD_VERT);
    $b1plot->SetColor("darkred");

    //Add to the graph
    $graph->Add($b1plot);

    //add the line chart
    $totalPlot = new LinePlot($webDataTotal);
    $totalPlot->SetColor("green:1.8");
    $totalPlot->SetFillColor("green@0.8");
    $totalPlot->SetBarCenter(true);

    $totalPlot->value->Show(true);
    $totalPlot->value->SetFormatCallback('formatFuncWeb');

    //Add the cumulative total to the graph
    $graph->AddY2($totalPlot);

    //I would like to turn off/hide/etc. the Y2 Axis here...


    $graph->legend->SetColumns(2);
    $graph->legend->Pos(0.5, 0.01);

//Make it pretty
    $graph->title->SetFont(FF_GEORGIA,FS_NORMAL,10);
    $graph->yaxis->title->SetFont(FF_GEORGIA, FS_NORMAL);
    $graph->xaxis->title->SetFont(FF_GEORGIA,FS_NORMAL);

    $graph->yaxis->SetFont(FF_GEORGIA,FS_NORMAL,8);
    $graph->xaxis->SetFont(FF_GEORGIA,FS_NORMAL,8);


    $graph->Stroke();


 6 
 on: September 01, 2010, 11:43:34 am 
Started by jarda_dis - Last post by jarda_dis
Greate!!!! Thanks a lot

 7 
 on: September 01, 2010, 11:25:46 am 
Started by jarda_dis - Last post by Yosko
Oh sorry, I forgot to put the whole code.

I had the same problem and my solution was :
  • Create a table of color, calculated from the values table
  • Use this table as fill color

This should be the right code :
Code:
<?php

$myBarPlot 
= new BarPlot($values);

foreach(
$values as $value) {

if($value 400) {
$colors[] = 'blue';
} else if($value 500) {
$colors[] = 'green';
} else {
$colors[] = 'red';
}
}

$myBarPlot->SetFillColor($colors);

?>

 8 
 on: September 01, 2010, 09:46:39 am 
Started by euphoria - Last post by euphoria
Hi all,

I am fairly new to jpGraph and therefore this forum.  Whilst I have found the component great I am struggling with what should be a simple problem, but alas nothing is fixing it.

Basically when using text for the yAxis on my group bar plot it misaligns the text so it looks well a little bit wonky.  Its like it is aligning to the top of the font rather than the baseline, I have attached a screenshot of the issue.  I have tried a variety of text alignment properties and none of them appear to help, can anyone shed any light on this and possibly a way to fix it?

Here is the setup code I am using:

Code:
$graph = new Graph( 800, 400 );
$graph->SetScale("textlin");
$graph->SetMarginColor("#ffffff");
$graph->SetColor("silver");
$graph->SetMargin( 50, 20, 40, 45 );

$graph->xaxis->SetTickLabels( $graphDataMale['age'] );
$graph->xaxis->SetTickSide( SIDE_BOTTOM );
$graph->xaxis->SetTextTickInterval( 5, 0 );
$graph->xaxis->SetTitle( 'Age' );
$graph->yaxis->SetTitle( 'Number Of Sales' );
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->SetFont(FF_ARIAL, FS_NORMAL,8);
$graph->yaxis->SetFont(FF_ARIAL, FS_NORMAL,8);
$graph->xaxis->title->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->yaxis->title->SetFont(FF_ARIAL, FS_BOLD, 8);
$graph->xaxis->SetTitleMargin( 10 );
$graph->yaxis->SetTitleMargin( 40 );

// Set up the title for the graph
$graph->title->Set('Age / Gender');

$barPlot1 = new BarPlot( $graphDataMale['qty'] );
$barPlot2 = new BarPlot( $graphDataFemale['qty'] );
$barPlot1->SetFillColor( 'blue' );
$barPlot2->SetFillColor( 'red' );

$barPlot1->SetLegend( 'Males' );
$barPlot2->SetLegend( 'Females' );

$group = new GroupBarPlot( array($barPlot1, $barPlot2) );
$graph->Add( $group );
$graph->Stroke();

Many thanks

 9 
 on: September 01, 2010, 09:45:20 am 
Started by jarda_dis - Last post by jarda_dis
Thanks, but this way color of bar rotate in this defined colors.

I see that this my request will be problem  Embarrassed

 10 
 on: September 01, 2010, 07:48:07 am 
Started by DataMan - Last post by DataMan
I've been through the documentation and haven't found anything specific for including links.  Ideally, I would like to be able to provide specific links to X & Y Labels.  If the feature is already there, would appreciate a pointer to the method.  If not, any plans to include on future releases?

Thanks,

-DataMan

Pages: [1] 2 3 ... 10
Powered by MySQL Powered by PHP Powered by SMF 1.1.8 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.018 seconds with 16 queries.