|
Line chart : hidden axis |
Posted by Jacques Terrettaz on Oct-23-2011 17:02 |
|
Hello,
I have some problem hiding completely X and Y-axis in a "sparkline-like" chart.
By using Transparent color, the axis by itself is not visible, but if a line or symbol is
crossing the axis, the axis becomes "visible" under the line (broken line) or symbol - see
the attached image : zoom view of the sparkline chart.
Is there a way to draw the line and symbol over the transparent axis ?
Here is my code :
$c = new XYChart(200, 60);
$c->setPlotArea(1, 1, 195, 55, 0xffffff, 0xffffff, 0xffffff, 0xffffff,0xffffff );
$c->setTransparentColor(0xFFFFFf);
.....
$maxlayer = $c->addScatterLayer($data[0], $tmpArrayMath1-
>result(),"",CircleShape,6,0x00ff0000); //red symbol for max value
$maxlayer->setDataLabelFormat("{value}");
$maxlayer->setDataLabelStyle("", 6, 0xff0000);
$minlayer = $c->addScatterLayer($data[0], $tmpArrayMath2-
>result(),"",CircleShape,6,0x000000ff); //blue symbol for min value
$minlayer->setDataLabelFormat("{value}");
$minlayer->setDataLabelStyle("", 6, 0x0000ff);
$layer0 = $c->addLineLayer2();
$layer0->addDataSet($data[1],$c->yZoneColor(0,0xff,0x00ff0000),"");
$layer0->setXData($data[0]);
$layer0->setLineWidth(1);
.......
$c->yAxis->setLinearScale($mintemp,$maxtemp+$tick, $tick);
$c->xAxis->setColors(Transparent,Transparent,Transparent,Transparent);
$c->yAxis->setColors(Transparent,Transparent,Transparent,Transparent);
# output the chart
header("Content-type: image/png");
print($c->makeChart2(PNG));
|
Re: Line chart : hidden axis |
Posted by Peter Kwan on Oct-25-2011 02:49 |
|
Hi Jacques,
The axis is already hidden. The line you see is the plot area border. To remove the line, please change:
$c->setPlotArea(1, 1, 195, 55, 0xffffff, 0xffffff, 0xffffff, 0xffffff,0xffffff );
to
$c->setPlotArea(1, 1, 195, 55, Transparent, Transparent, Transparent, Transparent, Transparent);
Hope this can help.
Regards
Peter Kwan |
Re: Line chart : hidden axis |
Posted by Jacques Terrettaz on Oct-25-2011 03:37 |
|
Thank you Peter.
You are right, it was the plot area border and not the axis!
The chart are OK now : http://meteo-sciez.com |
|