hbar.php
Back to Chart Graphics
addTitle("Revenue Estimation - Year 2002", "Arial Bold Italic");
# 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(100, 30, 400, 200, Transparent, Transparent, Transparent, Transparent, Transparent);
# 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($data, $c->gradientColor(100, 0, 500, 0, 0x008000, 0xffffff));
# Swap the axis so that the bars are drawn horizontally
$c->swapXY(true);
# Set the bar gap to 10%
$layer->setBarGap(0.1);
# Use the format "US$ xxx millions" as the bar label
$layer->setAggregateLabelFormat("US\$ {value} millions");
# Set the bar label font to 10pt Times Bold Italic/dark red (0x663300)
$layer->setAggregateLabelStyle("Times New Roman Bold Italic", 10, 0x663300);
# Set the labels on the x axis
$textbox = $c->xAxis->setLabels($labels);
# Set the x axis label font to 10pt Arial Bold Italic
$textbox->setFontStyle("Arial Bold Italic");
$textbox->setFontSize(10);
# 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, Transparent);
# Output the chart
$viewer = new WebChartViewer("chart1");
$viewer->setChart($c, SVG);
# Include tool tip for the chart
$viewer->setImageMap($c->getHTMLImageMap("", "", "title='{xLabel}: US\${value} millions'"));
?>
Borderless Bar Chart
Borderless Bar Chart
renderHTML(); ?>