DailyActivityStatistics
in package
implements
StatisticsChartInterface
Graph: Daily activity (responses per day) in the last 30 days.
Always returns all 30 days with a count, even when 0.
Table of Contents
Interfaces
- StatisticsChartInterface
- Interface for all statistics chart classes.
Properties
Methods
- run() : StatisticsChartDTO
- Run the daily activity statistics query.
- setFilters() : void
- Set filters for responses
- buildSeries() : array<string|int, mixed>
- Build a full daily series of the last 30 days, filling in 0 for missing days.
- fetchCounts() : array<string|int, mixed>
- Query the database for counts of responses per day.
- getDateCastExpression() : string
- getDateRange() : array<string|int, DateTime>
- Get the start and end dates for the last 30 days.
Properties
$filters
private
StatisticsResponseFilters|null
$filters
= null
Filters to apply to the query
Methods
run()
Run the daily activity statistics query.
public
run(int $surveyId[, string $language = 'en' ]) : StatisticsChartDTO
Parameters
- $surveyId : int
-
Survey ID
- $language : string = 'en'
-
Language code (not used here, included for consistency)
Return values
StatisticsChartDTOsetFilters()
Set filters for responses
public
setFilters(StatisticsResponseFilters $filters) : void
Parameters
- $filters : StatisticsResponseFilters
buildSeries()
Build a full daily series of the last 30 days, filling in 0 for missing days.
private
buildSeries(array<string|int, mixed> $countsByDate, DateTime $startDate, DateTime $endDate) : array<string|int, mixed>
Parameters
- $countsByDate : array<string|int, mixed>
-
[date => count]
- $startDate : DateTime
- $endDate : DateTime
Return values
array<string|int, mixed> —[$legend, $dataItems, $total]
fetchCounts()
Query the database for counts of responses per day.
private
fetchCounts(int $surveyId, DateTime $startDate) : array<string|int, mixed>
Parameters
- $surveyId : int
- $startDate : DateTime
Return values
array<string|int, mixed> —[date => count]
getDateCastExpression()
private
getDateCastExpression() : string
Return values
stringgetDateRange()
Get the start and end dates for the last 30 days.
private
getDateRange() : array<string|int, DateTime>
Return values
array<string|int, DateTime> —[$startDate, $endDate]