-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Stats: Add Subscriber Chart #23074
Stats: Add Subscriber Chart #23074
Conversation
Shows subscriber growth over time
WordPress/Classes/ViewRelated/Stats/Subscribers/StatsSubscribersLineChart.swift
Show resolved
Hide resolved
📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
|
WordPress/Classes/ViewRelated/Stats/Subscribers/StatsSubscribersViewModel.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I re-used StatsLineChartView but made a new cell, StatsSubscribersChartCell, and a chart configuration object, StatsSubscribersLineChart.
I think it makes sense. That's what I would've expected, and it will allow to make subscriber-specific improvements to this chart as well.
The line chart often looks flat, and small fluctuations in subscribers are not easy to see. The problem is that the y-axis minimum is always set to zero when it should be roughly (or exactly) to the minimum value of the chart.
Good observation. It looks like what WP.com is doing, setting the y-axis minimum to the minimum value of the chart. I think it would make sense to do it on the app as well. I opened it up for a discussion (p1713943261341449-slack-C06BR07TJHK)
The chart card loading ghost view doesn't resemble the chart
We need a bunch of new ghost views. I'd say let's leave it outside of the scope of this PR. I added it to #23059 task. When we do all the main functionality we can see how much time remains to perfect loading views.
The chart tooltip is not set up yet
👍 Feel free to split the work into separate PRs if you prefer
Scenarios where there are less then 30 days worth of data returned by /sites//stats/subscribers such as a new or recently created site (💥 crashes now on new sites which return one day of data)
For Traffic charts we generate before/after fake dates for the chart in some cases. Let's say we display a chart for April 1 - April 30, and the site was created April 15. So we create fake April 1 - April 15 dates with value 0, and then the chart grows from there. This is one way to get around some of the problems. If it's a completely new site with 0 subscribers, an empty April 1 - April 30 chart would be displayed.
I also promoted your question in the chart as well p1713943813107969-slack-C06BR07TJHK for a discussion
WordPress/Classes/ViewRelated/Stats/Subscribers/StatsSubscribersLineChart.swift
Show resolved
Hide resolved
WordPress/Classes/ViewRelated/Stats/Subscribers/StatsSubscribersStore.swift
Outdated
Show resolved
Hide resolved
FYI: I limited the min and max values of y-axis based on the subscribers count on Android(wordpress-mobile/WordPress-Android#20706). If the graph doesn't have changes, I set the min value to 0 and the max value to twice the data. This behavior is the same as web stats. |
Thanks @irfano! I'll add this in a follow-up PR along with the chart marker. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WordPress/Classes/ViewRelated/Stats/SiteStatsTableViewCells.swift
Outdated
Show resolved
Hide resolved
WordPress/Classes/ViewRelated/Stats/Subscribers/StatsSubscribersChartCell.swift
Outdated
Show resolved
Hide resolved
WordPress/Classes/ViewRelated/Stats/Subscribers/StatsSubscribersChartCell.swift
Outdated
Show resolved
Hide resolved
Thanks!
I added this now to the list of things to do in a follow-up PR 👍 |
Addresses #23044
I looked to reuse as much of the Views & Visitors card as possible but found that hiding its segmented controls and various labels was difficult. I re-used
StatsLineChartView
but made a new cell,StatsSubscribersChartCell
and a chart configuration object,StatsSubscribersLineChart
.Screenshot
To test
Known issues
Some updates I'd like to do in follow-up PRs
Scenarios where there are less then 30 days worth of data returned byfixed in 9cc7ba2/sites/<site id>/stats/subscribers
such as a new or recently created site (💥 crashes now on new sites which return one day of data)Regression Notes
Potentially this P2 could affect the Subscriber email list
Manual testing
I added a new test to verify the chart card loads correctly
PR submission checklist:
RELEASE-NOTES.txt
if necessary.Testing checklist: