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
Javascript error "Cannot read property 'left' of undefined" in Piwik 2.13.1 #8063
Comments
Hi @splinter89 thanks for the report. we'll take a look |
@splinter89 can you reproduce this issue on the demo.piwik.org as well? which browser do you use? |
I get this error in Chrome 43.0.2357.124 m. Ok, I have found that my simple custom plugin is the reason.
but everything is shown correctly and working.. Graph is rendered automatically by Piwik, so I don't see how this plugin could cause that. However, if it's the case, I am sorry for taking your time. Anyway, maybe this would help: class OurCompany extends Plugin
{
public function postLoad()
{
WidgetsList::add('OurCompany widgets', 'Banners', 'OurCompany', 'bannersGraph');
}
}
class Controller extends \Piwik\Plugin\Controller
{
public function bannersGraph()
{
$view = new View('@OurCompany/banners');
$this->setPeriodVariablesView($view);
$view->bannersGraph = $this->getBannersGraph(['page1', 'page2']);
return $view->render();
}
public function getBannersGraph(array $defaultColumns = [])
{
$columns = Common::getRequestVar('columns', false);
if (false !== $columns) {
$columns = Piwik::getArrayFromApiParameter($columns);
}
$view = $this->getLastUnitGraphAcrossPlugins(
$this->pluginName,
__FUNCTION__,
$columns,
$defaultColumns,
false,
'OurCompany.getBannersEvolution'
);
$view->requestConfig->disable_generic_filters = true; // do not sort
if (empty($view->config->columns_to_display) && !empty($defaultColumns)) {
$view->config->columns_to_display = $defaultColumns;
}
return $this->renderView($view);
}
}
class API extends \Piwik\Plugin\API
{
public function getBannersEvolution($idSite, $period, $date, $segment = false)
{
$data = [/*...*/]; // sorted manually
return DataTable::makeFromIndexedArray($data);
}
} and simple "banners.twig" {{ bannersGraph|raw }} |
Since it's not a bug in Piwik core, i'm closing. We plan to improve the Platform & APIs around displaying reports, graphs, in the future, so hopefully such issue would be fixed. if this bug is blocking you or breaking your Piwik we could maybe re-open the issue |
Hi!
The mentioned error occurs on this line:
I wasn't able to trace conditions which lead to this error though, because breakpoints on minified JS are not very useful.
Maybe someone can fix it?
The text was updated successfully, but these errors were encountered: