Skip to content
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

Bar graph should only have Users and Unique Visitors options when they are valid #14332

Merged
merged 10 commits into from May 2, 2019

Conversation

katebutler
Copy link

These should only be displayed when the visualization's date range supports these metrics (i.e. for a single date, but not a date range). This prevents the user from making selections which will trigger JS errors and prevent the visualization from rendering anyway.

Fixes #14042


protected function generateSelectableColumns()
{
$selectableColumns = array('nb_visits', 'nb_actions');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@katebutler not sure about the columns we add by default. Many reports won't have the columns nb_actions, nb_conversions, revenue, nb_uniq_visitors and nb_users. Some reports might not even have the nb_visits. Did you copy this logic from somewhere?

Otherwise we could maybe simply set the first non-label column from the first row?

And if there is only label in the first row, we could maybe default to nb_visits?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing logic was to just use all of them and hope for the best 😄 but I have reworked it to use all columns except label if none of these are present in the dataset


protected function ensureValidColumnsToDisplay()
{
$columnsToDisplay = $this->config->columns_to_display;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this logic here is needed? I wonder about possible side effects where reports declare columns_to_display but not selectable_columns.

In general this is a great addition that makes sense though. If something is not selectable, we shouldn't show it. Just scared about possible side effects or breaking something. Might not be an issue though but have a feeling there are some reports that might break as I can't find where the reports usually add this info.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can quickly chat about it tmrw might be easiest

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed it to match against $dataTable->getColumns() rather than selectable_columns - this should hopefully avoid any side effects.

@mattab mattab added this to the 3.10.0 milestone Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dashboard screen is broken when using unique visitors for range
3 participants