Skip to content

Commit

Permalink
feat: show today (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
deejay-hub authored Oct 13, 2023
1 parent 3a26ab4 commit 0dc9226
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions force-app/main/default/lwc/timeline/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,27 @@ export default class timeline extends NavigationMixin(LightningElement) {
return false;
};

let currentDate = new Date();
let today = timelineCanvas.append('g')
.attr('class', 'timeline-canvas-current-date')
.attr('transform', 'translate(' + timelineCanvas.x(currentDate) + ')' );

today.append("line")
.style("stroke", "#107cad")
.style("stroke-width", "1px")
.style("stroke-dasharray", "9, 9")
.style("shape-rendering", "crispEdges")
.attr("y2", timelineHeight);

today.append("rect")
.style("fill", "#107cad")
.style("width", "10")
.style("height", "13")
.style("rx", "3")
.style("ry", "3")
.style("x", "-5")
.style("y", timelineHeight - 10)

timelineCanvas.redraw = function (domain) {
var i = 0;
var swimlane = 0;
Expand All @@ -523,6 +544,10 @@ export default class timeline extends NavigationMixin(LightningElement) {

me.totalZoomedRecords = data.length;

timelineCanvas.currentDate = timelineCanvas
.selectAll('[class~=timeline-canvas-current-date]')
.attr('transform', 'translate(' + timelineCanvas.x(currentDate) + ')' );

data.sort(me.sortByValue('time'));

data.forEach(function (entry) {
Expand Down Expand Up @@ -892,6 +917,18 @@ export default class timeline extends NavigationMixin(LightningElement) {
timelineMap.width = timelineMapDIV.offsetWidth;
timelineMap.height = timelineMapDIV.offsetHeight;

let currentDate = new Date();
let today = timelineMap.append('g')
.attr('class', 'timeline-map-current-date')
.attr('transform', 'translate(' + timelineMap.x(currentDate) + ')' );

today.append("line")
.style("stroke", "#107cad")
.style("stroke-width", "1px")
.style("stroke-dasharray", "2, 2")
.style("shape-rendering", "crispEdges")
.attr("y2", timelineMap.height);

timelineMap.redraw = function () {
var i = 0;
var swimlane = 0;
Expand Down

0 comments on commit 0dc9226

Please sign in to comment.