Only show graphs if there's more than 1 item
This commit is contained in:
parent
98e97ef08d
commit
b57c25843b
@ -186,7 +186,7 @@ if ($result) {
|
|||||||
<h2>Split Views</h2>
|
<h2>Split Views</h2>
|
||||||
<div class="graphs">
|
<div class="graphs">
|
||||||
<?php
|
<?php
|
||||||
|
$categoryDataPoints = [];
|
||||||
foreach ($categoryCost as $category) {
|
foreach ($categoryCost as $category) {
|
||||||
if ($category['cost'] != 0) {
|
if ($category['cost'] != 0) {
|
||||||
$categoryDataPoints[] = [
|
$categoryDataPoints[] = [
|
||||||
@ -196,8 +196,9 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$showCategoryCostGraph = count($categoryCost) > 1;
|
$showCategoryCostGraph = count($categoryDataPoints) > 1;
|
||||||
|
|
||||||
|
$memberDataPoints = [];
|
||||||
foreach ($memberCost as $member) {
|
foreach ($memberCost as $member) {
|
||||||
if ($member['cost'] != 0) {
|
if ($member['cost'] != 0) {
|
||||||
$memberDataPoints[] = [
|
$memberDataPoints[] = [
|
||||||
@ -208,7 +209,7 @@ if ($result) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$showMemberCostGraph = count($memberCost) > 1;
|
$showMemberCostGraph = count($memberDataPoints) > 1;
|
||||||
|
|
||||||
if ($showMemberCostGraph) {
|
if ($showMemberCostGraph) {
|
||||||
?>
|
?>
|
||||||
@ -238,7 +239,7 @@ if ($result) {
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<?php
|
<?php
|
||||||
if ($showCategoryCostGraph || $showMemberCostGraph || $showCostPerMonthGraph) {
|
if ($showCategoryCostGraph || $showMemberCostGraph) {
|
||||||
?>
|
?>
|
||||||
<script src="scripts/libs/chart.js"></script>
|
<script src="scripts/libs/chart.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user