Skip to content

Commit

Permalink
feat: date (#256)
Browse files Browse the repository at this point in the history
* feat: show today
* feat: current data colour
* feat: add date on/off
  • Loading branch information
deejay-hub authored Oct 13, 2023
1 parent 8dcfe6f commit 0a956b8
Showing 1 changed file with 32 additions and 28 deletions.
60 changes: 32 additions & 28 deletions force-app/main/default/lwc/timeline/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -505,27 +505,28 @@ export default class timeline extends NavigationMixin(LightningElement) {

let currentDate = new Date();

let today = timelineCanvas.append('g')
if ( this.showToday === "Yes" ) {
let today = timelineCanvas.append('g')
.attr('class', 'timeline-canvas-current-date')
.attr('transform', 'translate(' + timelineCanvas.x(currentDate) + ')' );

today.append("line")
.style("stroke", this.todaysColour)
.style("stroke-width", "1.5px")
.style("stroke-dasharray", "7, 7")
.style("shape-rendering", "crispEdges")
.attr("y2", timelineHeight);

today.append("rect")
.style("fill", this.todaysColour)
.style("width", "8")
.style("height", "13")
.style("rx", "3")
.style("ry", "3")
.style("x", "-4")
.style("y", timelineHeight - 8)


today.append("line")
.style("stroke", this.todaysColour)
.style("stroke-width", "1.5px")
.style("stroke-dasharray", "7, 7")
.style("shape-rendering", "crispEdges")
.attr("y2", timelineHeight);
today.append("rect")
.style("fill", this.todaysColour)
.style("width", "8")
.style("height", "13")
.style("rx", "3")
.style("ry", "3")
.style("x", "-4")
.style("y", timelineHeight - 8)
}
timelineCanvas.redraw = function (domain) {
var i = 0;
var swimlane = 0;
Expand Down Expand Up @@ -958,16 +959,19 @@ export default class timeline extends NavigationMixin(LightningElement) {
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", this.todaysColour)
.style("stroke-width", "1.5px")
.style("stroke-dasharray", "2, 2")
.style("shape-rendering", "crispEdges")
.attr("y2", timelineMap.height);

if ( this.showToday === "Yes" ) {
let today = timelineMap.append('g')
.attr('class', 'timeline-map-current-date')
.attr('transform', 'translate(' + timelineMap.x(currentDate) + ')' );

today.append("line")
.style("stroke", this.todaysColour)
.style("stroke-width", "1.5px")
.style("stroke-dasharray", "2, 2")
.style("shape-rendering", "crispEdges")
.attr("y2", timelineMap.height);
}

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

0 comments on commit 0a956b8

Please sign in to comment.