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

Fix for zero average order value on charts #19353

Merged
merged 6 commits into from Jun 15, 2022
Merged

Conversation

bx80
Copy link
Contributor

@bx80 bx80 commented Jun 14, 2022

Description:

Fixes #15262

The average order value on the evolution overview charts was always shown as zero, this was caused by pre-formatted values in the datatable breaking the jqplot data generation.

This fix attempts to solve this by:

  • Respecting evolution chart visualization calls which set format_metrics = 0 (only setting a format_metrics default value if there are no request override parameters)
  • Having evolution charts set format_metrics = 0
  • Passing the series units to the jqplot data generation setAxisYValues method
  • If the series unit is a percent then convert chart data values to display percentages.
  • jqplot chart number formatting currently doesn't fully support internationalization (eg. forcing a dot as a decimal point separator), all series formatting units were being added as a postfix, I added a minor tweak to show dollar and pound currency symbols as prefixes. This is obviously not ideal but should be a slight improvement for some people, if we had a reliable way to determine the currency symbol position then we could possibly add that as metadata to core/Metrics::getUnit() and make it available to the jqplot formatting code.

Review

…rcent formatting for the jqplotDataGenerator
@bx80 bx80 self-assigned this Jun 14, 2022
@bx80 bx80 added Bug For errors / faults / flaws / inconsistencies etc. Needs Review PRs that need a code review labels Jun 14, 2022
@bx80 bx80 added this to the 4.12.0 milestone Jun 14, 2022
Copy link
Member

@sgiehl sgiehl left a comment

Choose a reason for hiding this comment

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

Seems to work as expected overall. Left some comments for further improvements.

plugins/CoreVisualizations/JqplotDataGenerator/Chart.php Outdated Show resolved Hide resolved
core/API/Request.php Outdated Show resolved Hide resolved
plugins/Goals/Controller.php Show resolved Hide resolved
@sgiehl sgiehl removed the Needs Review PRs that need a code review label Jun 14, 2022
@bx80 bx80 added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Jun 15, 2022
@sgiehl sgiehl merged commit 1554431 into 4.x-dev Jun 15, 2022
@sgiehl sgiehl deleted the m-15262-avg-order-zero branch June 15, 2022 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix average order value graph flattening out to value 0
2 participants