assertTrue( $chart->xAxis instanceof ezcGraphChartElementLabeledAxis ); } public function testAutomaticLabelingSingle() { $chart = ezcGraph::create( 'Line' ); $chart['sample'] = array( 2000 => 20, 70, 12, 130 ); $chart->render( 500, 200 ); $this->assertSame( array( '2000', '2001', '2002', '2003', ), $this->getNonPublicProperty( $chart->xAxis, 'labels' ) ); } public function testAutomaticLabelingMultiple() { $chart = ezcGraph::create( 'Line' ); $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 ); $chart['sample2'] = array( 2002 => 1270, 1170, 1610, 1370 ); $chart->render( 500, 200 ); $this->assertSame( array( '2000', '2001', '2002', '2003', '2004', '2005', ), $this->getNonPublicProperty( $chart->xAxis, 'labels' ) ); } public function testAutomaticLabelingMultipleMixed() { $chart = ezcGraph::create( 'Line' ); $chart['sample'] = array( 2000 => 1045, 2001 => 1300, 2004 => 1012, 2006 => 1450 ); $chart['sample2'] = array( 2001 => 1270, 1170, 1610, 1370, 1559 ); $chart->render( 500, 200 ); $this->assertSame( array( '2000', '2001', '2002', '2003', '2004', '2005', '2006', ), $this->getNonPublicProperty( $chart->xAxis, 'labels' ) ); } public function testPositionLeft() { $chart = ezcGraph::create( 'Line' ); $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 ); $chart->xAxis->position = ezcGraph::LEFT; $chart->render( 500, 200 ); $this->assertEquals( .0, $chart->xAxis->getCoordinate( false ), 'Wrong initial axis position. ', .05 ); $this->assertEquals( .0, $chart->xAxis->getCoordinate( '2000' ), 'Wrong minimal value. ', .05 ); $this->assertEquals( .33, $chart->xAxis->getCoordinate( 2001 ), 'Wrong mid value. ', .05 ); $this->assertEquals( 1., $chart->xAxis->getCoordinate( '2003' ), 'Wrong maximum value. ', .05 ); $this->assertEquals( .0, $chart->xAxis->getCoordinate( '1991' ), 'Wrong return for unknown value. ', .05 ); } public function testPositionRight() { $chart = ezcGraph::create( 'Line' ); $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 ); $chart->xAxis->position = ezcGraph::RIGHT; $chart->render( 500, 200 ); $this->assertEquals( 1., $chart->xAxis->getCoordinate( false ), 'Wrong initial axis position. ', .05 ); $this->assertEquals( 1., $chart->xAxis->getCoordinate( '2000' ), 'Wrong minimal value. ', .05 ); $this->assertEquals( .66, $chart->xAxis->getCoordinate( 2001 ), 'Wrong mid value. ', .05 ); $this->assertEquals( .0, $chart->xAxis->getCoordinate( '2003' ), 'Wrong maximum value. ', .05 ); $this->assertEquals( 1., $chart->xAxis->getCoordinate( '1991' ), 'Wrong return for unknown value. ', .05 ); } public function testPositionTop() { $chart = ezcGraph::create( 'Line' ); $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 ); $chart->xAxis->position = ezcGraph::TOP; $chart->render( 500, 200 ); $this->assertEquals( .0, $chart->xAxis->getCoordinate( false ), 'Wrong initial axis position. ', .05 ); $this->assertEquals( .0, $chart->xAxis->getCoordinate( '2000' ), 'Wrong minimal value. ', .05 ); $this->assertEquals( .33, $chart->xAxis->getCoordinate( 2001 ), 'Wrong mid value. ', .05 ); $this->assertEquals( 1., $chart->xAxis->getCoordinate( '2003' ), 'Wrong maximum value. ', .05 ); $this->assertEquals( .0, $chart->xAxis->getCoordinate( '1991' ), 'Wrong return for unknown value. ', .05 ); } public function testPositionBottom() { $chart = ezcGraph::create( 'Line' ); $chart['sample'] = array( 2000 => 1045, 1300, 1012, 1450 ); $chart->xAxis->position = ezcGraph::BOTTOM; $chart->render( 500, 200 ); $this->assertEquals( 1., $chart->xAxis->getCoordinate( false ), 'Wrong initial axis position. ', .05 ); $this->assertEquals( 1., $chart->xAxis->getCoordinate( '2000' ), 'Wrong minimal value. ', .05 ); $this->assertEquals( .66, $chart->xAxis->getCoordinate( 2001 ), 'Wrong mid value. ', .05 ); $this->assertEquals( .0, $chart->xAxis->getCoordinate( '2003' ), 'Wrong maximum value. ', .05 ); $this->assertEquals( 1., $chart->xAxis->getCoordinate( '1991' ), 'Wrong return for unknown value. ', .05 ); } } ?>