@@ -70,6 +70,8 @@ submissions_stats$type <- "stats"
70
70
submissions_stats$lty <- 1L
71
71
72
72
submissions <- rbind (submissions_all, submissions_gen, submissions_stats)
73
+ submissions$yshift <- 0
74
+ submissions$yshift [which (submissions$type == "all")] <- 20
73
75
```
74
76
75
77
``` {r ojs-in-submissions, echo = FALSE}
@@ -103,6 +105,13 @@ viewof submissionYear = Inputs.range(
103
105
submissionsFiltered = {
104
106
return submissions.filter(d => d.submissionYear >= submissionYear);
105
107
}
108
+ // These next two are needed to offset label placement for "all":
109
+ submissionsFilteredAll = {
110
+ return submissions.filter(d => d.type === "all");
111
+ }
112
+ submissionsFilteredOther = {
113
+ return submissions.filter(d => d.type !== "all");
114
+ }
106
115
```
107
116
108
117
``` {ojs}
@@ -125,15 +134,27 @@ Plot.plot({
125
134
fontSize: 18
126
135
}
127
136
),
128
- Plot.text(
129
- submissionsFiltered ,
137
+ Plot.text( // Label for "all" with dy: -20
138
+ submissionsFilteredAll ,
130
139
Plot.selectLast({
131
140
x: "date",
132
141
y: "submissions",
133
142
z: "type",
134
143
text: "type",
135
144
textAnchor: "start",
136
- dx: 3,
145
+ dy: -20,
146
+ fontSize: 18
147
+ })
148
+ ),
149
+ Plot.text( // Labels for others
150
+ submissionsFilteredOther,
151
+ Plot.selectLast({
152
+ x: "date",
153
+ y: "submissions",
154
+ z: "type",
155
+ text: "type",
156
+ textAnchor: "start",
157
+ dy: 0,
137
158
fontSize: 18
138
159
})
139
160
),
@@ -439,6 +460,14 @@ revDurFiltered = {
439
460
}
440
461
441
462
maxRev = 1.05 * Math.max(...revDurFiltered.map(d => d.type === "all" && d.dur));
463
+
464
+ // These next two are needed to offset label placement for "all":
465
+ revDurFilteredAll = {
466
+ return revDurFiltered.filter(d => d.type === "all");
467
+ }
468
+ revDurFilteredOther = {
469
+ return revDurFiltered.filter(d => d.type !== "all");
470
+ }
442
471
```
443
472
444
473
``` {ojs}
@@ -464,7 +493,20 @@ Plot.plot({
464
493
}
465
494
),
466
495
Plot.text(
467
- revDurFiltered,
496
+ revDurFilteredAll,
497
+ Plot.selectLast({
498
+ x: "date",
499
+ y: "dur",
500
+ z: "type",
501
+ text: "type",
502
+ textAnchor: "start",
503
+ dx: 4,
504
+ dy: -20,
505
+ fontSize: 18
506
+ })
507
+ ),
508
+ Plot.text(
509
+ revDurFilteredOther,
468
510
Plot.selectLast({
469
511
x: "date",
470
512
y: "dur",
@@ -615,6 +657,13 @@ revHoursFiltered = {
615
657
}
616
658
617
659
maxHours = 1.05 * Math.max(...revHoursFiltered.map(d => d.type === "all" && d.hours));
660
+ // These next two are needed to offset label placement for "all":
661
+ revHoursFilteredAll = {
662
+ return revHoursFiltered.filter(d => d.type === "all");
663
+ }
664
+ revHoursFilteredOther = {
665
+ return revHoursFiltered.filter(d => d.type !== "all");
666
+ }
618
667
```
619
668
620
669
``` {ojs}
@@ -640,7 +689,20 @@ Plot.plot({
640
689
}
641
690
),
642
691
Plot.text(
643
- revHoursFiltered,
692
+ revHoursFilteredAll,
693
+ Plot.selectLast({
694
+ x: "date",
695
+ y: "hours",
696
+ z: "type",
697
+ text: "type",
698
+ textAnchor: "start",
699
+ dx: 4,
700
+ dy: -20,
701
+ fontSize: 18
702
+ })
703
+ ),
704
+ Plot.text(
705
+ revHoursFilteredOther,
644
706
Plot.selectLast({
645
707
x: "date",
646
708
y: "hours",
0 commit comments