New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fatal error rgument 1 passed to Davaxi\\Sparkline::setLineColorHex() must be of the type string when comparing #18534
Comments
This could possibly be a vue migration issue. It seems for some reason the sparkline uses matomo/plugins/CoreHome/javascripts/sparkline.js Lines 18 to 22 in 1155273
and matomo/plugins/CoreHome/vue/src/Comparisons/Comparisons.store.ts Lines 174 to 190 in 92ed7f8
Could you have a quick look if that's a regression? @diosmosis |
I'm not able to reproduce. If null is being used, then it is coming from ColorManager not the comparison service (if the color wasn't there in the comparison service, we'd get |
Also getting similar fatal errors for a different method. This one I can reproduce on our own instance.
Referrer: https://example.matomo.org/index.php?module=CoreHome&action=index&idSite=1&period=day&date=yesterday GET: {"date":"2021-11-30,2021-12-29","forceView":"1","viewDataTable":"sparkline","module":"API","action":"get","disableLink":"0","widget":"1","idSite":"1","period":"day","columns":"nb_visits,nb_uniq_visitors","colors":"{"lineColor":"#cac5be","minPointColor":"#ff7272","maxPointColor":"#7cc282","lastPointColor":"#55b3ff"}"} |
It doesn't look vue related. Quick fix might be in PHP to default the missing/incorrect colors |
We have applied this fix on production but the errors are still happening.
|
I can also reproduce this locally and something like below fixed it for me diff --git a/core/Visualization/Sparkline.php b/core/Visualization/Sparkline.php
index e3cff4fb11..c960dea8eb 100644
--- a/core/Visualization/Sparkline.php
+++ b/core/Visualization/Sparkline.php
@@ -179,6 +179,8 @@ class Sparkline implements ViewInterface
if (empty($colors)) { // quick fix so row evolution sparklines will have color in widgetize's iframes
$colors = $defaultColors;
+ } else {
+ $colors = array_merge($defaultColors, $colors);
}
if (strtolower($colors['backgroundColor']) !== '#ffffff') { |
See below error. seems this happened when comparing? A segment is applied too but could be removed when reproducing I would assume.
The text was updated successfully, but these errors were encountered: