Skip to content

feat: add "Last 3 Months" and "Last 6 Months" to dashboard charts #4739

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

hirale
Copy link
Contributor

@hirale hirale commented Apr 1, 2025

Description (*)

Add "Last 3 Months" and "Last 6 Months" to dashboard charts

Fixed Issues (if relevant)

Manual testing scenarios (*)

  1. Open Admin Dashboard
  2. Select 'Last 3 months' or 'Last 6 months' from chart

3m
6m

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)

@github-actions github-actions bot added Component: Reports Relates to Mage_Reports Component: Adminhtml Relates to Mage_Adminhtml phpunit labels Apr 1, 2025
@addison74
Copy link
Contributor

@hirale - Please add the translation phrases in /app/locale/en_US/Mage_Adminhtml.csv

@github-actions github-actions bot added the translations Relates to app/locale label Apr 3, 2025
@addison74
Copy link
Contributor

Economically speaking, displaying fast information in a chart about sales can be done on the current day, week, month, on quarters of a year or on the whole year. Week should be the default value.

Questions:

  1. If we discuss quarters then we should also have 9 months?
  2. Is 2YTD still an option?

@sreichel
Copy link
Contributor

sreichel commented Apr 23, 2025

Imho 3/6 months should not be a reduced view from year information. *

  • 3 months: show in day (or week) period
  • 6 months: show in weeks

Questions:

1. If we discuss quarters then we should also have 9 months?

2. Is 2YTD still an option?

* No.
Yes.

:)

@sreichel
Copy link
Contributor

sreichel commented Apr 23, 2025

Btw .. for complete custom reports try https://github.com/kalenjordan/custom-reports/

If there is interst in i can update it to chart.js too

@hirale
Copy link
Contributor Author

hirale commented Apr 23, 2025

Economically speaking, displaying fast information in a chart about sales can be done on the current day, week, month, on quarters of a year or on the whole year. Week should be the default value.

Questions:

  1. If we discuss quarters then we should also have 9 months?
  2. Is 2YTD still an option?

I think this time period should be consistent with the report module. The current report module has options such as 24h, 7d, 1m, 3m, 6m, 1y, and 2y.
If we want to add 9m and remove 2y, then the report module should do the same thing.

@sreichel
Copy link
Contributor

Is 9m a usefull option at all?

2y is okay, imho.

Copy link

sonarqubecloud bot commented Apr 24, 2025

Quality Gate Passed Quality Gate passed

Issues
0 New issues
2 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@sreichel
Copy link
Contributor

wow. update screenshot? :)

@sreichel
Copy link
Contributor

sreichel commented Apr 25, 2025

Pretty cool! ❤️

Not needed, nor requested ... only an idea.

  • possible to fixes axis labels ... (week 40, week 41)? Maybe something for another PR.
  • defenitly for another PR, but maybe you have an idea ... how about to combine orders and amounts in one chart?

datasets: [{
data: <?php echo $this->getChartData() ?>,
backgroundColor: "<?php echo $this->getChartBackgroundColor() ?>",
hoverBackgroundColor: "<?php echo $this->getChartHoverBackgroundColor() ?>",
}]

@hirale
Copy link
Contributor Author

hirale commented Apr 26, 2025

Pretty cool! ❤️

Not needed, nor requested ... only an idea.

  • possible to fixes axis labels ... (week 40, week 41)? Maybe something for another PR.
  • defenitly for another PR, but maybe you have an idea ... how about to combine orders and amounts in one chart?

datasets: [{
data: <?php echo $this->getChartData() ?>,
backgroundColor: "<?php echo $this->getChartBackgroundColor() ?>",
hoverBackgroundColor: "<?php echo $this->getChartHoverBackgroundColor() ?>",
}]

Regarding the axis labels, the week calculation isn’t based on the start of the year, but rather from the $dateStart of the collection. So displaying week numbers like "Week 40", "Week 41" wouldn’t really be reliable here.

For combination of orders and amounts, i think it's better to create new PR with the below chart type.
image

https://www.chartjs.org/docs/latest/samples/other-charts/combo-bar-line.html

@sreichel
Copy link
Contributor

sreichel commented Apr 26, 2025

You can get the week from a given date, see https://carbon.nesbot.com/docs/#api-week

As said, for another PR ... maybe #4463, but i have to fix tests first.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Adminhtml Relates to Mage_Adminhtml Component: Reports Relates to Mage_Reports phpunit translations Relates to app/locale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "Last 3 Months" and "Last 6 Months" to dashboard charts
3 participants