Skip to content

Firefly III: a personal finances manager

Fix periods and labels, add some debug info.

James Cole9cbd0380d671
diff --git a/app/Generator/Chart/Basic/ChartJsGenerator.php b/app/Generator/Chart/Basic/ChartJsGenerator.php
index a236daf151..ab6c09b9fa 100644
--- a/app/Generator/Chart/Basic/ChartJsGenerator.php
+++ b/app/Generator/Chart/Basic/ChartJsGenerator.php
@@ -25,6 +25,7 @@ namespace FireflyIII\Generator\Chart\Basic;
use FireflyIII\Support\ChartColour;
use FireflyIII\Support\Facades\Steam;
+use Illuminate\Support\Facades\Log;
/**
* Class ChartJsGenerator.
@@ -92,14 +93,21 @@ class ChartJsGenerator implements GeneratorInterface
*
* // it's five.
*/
- public function multiSet(array $data): array
+ public function multiSet(array $data, array $labels = []): array
{
reset($data);
$first = current($data);
if (!is_array($first)) {
return [];
}
- $labels = is_array($first['entries']) ? array_keys($first['entries']) : [];
+ Log::debug('Now in multiSet()');
+ if(0 !== count($labels)) {
+ Log::debug('Labels are given: ', $labels);
+ }
+ if(0 === count($labels)) {
+ $labels = is_array($first['entries']) ? array_keys($first['entries']) : [];
+ Log::debug('Labels are generated: ', $labels);
+ }
$chartData = [
'count' => count($data),
diff --git a/app/Generator/Chart/Basic/GeneratorInterface.php b/app/Generator/Chart/Basic/GeneratorInterface.php
index f55193b96c..e274cf2bb1 100644
--- a/app/Generator/Chart/Basic/GeneratorInterface.php
+++ b/app/Generator/Chart/Basic/GeneratorInterface.php
@@ -58,7 +58,7 @@ interface GeneratorInterface
*
* // it's five.
*/
- public function multiSet(array $data): array;
+ public function multiSet(array $data, array $labels = []): array;
/**
* Expects data as:.
diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php
index 518159f6fc..e516302672 100644
--- a/app/Http/Controllers/Chart/CategoryController.php
+++ b/app/Http/Controllers/Chart/CategoryController.php
@@ -281,6 +281,6 @@ class CategoryController extends Controller
}
}
- return $this->generator->multiSet($chartData);
+ return $this->generator->multiSet($chartData, array_values($periods));
}
}
diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php
index 4b66cc5e21..291418b388 100644
--- a/app/Support/Navigation.php
+++ b/app/Support/Navigation.php
@@ -448,7 +448,7 @@ class Navigation
$locale = Steam::getLocale();
// define period to increment
$increment = 'addDay';
- $format = $this->preferredCarbonLocalizedFormat($start, $end);
+ $format = $this->preferredCarbonFormat($start, $end);
$displayFormat = (string) trans('config.month_and_day_js', [], $locale);
$diff = $start->diffInMonths($end, true);
// increment by month (for year)