Hi! I’m trying to display an evolution graph with a metric created by me. The problem is that I want to show the metric’s range in a new Y-Axis. I can see that metrics like Bounce Rate, Avg. Visit Duration, Avg. Generation time, among others, make the graph to display a second Y-Axis. How can achieve this for my new metric? Right now I can make it work but using the normal Y-Axis.
Related issue: https://github.com/piwik/piwik/issues/3082
Thank you very much.
I guess you are using
Report classes to build the reports? If so try to set
$view->config->selectable_columns = [metric1, metric2] in
configureView method. You then should be able to choose your metric for the evolution graph.
Hi, @sgiehl. Thank you for your response.
Yes, I'm using Report class to build my report. And I'm also using the selectable_columns option but in an action of the controller related to the report. It looks like this:
$view = $this->getLastUnitGraphAcrossPlugins($this->pluginName, FUNCTION, $columns,
$selectableColumns, '', 'VisitsSummary.getMyMetrics');
Right now I'm able to select the metrics I want in the evolution graph.
It is all good until this point. My question is: let's suppose I have two metrics that I want the evolution graph to show: nb_visits and new_metric (metric made by me). How can I achieve that when I select both metrics at the same time, the nb_visits' range shows in the main Y-Axis and the new_metric's range shows in a second (the one on the right of the evolution graph) Y-Axis?
I'm attaching an image to help myself explaining better
Thank you in advance.
I think this only works if you are going to show different units. Currently the shown units are detected based on the column names (https://github.com/piwik/piwik/blob/3.x-dev/core/Metrics.php#L237-L252)
Guess we would need to extend that a bit in order to make it possible to show custom units for specific columns