Skip to content

Commit 6e6d2e5

Browse files
authored
Merge branch 'main' into 91-style-dashboard-rmi
2 parents 1d40999 + 837dfb5 commit 6e6d2e5

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/js/time_line.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ export class time_line {
5252
.filter((d) => d.allocation_translation == allocation_method)
5353
.filter((d) => d.equity_market == equity_market)
5454
.filter((d) => d.scenario_source == scenario_source)
55-
.filter((d) => d.scenario == scenario);
55+
.filter((d) => d.scenario == scenario)
56+
.sort((a, b) => d3.ascending(a.plan, b.plan));
5657

5758
const parseYear = d3.timeParse('%Y');
5859

@@ -95,10 +96,10 @@ export class time_line {
9596
.attr('class', 'line')
9697
.style('fill', 'none')
9798
.style('stroke', (d) => (d.values[0].plan == 'plan' ? line_color : scen_line_color))
99+
.style('stroke-dasharray', (d) => (d.values[0].plan == 'plan' ? '' : '15,10'))
98100
.style('stroke-width', '2px')
99101
.attr('id', (d) => d.key)
100-
.attr('d', (d) => line(d.values))
101-
.style('transform', (d) => (d.values[0].plan == 'plan' ? '' : 'translate(8px, -8px)'));
102+
.attr('d', (d) => line(d.values));
102103

103104
// Add dots for datapoints
104105
svg
@@ -107,15 +108,13 @@ export class time_line {
107108
.enter()
108109
.append('circle')
109110
.attr('class', 'dot')
110-
.attr('r', 5)
111-
.style('stroke', '#fff')
111+
.attr('r', (d) => (d.plan == 'plan' ? 6 : 4))
112112
.style('fill', (d) => (d.plan == 'plan' ? line_color : scen_line_color))
113113
.attr('name', (d) => d.key)
114114
.attr('x_value', (d) => d.year)
115115
.attr('y_value', (d) => d.value)
116116
.attr('cx', (d) => x(parseYear(d.year)))
117117
.attr('cy', (d) => y(d.value))
118-
.style('transform', (d) => (d.plan == 'plan' ? '' : 'translate(8px, -8px)'))
119118
.on('mouseover', mouseover)
120119
.on('mousemove', mousemove)
121120
.on('mouseout', mouseout);
@@ -214,15 +213,15 @@ export class time_line {
214213
.attr('y1', 0)
215214
.attr('y2', 0)
216215
.style('stroke-width', 2)
217-
.style('stroke', (d) => (d == port_label ? line_color : scen_line_color));
216+
.style('stroke', (d) => (d == port_label ? line_color : scen_line_color))
217+
.style('stroke-dasharray', (d) => (d == port_label ? '' : '15,10'));
218218

219219
legend
220220
.enter()
221221
.append('circle')
222-
.attr('r', 5)
222+
.attr('r', (d) => (d == port_label ? 6 : 4))
223223
.attr('cx', (d) => (d == port_label ? 30 : 230))
224224
.attr('cy', 0)
225-
.style('stroke', '#fff')
226225
.style('fill', (d) => (d == port_label ? line_color : scen_line_color));
227226

228227
legend

0 commit comments

Comments
 (0)