Solved

more than one plot

Posted on 2002-05-02
5
1,289 Views
Last Modified: 2012-06-27
what's wrong with the following code!

// Create a red line plot
$p1 = new LinePlot($datay);
$p1->SetColor("red");

// Create the 1st rate bar plot
$b1 = new BarPlot($databary1);
$b1->SetLegend("rate#1");
$b1->SetFillColor("orange");
$b1->SetAbsWidth(;

// Create the 2nd rate bar plot
$b2 = new BarPlot($databary2);
$b2->SetLegend("rate#2");
$b2->SetFillColor("Blue");
$b2->SetAbsWidth(;

// Create the 2nd rate bar plot
$b3 = new BarPlot($databary3);
$b3->SetLegend("rate#3");
$b3->SetFillColor("Yellow");
$b3->SetAbsWidth(;

// Drop shadow on bars adjust the default values a little bit
$b1->SetShadow("steelblue",2,2);
$b2->SetShadow("red",2,2);
$b3->SetShadow("Yellow",2,2);

// Create the grouped bar plot
$gbplot = new GroupBarPlot(array($p1,$b1,$b2,$b3));

then the stroke comes!

i can't find out what's wrong. i keep getting this msg:
JpGraph: Can't draw unspecified Y-scal.
you have either:
specified an Y axis for autoscaling but hanve not supplied any plots
specified a scale manually but have forgot to specify the tick steps

 
Maha
0
Comment
Question by:almaha
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:lokeshv
ID: 6987985
do some changes.

$gbplot= new GroupBarPlot(array($b1,$b2,b3));

then add ur group bar plot to ur graph

$graph->Add($gbplot);

//add ur line plot

$graph->Add($p1);


then ur stroke.


ope this helps..


LK
0
 

Author Comment

by:almaha
ID: 6989223
didn't work:(
any other solution?
i don't know what's wrong. i keep getting the same error msg:S
Maha
0
 
LVL 4

Expert Comment

by:lokeshv
ID: 6989415
can u post ur code here ?

lk
0
 

Author Comment

by:almaha
ID: 6989614
there is a problem in this example code i downloaded with the jpgraph libraries!
any solutions?

<?php
include ("../jpgraph.php");
include ("../jpgraph_line.php");
include ("../jpgraph_error.php");

$errdatay = array(11,9,2,4,19,26,13,19,7,12);
$datax=array("Jan","Feb","Mar","Apr","May");

// Create the graph. These two calls are always required
$graph = new Graph(300,200,"auto");
$graph->img->SetMargin(40,30,20,40);
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->xaxis->SetLabelAngle(0);
$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,10);
$graph->img->SetAntiAliasing("white");

// Create the linear plot
$errplot=new ErrorLinePlot($errdatay);
$errplot->SetColor("red");
$errplot->SetWeight(2);
$errplot->SetCenter();
$errplot->line->SetWeight(2);
$errplot->line->SetColor("blue");
$errplot->SetLegend("Min/Max");
$errplot->line->SetLegend("Average");
// Add the plot to the graph
$graph->Add($errplot);

$graph->title->Set("Example 16");
$graph->yaxis->title->Set("Y-title");
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->Set("X-title");
$graph->title->SetFont(FF_FONT1,FS_BOLD);

$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetTextTickInterval(2);

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

it's example16.php

Maha
0
 
LVL 4

Accepted Solution

by:
lokeshv earned 50 total points
ID: 6989673
ok i made some changes and tis working..

<?php
include ("../jpgraph.php");
include ("../jpgraph_line.php");
include ("../jpgraph_error.php");

$errdatay = array(11,9,2,4,19,26,13,19,7,12);
$datax=array("Jan","Feb","Mar","Apr","May");

// Create the graph. These two calls are always required
$graph = new Graph(1000,300);
$graph->img->SetMargin(40,30,20,40);
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->xaxis->SetLabelAngle(0);
//$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,10);
$graph->img->SetAntiAliasing("white");

// Create the linear plot
$errplot=new ErrorLinePlot($errdatay);
$errplot->SetColor("red");
$errplot->SetWeight(2);
$errplot->SetCenter();
$errplot->line->SetWeight(2);
$errplot->line->SetColor("blue");
$errplot->SetLegend("Min/Max");
$errplot->line->SetLegend("Average");
// Add the plot to the graph


$graph->title->Set("Example 16");
$graph->yaxis->title->Set("Y-title");
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->Set("X-title");
$graph->title->SetFont(FF_FONT1,FS_BOLD);

$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetTextTicks(2); //change here...
$graph->Add($errplot);
// Display the graph
$graph->Stroke();
?>


its working with 1.1...

hope this helps..

Lk
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now