public function __construct() { $this->color = Color::create('000000'); $this->type = GoogleChartLabelStyleNumberType::create(); $this->size = 10; $this->dataPoint = -1; }
/** * @dataProvider oneAxisDataProvider **/ public function testOneAxis($axisData, $result) { foreach ($result as $chartClass => $expectedString) { $views = GoogleChartDataSet::create()->setData($axisData); $chart = new $chartClass(); if ($chart->getData()->isNormalized()) { if ($views->getMax() >= 10) { $base = pow(10, floor(log10($views->getMax()))); } else { $base = 0.1; } $views->setBase($base); } $axis = GoogleChartAxis::create(new GoogleChartAxisType(GoogleChartAxisType::Y))->setRange($views->getMinMax()); if ($chart->getData()->isNormalized()) { $axis->setInterval($views->getBase()); } $chart->setSize(GoogleChartSize::create()->setWidth(300)->setHeight(300))->addAxis($axis)->addLine(GoogleChartLine::create()->setTitle('Показы')->setColor(Color::create('336699'))->setValue($views)->setLabelStyle(ChartLabelStyle::create()->setType(GoogleChartLabelStyleNumberType::create())->setSize(11)->setColor(Color::create('117700')))); $this->assertEquals($expectedString, $chart->toString()); } }