ChartDirector Ver 3.1 (PHP Edition Edition)

DrawArea.hCylinderTransform


Usage

hCylinderTransform(yDiameter[, bgColor[, filter[, blur ]]])

Description

Wrap the drawing surface onto a horizontal cylinder.

Arguments

ArgumentDefaultDescription
yDiameter(Mandatory)The diameter of the cylinder in pixels.
bgColorFFFFFFThe background color used to fill the space left after transformation.
filterLinearFilterThe filter to use for re-sampling.
blur1The blur factor to use for re-sampling.

Return Value

None


cting as a handle to the gradient color. The handle can be used in any ChartDirector API that expects a color as an argument.

artDirector comes from several pre-defined gradient color arrays as follows.

NameValue (in hex numbers)
goldGradient 000000, FFE743, 000060, FFFFE0, 0000B0, FFF0B0, 000100, FFE743
silverGradient 000000, C8C8C8, 000060, F8F8F8, 0000B0, E0E0E0, 000100, C8C8C8
redMetalGradient 000000, E09898, 000060, FFF0F0, 0000B0, F0D8D8, 000100, E09898
greenMetalGradient 000000, 98E098, 000060, F0FFF0, 0000B0, D8F0D8, 000100, 98E098
blueMetalGradient 000000, 9898E0, 000060, F0F0FF, 0000B0, D8D8F0, 000100, 9898E0

Arguments

ArgumentDefaultDescription
colorArray(Mandatory)An array defining the positions and colors of the pixels along the gradient line.
angle90The direction of the gradient line segment in degrees, measured clockwise, with 0 degree as the upward pointing direction. The default direction is horizontal from left to right (90 degrees).
scale1.0The scaling factor for the gradient line segment. By default, the gradient line segment is 256 pixels in length. The scaling factor can be use to stretch or compress the gradient line segment.
startX0The x coordinate of the starting point of the gradient line segment.
startY0The y coordinate of the starting point of the gradient line segment.

Return Value

Return a 32-bit integer acting as a handle to the gradient color. The handle can be used in any ChartDirector API that expects a color as an argument.


bj = $c->setPlotArea(100, 25, 450, 150); $plotAreaObj->setGridColor(0xc0c0c0, 0xc0c0c0); #Add a legend box (92, 0) (top of plot area) using horizontal layout. Use 8 pts #Arial font. Disable bounding box (set border to transparent). $legendObj = $c->addLegend(92, 0, false, "", 8); $legendObj->setBackground(Transparent); #Add a title to the y axis. Draw the title upright (font angle = 0) $titleObj = $c->yAxis->setTitle("Average\nUtilization\n(MBytes)"); $titleObj->setFontAngle(0); #Use manually scaling of y axis from 0 to 100, with ticks every 10 units $c->yAxis->setLinearScale(0, 100, 10); #Set the labels on the x axis $c->xAxis->setLabels2($labels); #Set the title on the x axis $c->xAxis->setTitle("Jun - 2001"); #Add x axis (vertical) zones to indicate Saturdays and Sundays for($i = 0; $i < 29; $i += 7) { $c->xAxis->addZone($i, $i + 2, 0xc0c0c0); } #Add a line layer to the chart $layer = $c->addLineLayer(); #Set the default line width to 2 pixels $layer->setLineWidth(2); #Add the three data sets to the line layer $layer->addDataSet($data0, 0xcf4040, "Server #1"); $layer->addDataSet($data1, 0x40cf40, "Server #2"); $layer->addDataSet($data2, 0x4040cf, "Server #3"); #Layout the chart to fix the y axis scaling. We can then use getXCoor and #getYCoor to determine the position of custom objects. $c->layout(); #Add the "week n" custom text boxes at the top of the plot area. for($i = 0; $i < 4; ++$i) { #Add the "week n" text box using 8 pt Arial font with top center alignment. $textbox = $c->addText($layer->getXCoor($i * 7 + 2), 25, "Week $i", "arialbd.ttf", 8, 0x0, TopCenter); #Set the box width to cover five days $textbox->setSize($layer->getXCoor($i * 7 + 7) - $layer->getXCoor($i * 7 + 2 ) + 1, 0); #Set box background to pale yellow 0xffff80, with a 1 pixel 3D border $textbox->setBackground(0xffff80, Transparent, 1); } #output the chart header("Content-type: image/png"); print($c->makeChart2(PNG)); ?>

bels. In this example, the labels must be Jan - Dec. $labels = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"); $c->xAxis->setLabels($labels); #Set the x-axis width to 2 pixels $c->xAxis->setWidth(2); #Set the y axis title $c->yAxis->setTitle("USD (K)"); #Set the y-axis width to 2 pixels $c->yAxis->setWidth(2); #Output the chart header("Content-type: image/png"); print($c->makeChart2(PNG)); ?>
[File: phpdemo/dbdemo2b.php".]
<?php require_once("../lib/phpchartdir.php"); # #Retrieve the data from the query parameters # if (isset($HTTP_GET_VARS["year"])) $SelectedYear = $HTTP_GET_VARS["year"]; else $SelectedYear = 2001; $software = split(",", $HTTP_GET_VARS["software"]); $hardware = split(",", $HTTP_GET_VARS["hardware"]); $services = split(",", $HTTP_GET_VARS["services"]); # #Now we obtain the data into arrays, we can start to draw the chart #using ChartDirector # #Create a XYChart of size 420 pixels x 240 pixels $c = new XYChart(420, 240); #Set the chart background to pale yellow (0xffffc0) with a 2 pixel 3D border $c->setBackground(0xffffc0, 0xffffc0, 2); #Set the plotarea at (70, 50) and of size 320 x 150 pixels. Set background #color to white (0xffffff). Enable both horizontal and vertical grids by #setting their colors to light grey (0xc0c0c0) $c->setPlotArea(70, 50, 320, 150, 0xffffff, 0xffffff, 0xc0c0c0, 0xc0c0c0); #Add a title to the chart $title = $c->addTitle("Revenue for " . $SelectedYear, "timesbi.ttf"); $title->setBackground(0xffff00); #Add a legend box at the top of the plotarea $legend = $c->addLegend(70, 30, 0, "", 8); $legend->setBackground(Transparent); #Add a line chart layer using the supplied data $layer = $c->addLineLayer2(); $dataSet = $layer->addDataSet($software, -1, "Software"); $dataSet->setLineWidth(3); $dataSet = $layer->addDataSet($hardware, -1, "Hardware"); $dataSet->setLineWidth(3); $dataSet = $layer->addDataSet($services, -1, "Services"); $dataSet->setLineWidth(3); $layer->setBorderColor(Transparent, 1); #Set the x axis labels. In this example, the labels must be Jan - Dec. $labels = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"); $c->xAxis->setLabels($labels); #Set the x-axis width to 2 pixels $c->xAxis->setWidth(2); #Set the y axis title $c->yAxis->setTitle("USD (K)"); #Set the y-axis width to 2 pixels $c->yAxis->setWidth(2); #Output the chart header("Content-type: image/png"); print($c->makeChart2(PNG)); ?>


ved using Box.getImageCoor. This allows <AREA> tags for TextBox objects be created easily.

(For TextBox, there is no "getHTMLImageMap" method. It is because each TextBox object only has one hot spot. It is more convenient to enter the handler URL and tool tip text directly into the <AREA> tag, rather than generating them using getHTMLImageMap.)

In this example, the image map coordinates of the chart title, vertical mark label, and the copyright message are obtained using Box.getImageCoor:

$titleCoor = $title->getImageCoor(); $markCoor = $mark->getImageCoor(); $copyRightCoor = $copyRight->getImageCoor();

The image map coordinates are then used to make <AREA> tags as follows:

<area <?php echo $titleCoor?> href='javascript:doSomething();' title='The title is clickable!'> <area <?php echo $markCoor?> href='javascript:doSomething();' title='The "Merge with Star Tech" text is clickable!'> <area <?php echo $copyRightCoor?> href='javascript:doSomething();' title='The copyright text is clickable!'>


01', '959', '1018', '1102');