|
|
Page 1 of 1
|
[ 6 posts ] |
|
Author |
Message |
theodamien
Regular pChart user
Joined: Fri Feb 04, 2011 11:23 am Posts: 15
|
Bug in autoScale
Hi, I try to draw BarChart and PlotLineChart in the same graph, but it seems that the maximum Y scale value are not calculate properly. Note: I use the automatic scale. Can you help me please ?
|
Mon Feb 07, 2011 4:28 pm |
|
|
jean-damien
Site Admin
Joined: Thu Dec 02, 2010 2:31 pm Posts: 409 Location: France
|
Re: Bug in autoScale
Hi,
This looks strange I never seen this before. Can you confirm me that the pData data series are all defined and marked as drawable (eg not disabled) before calling the drawScale function?
Kind regards, JD.
|
Tue Feb 08, 2011 10:26 am |
|
|
theodamien
Regular pChart user
Joined: Fri Feb 04, 2011 11:23 am Posts: 15
|
Re: Bug in autoScale
Hi Jean-Damien. Please find below my code. Code: // Dataset definition $DataSet = new pData; $DataSet->addPoints($used,"Used"); $DataSet->setPalette("Used", array("R"=>250,"G"=>50,"B"=>50,"Alpha"=>80)); $DataSet->addPoints($free,"Free"); $DataSet->setPalette("Free", array("R"=>92,"G"=>224,"B"=>46,"Alpha"=>80)); $DataSet->addPoints($unconf,"Unconfigured"); $DataSet->setPalette("Unconfigured", array("R"=>255,"G"=>200,"B"=>0,"Alpha"=>80)); $DataSet->addPoints($abs,"Labels"); $DataSet->addPoints($total,"Total"); $DataSet->setPalette("Total", array("R"=>0,"G"=>0,"B"=>0,"Alpha"=>80)); $DataSet->addPoints($trend, "TrendLine"); $DataSet->setPalette("TrendLine", array("R"=>46,"G"=>151,"B"=>224,"Alpha"=>80));
$DataSet->setAxisName(0,"Util Size (Tera)"); $DataSet->setSerieDescription("Labels","Months"); $DataSet->setAbscissa("Labels");
/* Create the pChart object */ $myPicture = new pImage($X,$Y,$DataSet); /* Set the default font properties */ $myPicture->setFontProperties(array("FontName"=>"library/pChart2/fonts/tahoma.ttf","FontSize"=>8));
/* Draw the scale and the chart */ $myPicture->setGraphArea(50,30,$X,$Y - 65); /* Draw a rectangle */ $myPicture->drawFilledRectangle(50,30,$X,$Y - 65,array("R"=>255,"G"=>255,"B"=>255,"Alpha"=>20,"Dash"=>TRUE,"DashR"=>0,"DashG"=>0,"DashB"=>0,"BorderR"=>255,"BorderG"=>255,"BorderB"=>255));
$myPicture->drawScale(array("DrawSubTicks"=>TRUE,"Mode"=>SCALE_MODE_ADDALL_START0,"LabelRotation"=>45,"CycleBackground"=>TRUE,"DrawXLines"=>TRUE, "GridR"=>160,"GridG"=>160,"GridB"=>160));
$DataSet->setSerieDrawable("Total",FALSE); $DataSet->setSerieDrawable("TrendLine",FALSE);
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); $myPicture->drawStackedBarChart(array("DisplayValues"=>TRUE,"DisplayColor"=>DISPLAY_AUTO,"Gradient"=>TRUE,"Surrounding"=>30,"DisplayR"=>0,"DisplayG"=>0,"DisplayB"=>0,"DisplaySize"=>8)); //$myPicture->drawStackedBarChart(array("DisplayValues"=>TRUE,"DisplayColor"=>DISPLAY_AUTO,"Gradient"=>TRUE,"GradientMode"=>GRADIENT_EFFECT_CAN,"Surrounding"=>30)); $myPicture->setShadow(FALSE);
$DataSet->setSerieDrawable("Used",FALSE); $DataSet->setSerieDrawable("Free",FALSE); $DataSet->setSerieDrawable("Unconfigured",FALSE); $DataSet->setSerieDrawable("Total",TRUE); $DataSet->setSerieDrawable("TrendLine",TRUE);
/* Turn of Antialiasing */ $myPicture->Antialias = FALSE; /* Draw the line chart */ $myPicture->drawLineChart(); /* Turn on Antialiasing */ $myPicture->Antialias = TRUE; /* Draw the line chart */ $myPicture->drawPlotChart(array("BorderSize"=>1,"BorderAlpha"=>100,"PlotSize"=>3,"PlotBorder"=>FALSE,"DisplayValues"=>FALSE,"DisplayColor"=>DISPLAY_MAUAL));
$DataSet->setSerieDrawable("Used",TRUE); $DataSet->setSerieDrawable("Free",TRUE); $DataSet->setSerieDrawable("Unconfigured",TRUE); $DataSet->setSerieDrawable("Total",TRUE); $DataSet->setSerieDrawable("TrendLine",TRUE);
$myPicture->setShadow(TRUE,array("X"=>2,"Y"=>2,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); $Size = $myPicture->getLegendSize(array("Style"=>LEGEND_ROUND,"Mode"=>LEGEND_VERTICAL)); /* Write the chart legend */ $myPicture->drawLegend($X - $Size['Width'] - 4, $Y / 2 - $Size['Height'],array("Style"=>LEGEND_ROUND,"Mode"=>LEGEND_VERTICAL,"R"=>255,"G"=>255,"B"=>255,"Alpha"=>100));
/* Render the picture (choose the best way) */ $myPicture->autoOutput();
Yes, some pData data series are not drawable before calling DrawScale function, but when I changed calling position, I obtain a graph completely crush :
|
Tue Feb 08, 2011 11:58 am |
|
|
jean-damien
Site Admin
Joined: Thu Dec 02, 2010 2:31 pm Posts: 409 Location: France
|
Re: Bug in autoScale
I see, this is because you're mixing charting functions that use different scaling methods : SCALE_MODE_ADDALL fits for stacked charts only. When used, the scaling engine determine the max value of the chart by adding all the series values.
Only way to resolve your issue is to compute the chart max value by yourself and use a manual scale.
JD.
|
Tue Feb 08, 2011 12:05 pm |
|
|
theodamien
Regular pChart user
Joined: Fri Feb 04, 2011 11:23 am Posts: 15
|
Re: Bug in autoScale
Oky thanks Jean-Damien, I will try this workaround.
An automatic scaling method global to the chart will not be possible I suppose ?
|
Tue Feb 08, 2011 12:09 pm |
|
|
jean-damien
Site Admin
Joined: Thu Dec 02, 2010 2:31 pm Posts: 409 Location: France
|
Re: Bug in autoScale
The current drawing workflow needs that you first draw the scale before charting anything so the drawScale() function isn't aware of the kind of charts you'll draw over it.
There is no easy way to remove this limitation but if you have an idea, I'll be happy to work on it ;o)
JD.
|
Tue Feb 08, 2011 1:38 pm |
|
|
|
Page 1 of 1
|
[ 6 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 5 guests |
|
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 post attachments in this forum
|
|
|