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
Last Country in ImageGraph shows a wrong flag #13039
Comments
Ok, I debugged this and I'm pretty fucking confused... I put two debug logs into error_log(print_r($this->abscissaLogos, true));
for ($i = 0; $i < $numberOfRows; $i++) {
if (isset($this->abscissaLogos[$i])) {
$logoPath = $this->abscissaLogos[$i];
if ($i+1 == $numberOfRows) error_log(print_r($this->abscissaLogos, true));
if (isset($logoPathToHeight[$logoPath])) {
$logoHeight = $logoPathToHeight[$logoPath];
$pathInfo = pathinfo($logoPath);
$logoExtension = strtoupper($pathInfo['extension']);
$drawingFunction = 'drawFrom' . $logoExtension;
$logoYPosition =
($logoInterleave * $i)
+ $this->getGridTopMargin(true, $verticalLegend)
+ $graphData['Axis'][1]['Margin']
- $logoHeight / 2
+ 1;
if (method_exists($this->pImage, $drawingFunction)) {
$this->pImage->$drawingFunction(
$gridLeftMarginBeforePadding,
$logoYPosition,
$logoPath
);
}
}
}
} Output:
So the question is, what happens in |
Ok I tracked it down to the line that breaks it: After this line is called the current |
Hello. I did a little strange hack for some tests and got it working correctly (but i don´t know why the original code works wrong). I changed the loop direction from "starting with the lowest index counting upwards" to "starting with the highest index counting downwards". // for ($i = 0; $i < $numberOfRows; $i++) { // old counting upwards Thanks for Your help Michael |
There is already a PR for this -> #13041 Your solution is no fix for this issue but a workaround. The array still breaks. |
Hello i´m using the ImageGraph from the HTML API to show a horizontal bar graph image with the countries of the visitors. In this image the last entry always get a wrong flag (exception is if i have a high amount of countries that i get 'other' in the last row without a flag). The country is correct.
The actual version 3.5.1 of matomo is installed
If i use the dashboard to show the visitorr countries i get the identical number of visitors per country with the correct flags.
I use this code to call the image:
https://xxxxxxxxxxx.de/analytics/piwik/index.php?module=API&method=ImageGraph.get&idSite=1&apiModule=UserCountry&apiAction=getCountry&token_auth=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&graphType=horizontalBar&period=month&date=today&showLegend=1&width=700&height=460&fontSize=8&textColor=7f5500&backgroundColor=ffaa00&gridColor=7f5500&colors=7f0000&legendFontSize=8&alt=''
Is there a known issue in the ImageGrapf functionality or maybe i´ve done somethimg wrong?
The text was updated successfully, but these errors were encountered: