本文整理汇总了PHP中ezcGraphColor::fromHex方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcGraphColor::fromHex方法的具体用法?PHP ezcGraphColor::fromHex怎么用?PHP ezcGraphColor::fromHex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcGraphColor
的用法示例。
在下文中一共展示了ezcGraphColor::fromHex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRenderHorizontalAxisReverse
public function testRenderHorizontalAxisReverse()
{
$chart = new ezcGraphLineChart();
$this->driver->expects($this->at(0))->method('drawLine')->with($this->equalTo(new ezcGraphCoordinate(450.0, 120.0), 1.0), $this->equalTo(new ezcGraphCoordinate(150.0, 120.0), 1.0), $this->equalTo(ezcGraphColor::fromHex('#2E3436')), $this->equalTo(1));
$this->driver->expects($this->at(1))->method('drawPolygon')->with($this->equalTo(array(new ezcGraphCoordinate(150.0, 120.0), new ezcGraphCoordinate(157.0, 116.5), new ezcGraphCoordinate(157.0, 123.5)), 1.0), $this->equalTo(ezcGraphColor::fromHex('#2E3436')), $this->equalTo(true));
$this->renderer->drawAxis(new ezcGraphBoundings(100, 20, 500, 220), new ezcGraphCoordinate(350, 100), new ezcGraphCoordinate(50, 100), $chart->yAxis);
}
示例2: __construct
/**
* Constructor
*
* @param array $options Default option array
* @return void
* @ignore
*/
public function __construct(array $options = array())
{
$this->properties['pieChartShadowSize'] = 0;
$this->properties['pieChartShadowTransparency'] = 0.3;
$this->properties['pieChartShadowColor'] = ezcGraphColor::fromHex('#000000');
parent::__construct($options);
}
示例3: __construct
/**
* Constructor
*
* @param array $options Default option array
* @return void
* @ignore
*/
public function __construct(array $options = array())
{
$this->properties['width'] = null;
$this->properties['height'] = null;
$this->properties['lineSpacing'] = 0.1;
$this->properties['shadeCircularArc'] = 0.5;
$this->properties['font'] = new ezcGraphFontOptions();
$this->properties['font']->color = ezcGraphColor::fromHex('#000000');
$this->properties['autoShortenString'] = true;
$this->properties['autoShortenStringPostFix'] = '..';
parent::__construct($options);
}
示例4: testRenderAxisNoInnerSteps
public function testRenderAxisNoInnerSteps()
{
$chart = new ezcGraphRadarChart();
$chart->palette = new ezcGraphPaletteBlack();
$chart->axis->axisLabelRenderer->innerStep = false;
$chart->axis->axisLabelRenderer->outerStep = true;
$chart->data['sampleData'] = new ezcGraphArrayDataSet(array('sample 1' => 234, 'sample 2' => 21, 'sample 3' => 324, 'sample 4' => 120, 'sample 5' => 1));
$mockedRenderer = $this->getMock('ezcGraphRenderer2d', array('drawStepRadar'));
$mockedRenderer->expects($this->at(0))->method('drawStepRadar')->with($this->equalTo(new ezcGraphCoordinate(204.0, 180.0), 1.0), $this->equalTo(new ezcGraphCoordinate(204.0, 183.0), 1.0), $this->equalTo(ezcGraphColor::fromHex('#EEEEEC')));
$mockedRenderer->expects($this->at(4))->method('drawStepRadar')->with($this->equalTo(new ezcGraphCoordinate(460.0, 180.0), 1.0), $this->equalTo(new ezcGraphCoordinate(460.0, 183.0), 1.0), $this->equalTo(ezcGraphColor::fromHex('#EEEEEC')));
$chart->renderer = $mockedRenderer;
$chart->render(500, 200);
}
示例5: drawDiamondBar
/**
* Draws a bar with a diamond ground shape.
*
* @param ezcGraphContext $context
* @param ezcGraphColor $color
* @param ezcGraphCoordinate $position
* @param float $barWidth
* @param float $offset
* @param float $axisPosition
* @param float $startDepth
* @param float $midDepth
* @param float $endDepth
* @return void
*/
protected function drawDiamondBar(ezcGraphContext $context, ezcGraphColor $color, ezcGraphCoordinate $position, $barWidth, $offset, $axisPosition, $startDepth, $midDepth, $endDepth)
{
$barCoordinateArray = array('x' => array($this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ($this->dataBoundings->x1 - ($this->dataBoundings->x0 + 2 * $this->xAxisSpace)) + $offset, $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ($this->dataBoundings->x1 - ($this->dataBoundings->x0 + 2 * $this->xAxisSpace)) + $offset + $barWidth * 0.7, $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ($this->dataBoundings->x1 - ($this->dataBoundings->x0 + 2 * $this->xAxisSpace)) + $offset + $barWidth, $this->dataBoundings->x0 + $this->xAxisSpace + $position->x * ($this->dataBoundings->x1 - ($this->dataBoundings->x0 + 2 * $this->xAxisSpace)) + $offset + $barWidth * 0.3), 'y' => array($this->dataBoundings->y0 + $this->yAxisSpace + $axisPosition * ($this->dataBoundings->y1 - ($this->dataBoundings->y0 + 2 * $this->yAxisSpace)), $this->dataBoundings->y0 + $this->yAxisSpace + $position->y * ($this->dataBoundings->y1 - ($this->dataBoundings->y0 + 2 * $this->yAxisSpace))));
// Left side
$this->barPostProcessing[] = array('index' => $barCoordinateArray['x'][0], 'method' => 'drawPolygon', 'context' => $context, 'parameters' => array(array($this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][0], $barCoordinateArray['y'][0]), $midDepth), $this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][0], $barCoordinateArray['y'][1]), $midDepth), $this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][1], $barCoordinateArray['y'][1]), $startDepth), $this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][1], $barCoordinateArray['y'][0]), $startDepth)), $color, true));
// Right side
$this->barPostProcessing[] = array('index' => $barCoordinateArray['x'][1], 'method' => 'drawPolygon', 'context' => $context, 'parameters' => array(array($this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][2], $barCoordinateArray['y'][0]), $midDepth), $this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][2], $barCoordinateArray['y'][1]), $midDepth), $this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][1], $barCoordinateArray['y'][1]), $startDepth), $this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][1], $barCoordinateArray['y'][0]), $startDepth)), $color->darken($this->options->barDarkenSide), true));
$topLocation = min($barCoordinateArray['y'][0], $barCoordinateArray['y'][1]);
// Top side
$this->barPostProcessing[] = array('index' => $barCoordinateArray['x'][0], 'method' => 'drawPolygon', 'context' => $context, 'parameters' => array(array($this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][1], $topLocation), $startDepth), $this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][2], $topLocation), $midDepth), $this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][3], $topLocation), $endDepth), $this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][0], $topLocation), $midDepth)), $color->darken($this->options->barDarkenTop), true));
// Top side gleam
if ($this->options->barChartGleam !== false) {
$this->barPostProcessing[] = array('index' => $barCoordinateArray['x'][0] + 1, 'method' => 'drawPolygon', 'context' => $context, 'parameters' => array(array($this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][1], $topLocation), $startDepth), $this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][2], $topLocation), $midDepth), $this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][3], $topLocation), $endDepth), $this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][0], $topLocation), $midDepth)), new ezcGraphLinearGradient($this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][2], $topLocation), $midDepth), $this->get3dCoordinate(new ezcGraphCoordinate($barCoordinateArray['x'][0], $topLocation), $midDepth), ezcGraphColor::fromHex('#FFFFFFFF'), ezcGraphColor::fromHex('#FFFFFF')->transparent(1 - $this->options->barChartGleam)), true));
}
}
示例6: testDrawTextWithMinimizedBorderAndBackgroundBottomRight
public function testDrawTextWithMinimizedBorderAndBackgroundBottomRight()
{
$filename = $this->tempDir . __FUNCTION__ . '.png';
$this->driver->options->font->border = ezcGraphColor::fromHex('#555555');
$this->driver->options->font->background = ezcGraphColor::fromHex('#DDDDDD');
$this->driver->options->font->minimizeBorder = true;
$this->driver->options->font->padding = 2;
$this->driver->drawTextBox('Some test string', new ezcGraphCoordinate(10, 10), 150, 70, ezcGraph::RIGHT | ezcGraph::BOTTOM);
$this->driver->render($filename);
$this->assertTrue(file_exists($filename), 'No image was generated.');
$this->assertImageSimilar($filename, $this->basePath . 'compare/' . 'ezcGraphCairoDriverTest' . '_' . __FUNCTION__ . '.png', 'Image does not look as expected.', 2000);
}
示例7: __construct
/**
* Constructor
*
* @param array $options Default option array
* @return void
* @ignore
*/
public function __construct(array $options = array())
{
$this->properties['name'] = 'sans-serif';
// $this->properties['path'] = 'Graph/tests/data/font.ttf';
$this->properties['path'] = '';
$this->properties['type'] = ezcGraph::TTF_FONT;
$this->properties['minFontSize'] = 6;
$this->properties['maxFontSize'] = 96;
$this->properties['minimalUsedFont'] = 96;
$this->properties['color'] = ezcGraphColor::fromHex('#000000');
$this->properties['background'] = false;
$this->properties['border'] = false;
$this->properties['borderWidth'] = 1;
$this->properties['padding'] = 0;
$this->properties['minimizeBorder'] = true;
$this->properties['textShadow'] = false;
$this->properties['textShadowOffset'] = 1;
$this->properties['textShadowColor'] = false;
parent::__construct($options);
}
示例8: drawCircularArc
/**
* Draws a circular arc
*
* @param ezcGraphCoordinate $center Center of ellipse
* @param integer $width Width of ellipse
* @param integer $height Height of ellipse
* @param integer $size Height of border
* @param float $startAngle Starting angle of circle sector
* @param float $endAngle Ending angle of circle sector
* @param ezcGraphColor $color Color of Border
* @param bool $filled
* @return void
*/
public function drawCircularArc(ezcGraphCoordinate $center, $width, $height, $size, $startAngle, $endAngle, ezcGraphColor $color, $filled = true)
{
$this->createDocument();
// Normalize angles
if ($startAngle > $endAngle) {
$tmp = $startAngle;
$startAngle = $endAngle;
$endAngle = $tmp;
}
if ($endAngle - $startAngle > 180 || $startAngle % 180 != 0 && $endAngle % 180 != 0 && ($startAngle % 360 > 180 xor $endAngle % 360 > 180)) {
// Border crosses he 180 degrees border
$intersection = floor($endAngle / 180) * 180;
while ($intersection >= $endAngle) {
$intersection -= 180;
}
$this->drawCircularArc($center, $width, $height, $size, $startAngle, $intersection, $color, $filled);
$this->drawCircularArc($center, $width, $height, $size, $intersection, $endAngle, $color, $filled);
return;
}
// We need the radius
$width /= 2;
$height /= 2;
$Xstart = $center->x + $this->options->graphOffset->x + $width * cos(-deg2rad($startAngle));
$Ystart = $center->y + $this->options->graphOffset->y + $height * sin(deg2rad($startAngle));
$Xend = $center->x + $this->options->graphOffset->x + $width * cos(-deg2rad($endAngle));
$Yend = $center->y + $this->options->graphOffset->y + $height * sin(deg2rad($endAngle));
if ($filled === true) {
$arc = $this->dom->createElement('path');
$arc->setAttribute('d', sprintf('M %.2F,%.2F A %.2F,%.2F 0 %d,0 %.2F,%.2F L %.2F,%.2F A %.2F,%2F 0 %d,1 %.2F,%.2F z', $Xend, $Yend + $size, $width, $height, $endAngle - $startAngle > 180, $Xstart, $Ystart + $size, $Xstart, $Ystart, $width, $height, $endAngle - $startAngle > 180, $Xend, $Yend));
} else {
$arc = $this->dom->createElement('path');
$arc->setAttribute('d', sprintf('M %.2F,%.2F A %.2F,%.2F 0 %d,1 %.2F,%.2F', $Xstart, $Ystart, $width, $height, $endAngle - $startAngle > 180, $Xend, $Yend));
}
$arc->setAttribute('style', $this->getStyle($color, $filled));
$arc->setAttribute('id', $id = $this->options->idPrefix . 'CircularArc_' . ++$this->elementID);
$this->elements->appendChild($arc);
if ($this->options->shadeCircularArc !== false && $filled) {
$gradient = new ezcGraphLinearGradient(new ezcGraphCoordinate($center->x - $width, $center->y), new ezcGraphCoordinate($center->x + $width, $center->y), ezcGraphColor::fromHex('#FFFFFF')->transparent($this->options->shadeCircularArc * 1.5), ezcGraphColor::fromHex('#000000')->transparent($this->options->shadeCircularArc));
$arc = $this->dom->createElement('path');
$arc->setAttribute('d', sprintf('M %.2F,%.2F A %.2F,%.2F 0 %d,0 %.2F,%.2F L %.2F,%.2F A %.2F,%2F 0 %d,1 %.2F,%.2F z', $Xend, $Yend + $size, $width, $height, $endAngle - $startAngle > 180, $Xstart, $Ystart + $size, $Xstart, $Ystart, $width, $height, $endAngle - $startAngle > 180, $Xend, $Yend));
$arc->setAttribute('style', $this->getStyle($gradient, $filled));
$arc->setAttribute('id', $id = $this->options->idPrefix . 'CircularArc_' . ++$this->elementID);
$this->elements->appendChild($arc);
}
return $id;
}
示例9: testDrawGridLines
public function testDrawGridLines()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$chart = new ezcGraphRadarChart();
$chart->palette = new ezcGraphPaletteBlack();
$chart->data['sample'] = new ezcGraphArrayDataSet($this->getRandomData(6));
$mockedRenderer = $this->getMock('ezcGraphRenderer2d', array('drawGridLine'));
$mockedRenderer->expects($this->at(0))->method('drawGridLine')->with($this->equalTo(new ezcGraphCoordinate(338.0, 93.8), 0.1), $this->equalTo(new ezcGraphCoordinate(300.0, 80.0), 0.1), $this->equalTo(ezcGraphColor::fromHex('#888A85')));
$mockedRenderer->expects($this->at(1))->method('drawGridLine')->with($this->equalTo(new ezcGraphCoordinate(343.75, 92.90000000000001), 0.1), $this->equalTo(new ezcGraphCoordinate(300.0, 77.0), 0.1), $this->equalTo(ezcGraphColor::fromHex('#888A8588')));
// Next axis
$mockedRenderer->expects($this->at(21))->method('drawGridLine')->with($this->equalTo(new ezcGraphCoordinate(323.5, 116.2), 0.1), $this->equalTo(new ezcGraphCoordinate(338.0, 93.8), 0.1), $this->equalTo(ezcGraphColor::fromHex('#888A85')));
$chart->renderer = $mockedRenderer;
$chart->render(500, 200);
}
示例10: testChartElementAxisPropertyMinorGrid
public function testChartElementAxisPropertyMinorGrid()
{
$options = new ezcGraphChartElementNumericAxis();
$this->assertSame(false, $options->minorGrid, 'Wrong default value for property minorGrid in class ezcGraphChartElementNumericAxis');
$options->minorGrid = $color = ezcGraphColor::fromHex('#FFFFFF');
$this->assertSame($color, $options->minorGrid, 'Setting property value did not work for property minorGrid in class ezcGraphChartElementNumericAxis');
try {
$options->minorGrid = false;
} catch (ezcGraphUnknownColorDefinitionException $e) {
return true;
}
$this->fail('Expected ezcGraphUnknownColorDefinitionException.');
}
示例11: __construct
/**
* Constructor
*
* @param array $options Default option array
* @return void
* @ignore
*/
public function __construct(array $options = array())
{
$this->properties['seperateLines'] = true;
$this->properties['fillAxis'] = 0.8;
$this->properties['fillGrid'] = 0;
$this->properties['depth'] = 0.1;
$this->properties['pieChartHeight'] = 10.0;
$this->properties['pieChartRotation'] = 0.6;
$this->properties['pieChartShadowSize'] = 0;
$this->properties['pieChartShadowTransparency'] = 0.3;
$this->properties['pieChartShadowColor'] = ezcGraphColor::fromHex('#000000');
$this->properties['pieChartGleam'] = false;
$this->properties['pieChartGleamColor'] = ezcGraphColor::fromHex('#FFFFFF');
$this->properties['barDarkenSide'] = 0.2;
$this->properties['barDarkenTop'] = 0.4;
$this->properties['barChartGleam'] = false;
parent::__construct($options);
}
示例12: testChangeDefaultRenderSettings
public function testChangeDefaultRenderSettings()
{
$filename = $this->tempDir . __FUNCTION__ . '.svg';
$this->driver->options->strokeLineJoin = 'bevel';
$this->driver->options->strokeLineCap = 'square';
$this->driver->options->shapeRendering = 'optimizeSpeed';
$this->driver->options->colorRendering = 'optimizeSpeed';
$this->driver->options->textRendering = 'optimizeSpeed';
$return = $this->driver->drawPolygon(array(new ezcGraphCoordinate(45, 12), new ezcGraphCoordinate(122, 34), new ezcGraphCoordinate(12, 71)), ezcGraphColor::fromHex('#3465A4'), false);
$this->driver->render($filename);
$this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
$this->assertEquals('ezcGraphPolygon_1', $return, 'Expected xml id as return value.');
}
示例13: testRenderToOutput
public function testRenderToOutput()
{
$filename = $this->tempDir . __FUNCTION__ . '.swf';
$this->driver->drawLine(new ezcGraphCoordinate(12, 45), new ezcGraphCoordinate(134, 12), ezcGraphColor::fromHex('#3465A4'));
$this->assertEquals($this->driver->getMimeType(), 'application/x-shockwave-flash', 'Wrong mime type returned.');
ob_start();
// Suppress header already sent warning
@$this->driver->renderToOutput();
file_put_contents($filename, ob_get_clean());
$this->swfCompare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.swf');
}
示例14: testLegendSetBorder
public function testLegendSetBorder()
{
$chart = new ezcGraphPieChart();
$chart->legend->border = '#FF0000';
$this->assertEquals(ezcGraphColor::fromHex('#FF0000'), $chart->legend->border);
}
示例15: testDataSetSetSingleColor
public function testDataSetSetSingleColor()
{
$chart = new ezcGraphPieChart();
$chart->data['income'] = new ezcGraphArrayDataSet(array(2000 => 2345.2, 2456.3, 2567.4));
$chart->data['income']->color[2001] = '#FF0000';
$this->assertEquals(ezcGraphColor::fromHex('#FF0000'), $chart->data['income']->color[2001]);
}