Ver Mensaje Individual
  #9 (permalink)  
Antiguo 23/12/2009, 12:58
greisy
 
Fecha de Ingreso: junio-2006
Mensajes: 330
Antigüedad: 17 años, 10 meses
Puntos: 4
Respuesta: Gráficos: Aplicar color a barras de libchart

Ya tengo el gráfico y se crea perfectamente:

Código PHP:
require_once("class/chartdirector/phpchartdir.php");
            
#Creación del objeto XYChart de tamaño 600 x 250 pixels
$c = new XYChart(1000450);
            
#Agregar titulo utilizando fuente Arial Bold Italic
$c->addTitle("PRUEBA""impact.ttf"20);
            
# Set the plotarea at (100, 30) and of size 400 x 200 pixels. Set the plotarea
# border, background and grid lines to Transparent
$c->setPlotArea(350506003500xe8f0f8, -1Transparent$c->dashLineColor(0x888888,DotLine));
            
            
# Add a bar chart layer using the given data. Use a gradient color for the bars,
# where the gradient is from dark green (0x008000) to white (0xffffff)
$layer $c->addBarLayer($cm$c->gradientColor(350090000x0066cc0xffffff));
            
# Swap the axis so that the bars are drawn horizontally
$c->swapXY(true);
            
# Set the labels on the x axis
$textbox $c->xAxis->setLabels($nombre);

# Set the x axis label font to 10pt Arial Bold Italic
$textbox->setFontStyle("arial.ttf");
$textbox->setFontSize(8);
            
# Set the bar gap to 10%
$layer->setBarGap(0.3);
            
# Use the format "US$ xxx millions" as the bar label
$layer->setAggregateLabelFormat("{value} ({={value}/".$sumaTotalCmCol."*100|2.,}%)");
            
# Set the bar label font to 10 pts Times Bold Italic/dark red (0x663300)
$layer->setAggregateLabelStyle("arial.ttf"80x000000);
            
# Use soft lighting effect for the bars with light direction from left.
$layer->setBorderColor(TransparentsoftLighting(Left));
            
# Set the x axis to Transparent, with labels in dark red (0x663300)
$c->xAxis->setColors(Transparent0x663300);
            
# Set the y axis and labels to Transparent
$c->yAxis->setColors(Transparent0x663300);

# Output the chart
header("Content-type: image/png");
print(
$c->makeChart2(PNG)); 
Solo quiero saber como guardarla, porque en vez de colocar:

Código PHP:
# Output the chart
header("Content-type: image/png");
print(
$c->makeChart2(PNG)); 
coloqué:

Código PHP:
# Output the chart  
$c->makeChart("chart1.png"); 
y no me genera la imagen.