Skip to content

Commit

Permalink
Merge branch 'main' into 91-style-dashboard-rmi
Browse files Browse the repository at this point in the history
  • Loading branch information
MonikaFu authored Jan 16, 2025
2 parents 1d40999 + 837dfb5 commit 6e6d2e5
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/js/time_line.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export class time_line {
.filter((d) => d.allocation_translation == allocation_method)
.filter((d) => d.equity_market == equity_market)
.filter((d) => d.scenario_source == scenario_source)
.filter((d) => d.scenario == scenario);
.filter((d) => d.scenario == scenario)
.sort((a, b) => d3.ascending(a.plan, b.plan));

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

Expand Down Expand Up @@ -95,10 +96,10 @@ export class time_line {
.attr('class', 'line')
.style('fill', 'none')
.style('stroke', (d) => (d.values[0].plan == 'plan' ? line_color : scen_line_color))
.style('stroke-dasharray', (d) => (d.values[0].plan == 'plan' ? '' : '15,10'))
.style('stroke-width', '2px')
.attr('id', (d) => d.key)
.attr('d', (d) => line(d.values))
.style('transform', (d) => (d.values[0].plan == 'plan' ? '' : 'translate(8px, -8px)'));
.attr('d', (d) => line(d.values));

// Add dots for datapoints
svg
Expand All @@ -107,15 +108,13 @@ export class time_line {
.enter()
.append('circle')
.attr('class', 'dot')
.attr('r', 5)
.style('stroke', '#fff')
.attr('r', (d) => (d.plan == 'plan' ? 6 : 4))
.style('fill', (d) => (d.plan == 'plan' ? line_color : scen_line_color))
.attr('name', (d) => d.key)
.attr('x_value', (d) => d.year)
.attr('y_value', (d) => d.value)
.attr('cx', (d) => x(parseYear(d.year)))
.attr('cy', (d) => y(d.value))
.style('transform', (d) => (d.plan == 'plan' ? '' : 'translate(8px, -8px)'))
.on('mouseover', mouseover)
.on('mousemove', mousemove)
.on('mouseout', mouseout);
Expand Down Expand Up @@ -214,15 +213,15 @@ export class time_line {
.attr('y1', 0)
.attr('y2', 0)
.style('stroke-width', 2)
.style('stroke', (d) => (d == port_label ? line_color : scen_line_color));
.style('stroke', (d) => (d == port_label ? line_color : scen_line_color))
.style('stroke-dasharray', (d) => (d == port_label ? '' : '15,10'));

legend
.enter()
.append('circle')
.attr('r', 5)
.attr('r', (d) => (d == port_label ? 6 : 4))
.attr('cx', (d) => (d == port_label ? 30 : 230))
.attr('cy', 0)
.style('stroke', '#fff')
.style('fill', (d) => (d == port_label ? line_color : scen_line_color));

legend
Expand Down

0 comments on commit 6e6d2e5

Please sign in to comment.