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(1000, 450);
#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(350, 50, 600, 350, 0xe8f0f8, -1, Transparent, $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(350, 0, 900, 0, 0x0066cc, 0xffffff));
# 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", 8, 0x000000);
# Use soft lighting effect for the bars with light direction from left.
$layer->setBorderColor(Transparent, softLighting(Left));
# Set the x axis to Transparent, with labels in dark red (0x663300)
$c->xAxis->setColors(Transparent, 0x663300);
# Set the y axis and labels to Transparent
$c->yAxis->setColors(Transparent, 0x663300);
# 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.