Add D3.js line chart for views over time on metrics page#2585
Open
lukepayyapilli wants to merge 3 commits intoMIT-LCP:devfrom
Open
Add D3.js line chart for views over time on metrics page#2585lukepayyapilli wants to merge 3 commits intoMIT-LCP:devfrom
lukepayyapilli wants to merge 3 commits intoMIT-LCP:devfrom
Conversation
500ab45 to
8fb5f96
Compare
8fb5f96 to
18e3e36
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_format_chart_datahelper to keep the view focused on data retrieval.Approach
The project already bundles D3 v3 and d3-tip for the site-wide statistics charts. Rather than introducing a new charting library, we reuse the same dependencies and follow the same pattern established in
search/templates/search/charts.html.Chart data is prepared in the view via a small
_format_chart_datahelper that serializes the chronological views-over-time data as JSON. This keeps the view as the presenter (gathering and shaping data for the template) while extracting the formatting detail into a named function. The template receives the JSON and renders it inline — no additional REST endpoint needed since the dataset is small (max ~100 months).The chart is displayed in chronological order (oldest to newest) alongside the counts card, while the table below remains reverse-chronological (newest first) with pagination. Each format follows its natural convention.
Screenshot
Normal View:

Long History:

Short History:

No History:

Closes #2562