Skip to content

Commit 7630cc0

Browse files
committed
add loc plot
1 parent 58962e2 commit 7630cc0

File tree

3 files changed

+94
-5
lines changed

3 files changed

+94
-5
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: githist
22
Title: Code analyses traced along the 'git' history of a package
3-
Version: 0.1.0.022
3+
Version: 0.1.0.023
44
Authors@R:
55
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-2172-5265"))

codemeta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"codeRepository": "https://github.com/ropensci-review-tools/githist",
99
"issueTracker": "https://github.com/ropensci-review-tools/githist/issues",
1010
"license": "https://spdx.org/licenses/GPL-3.0",
11-
"version": "0.1.0.022",
11+
"version": "0.1.0.023",
1212
"programmingLanguage": {
1313
"@type": "ComputerLanguage",
1414
"name": "R",

inst/extdata/quarto/fn-stats.qmd

+92-3
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,9 @@ loc <- tidyr::pivot_longer (
265265
dplyr::mutate (loc_measure = dplyr::case_match (
266266
loc_measure,
267267
"nfiles" ~ "files",
268-
"nlines" ~ "lines_total",
269-
"ncode" ~ "lines_code",
270-
"ndoc" ~ "lines_doc"
268+
"nlines" ~ "total",
269+
"ncode" ~ "code",
270+
"ndoc" ~ "doc"
271271
))
272272
loc_files <- loc [loc$loc_measure == "files", ]
273273
loc_lines <- loc [loc$loc_measure != "files", ]
@@ -358,3 +358,92 @@ Plot.plot({
358358
]
359359
})
360360
```
361+
362+
This next plot shows numbers of lines, both of code and documentation.
363+
364+
```{ojs loc-lines-transpose-and-filter}
365+
loc_lines = {
366+
return transpose(loc_lines_in).map(row => ({
367+
...row,
368+
date: new Date(row.date)
369+
}));
370+
}
371+
viewof loc_measure = Inputs.radio(
372+
["total", "code", "doc"],
373+
{
374+
value: "total",
375+
label: "LOC Type:",
376+
}
377+
)
378+
locLinesFiltered = loc_lines.filter(function(row) {
379+
return loc_measure.includes(row.loc_measure)
380+
})
381+
```
382+
383+
```{ojs loc-lines-plot}
384+
Plot.plot({
385+
style: `
386+
overflow: visible;
387+
`,
388+
marginLeft: 80,
389+
marginBottom: 50,
390+
x: {grid: true},
391+
y: {grid: true},
392+
marks: [
393+
Plot.ruleY([0]),
394+
Plot.lineY(
395+
locLinesFiltered,
396+
{
397+
x: "date",
398+
y: "value",
399+
stroke: "dir",
400+
fontSize: 18
401+
}
402+
),
403+
Plot.text(
404+
locLinesFiltered,
405+
Plot.selectLast({
406+
x: "date",
407+
y: "value",
408+
z: "dir",
409+
text: "dir",
410+
textAnchor: "start",
411+
dx: 3,
412+
fontSize: 18
413+
})
414+
),
415+
Plot.axisX(
416+
{
417+
fontSize: 14,
418+
label: "",
419+
labelArrow: false
420+
}
421+
),
422+
Plot.axisX(
423+
{
424+
fontSize: 20,
425+
label: "Date",
426+
labelAnchor: "center",
427+
labelOffset: 40,
428+
ticks: []
429+
}
430+
),
431+
Plot.axisY(
432+
{
433+
fontSize: 14,
434+
label: "",
435+
labelArrow: false
436+
}
437+
),
438+
Plot.axisY(
439+
{
440+
fontSize: 24,
441+
label: "Numbers of Lines",
442+
labelAnchor: "center",
443+
labelOffset: 70,
444+
ticks: []
445+
}
446+
),
447+
]
448+
})
449+
```

0 commit comments

Comments
 (0)