예제 #1
0
 public function testCreateFromArray()
 {
     $factory = new ChartFactory();
     $options = array('chart' => array('renderTo' => 'container', 'type' => 'line'), 'unknownKey' => array(100, 200), 'title' => array('text' => 'Traffic Flow'), 'xAxis' => array('categories' => array('Mon', 'Tue', 'Wed', 'Thurs', 'Fri')), 'yAxis' => array('title' => array('text' => 'Vehicles per minute')), 'series' => array(array('name' => 'Main Street', 'data' => array(44, 30, 34, 29, 48))));
     $chart = $factory->createFromArray($options);
     $this->assertInstanceOf('Petesiss\\PhpHc\\ChartInterface', $chart);
     $this->assertEquals(array('renderTo' => 'container', 'type' => 'line'), $chart->getChart());
     $this->assertEquals(array('text' => 'Traffic Flow'), $chart->getTitle());
     $this->assertEquals(array(), $chart->getColors());
 }
예제 #2
0
파일: TestCase.php 프로젝트: petesiss/phphc
 /**
  * `Set up a default test case
  */
 protected function setUp()
 {
     $factory = new ChartFactory();
     $this->chart = $factory->createChart()->setChart(array('renderTo' => 'container', 'type' => 'bar'))->setTitle(array('text' => 'Monthly Average Temperature'))->setSubtitle(array('text' => 'Based on lots of readings.'))->setXAxis(array('categories' => array('Jan', 'Feb', 'March', 'April', 'May', 'June', 'July', 'Aug', 'Sept', 'Oct', 'Nov', 'Dec')))->setYAxis(array('title' => array('text' => 'Temperature')))->setSeries(array(array('name' => 'Tokyo', 'data' => array(7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6)), array('name' => 'London', 'data' => array(3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8))));
 }
예제 #3
0
 /**
  * @return ChartInterface
  */
 protected function createChart()
 {
     $factory = new ChartFactory();
     $chart = $factory->create();
     return $chart;
 }