Draws the statistics that collect_stats() collects as a card for a GitHub profile: a row of
key figures and up to three charts, as a PNG or an SVG file, in a dark or a light mode.
Usage
plot_stats_card(
stats = "rghcard-data",
file = "rghcard-stats.png",
theme = c("dark", "light"),
days = 30,
panels = NULL,
title = NULL,
width = 900
)Arguments
- stats
The statistics: what
collect_stats()orread_stats()return, or the folder of the history.- file
The card: a
.pngor an.svgfile.NULLreturns the SVG code instead.- theme
"dark"or"light": the colors of GitHub's dark or light mode.- days
Count the traffic and runs of the last
daysdays, up to the last full day collected: the day before the collection, which GitHub was still counting.- panels
One to three charts:
"views","clones","actions","top_viewed","top_cloned","top_starred"and"languages", or those of the other cards. By defaultc("views", "clones", "top_viewed")with traffic,c("actions", "top_starred", "languages")without.- title
The title, by default the user name.
- width
Width of the card in pixels. A PNG has twice as many, to stay sharp on high-resolution screens.
Details
The key figures are the repositories and their stars; the page views and clones of the last
days days, or the forks when there is no traffic; the downloads of release files; and the
GitHub Actions runs of the last days days. Each chart is one of:
"views","clones","actions": page views, clones or GitHub Actions runs per day, with the busiest day labeled."top_viewed","top_cloned": the five repositories with the most page views or clones."top_starred": the five repositories with the most stars."languages": the number of repositories per main language, as a ring with a legend: five languages at most, and the rest together as "Other", each in the color that GitHub gives the language.
Each card also takes the charts of the others: plot_contributions_card(),
plot_activity_card(), plot_visitors_card(), plot_actions_card() and plot_code_card()
list theirs.
Clones include automated ones (GitHub Actions runs, package builders, app deployments), and a card with traffic says so under the charts. Repositories that were not in the last collection (deleted, made private) are left out.
See also
view_card() shows the card in the Viewer or the Plots pane,
plot_contributions_card(), plot_activity_card(), plot_visitors_card(),
plot_actions_card() and plot_code_card() draw the other cards, and
use_rghcard_action() refreshes them on your profile.
Examples
plot_stats_card(get_example_stats(), tempfile(fileext = ".png"))
card <- plot_stats_card(get_example_stats(), tempfile(fileext = ".svg"), theme = "light",
panels = c("views", "top_starred", "languages"))
view_card(card, "plots")