From 71cf03b659b08fa5b18b5e825459e770f50b2e40 Mon Sep 17 00:00:00 2001 From: Kevin Hill Date: Wed, 9 Mar 2016 22:04:46 -0800 Subject: [PATCH] creating tests for more dashboard types --- .../Charts/{Dashboard.php => ManyToMany.php} | 2 +- tests/Examples/Charts/ManyToOne.php | 36 +++++++++++++++++++ tests/Examples/Charts/OneToMany.php | 36 +++++++++++++++++++ tests/Examples/Charts/OneToOne.php | 36 +++++++++++++++++++ tests/Examples/router.php | 17 +++++++-- 5 files changed, 123 insertions(+), 4 deletions(-) rename tests/Examples/Charts/{Dashboard.php => ManyToMany.php} (95%) create mode 100644 tests/Examples/Charts/ManyToOne.php create mode 100644 tests/Examples/Charts/OneToMany.php create mode 100644 tests/Examples/Charts/OneToOne.php diff --git a/tests/Examples/Charts/Dashboard.php b/tests/Examples/Charts/ManyToMany.php similarity index 95% rename from tests/Examples/Charts/Dashboard.php rename to tests/Examples/Charts/ManyToMany.php index 86736a23..fcbafab4 100644 --- a/tests/Examples/Charts/Dashboard.php +++ b/tests/Examples/Charts/ManyToMany.php @@ -32,5 +32,5 @@ $controlWrap = $lava->ControlWrapper($filter, 'control-div-id'); $chartWrap = $lava->ChartWrapper($pieChart, 'chart-div-id'); - $dash = $lava->Dashboard('MyDashboard') + $dash = $lava->Dashboard($title) ->bind($controlWrap, $chartWrap); diff --git a/tests/Examples/Charts/ManyToOne.php b/tests/Examples/Charts/ManyToOne.php new file mode 100644 index 00000000..fcbafab4 --- /dev/null +++ b/tests/Examples/Charts/ManyToOne.php @@ -0,0 +1,36 @@ +DataTable(); + $data->addStringColumn('Name'); + $data->addNumberColumn('Donuts Eaten'); + $data->addRows([ + ['Michael', 5], + ['Elisa', 7], + ['Robert', 3], + ['John', 2], + ['Jessica', 6], + ['Aaron', 1], + ['Margareth', 8] + ]); + + $pieChart = $lava->PieChart($title, $data, [ + 'width' => $width, + 'height' => $height, + 'chartArea' => [ + 'left' => 15, + 'top' => 15 + ], + 'pieSliceText' => 'value' + ]); + + $filter = $lava->NumberRangeFilter(1, [ + 'ui'=> [ + 'label' => 'Donuts Eaten:', + 'labelStacking' => 'vertical' + ] + ]); + + $controlWrap = $lava->ControlWrapper($filter, 'control-div-id'); + $chartWrap = $lava->ChartWrapper($pieChart, 'chart-div-id'); + + $dash = $lava->Dashboard($title) + ->bind($controlWrap, $chartWrap); diff --git a/tests/Examples/Charts/OneToMany.php b/tests/Examples/Charts/OneToMany.php new file mode 100644 index 00000000..fcbafab4 --- /dev/null +++ b/tests/Examples/Charts/OneToMany.php @@ -0,0 +1,36 @@ +DataTable(); + $data->addStringColumn('Name'); + $data->addNumberColumn('Donuts Eaten'); + $data->addRows([ + ['Michael', 5], + ['Elisa', 7], + ['Robert', 3], + ['John', 2], + ['Jessica', 6], + ['Aaron', 1], + ['Margareth', 8] + ]); + + $pieChart = $lava->PieChart($title, $data, [ + 'width' => $width, + 'height' => $height, + 'chartArea' => [ + 'left' => 15, + 'top' => 15 + ], + 'pieSliceText' => 'value' + ]); + + $filter = $lava->NumberRangeFilter(1, [ + 'ui'=> [ + 'label' => 'Donuts Eaten:', + 'labelStacking' => 'vertical' + ] + ]); + + $controlWrap = $lava->ControlWrapper($filter, 'control-div-id'); + $chartWrap = $lava->ChartWrapper($pieChart, 'chart-div-id'); + + $dash = $lava->Dashboard($title) + ->bind($controlWrap, $chartWrap); diff --git a/tests/Examples/Charts/OneToOne.php b/tests/Examples/Charts/OneToOne.php new file mode 100644 index 00000000..b8c3d26b --- /dev/null +++ b/tests/Examples/Charts/OneToOne.php @@ -0,0 +1,36 @@ +DataTable(); + $data->addStringColumn('Name'); + $data->addNumberColumn('Donuts Eaten'); + $data->addRows([ + ['Michael', 5], + ['Elisa', 7], + ['Robert', 3], + ['John', 2], + ['Jessica', 6], + ['Aaron', 1], + ['Margareth', 8] + ]); + + $pieChart = $lava->PieChart('MyPie', $data, [ + 'width' => $width, + 'height' => $height, + 'chartArea' => [ + 'left' => 15, + 'top' => 15 + ], + 'pieSliceText' => 'value' + ]); + + $filter = $lava->NumberRangeFilter(1, [ + 'ui'=> [ + 'label' => 'Donuts Eaten:', + 'labelStacking' => 'vertical' + ] + ]); + + $controlWrap = $lava->ControlWrapper($filter, 'control-div-id'); + $chartWrap = $lava->ChartWrapper($pieChart, 'chart-div-id'); + + $dash = $lava->Dashboard($title) + ->bind($controlWrap, $chartWrap); diff --git a/tests/Examples/router.php b/tests/Examples/router.php index d8feebf0..299d7869 100644 --- a/tests/Examples/router.php +++ b/tests/Examples/router.php @@ -52,9 +52,13 @@ ?> render($chart, $title, 'lavachart'); + if (strpos($chart, 'Chart') > 0) { + echo $lava->render($chart, $title, 'lavachart'); + } else { + echo $lava->render('Dashboard', $title, 'lavachart'); + } } else { - echo '

Supported Charts

'; + echo '

Charts

'; echo ''; - echo ''; + + echo '

Dashboards

'; + echo ''; } ?>