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

Year #11

Open
alexizzz0 opened this issue Dec 4, 2020 · 1 comment
Open

Year #11

alexizzz0 opened this issue Dec 4, 2020 · 1 comment

Comments

@alexizzz0
Copy link

How would you resolve the issue of having months overlap in years.
For Example:
Jan 2020 and Jan 2021
If the dataset is large enough then it will overlap and the chart will add those months together.

I was thinking there is sorting when you write the sql query but what then the distinguishing factor becomes the year and not the month name.

I'm still a noob but this tutorial was so great i thought you would be able to answer this faster than i could solve it myself.

@AselGunaratne
Copy link

Im a bit of a noob myself but I used string concat for this and it worked for me. You can try the following code to replace the foreach loop

$date = new \DateTime($unformatted_date); $month_no = strval($date->format('m')); $year_no = strval($date->format('y')); $month_year_no=$month_no.$year_no; $month_name = $date->format('M'); $year_name = $date->format('Y'); $month_year_name=$month_name.(" ").$year_name; $month_array[$month_year_no] = $month_year_name;

hope this answers your requirement :)

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

No branches or pull requests

2 participants