From ecce76839978b59ce30a35f53ebbc288e79a4de0 Mon Sep 17 00:00:00 2001
From: Ray
Date: Tue, 3 Oct 2023 00:04:03 +0100
Subject: [PATCH] Updated demo page
---
bbtimeline.js | 12 ++++++++----
demo-test.html | 39 ++++++++++++++++++++++++++++++++++++++-
2 files changed, 46 insertions(+), 5 deletions(-)
diff --git a/bbtimeline.js b/bbtimeline.js
index 16ddd51..928b083 100644
--- a/bbtimeline.js
+++ b/bbtimeline.js
@@ -48,6 +48,7 @@ class BBTimeline {
a.Events = [];
a.StartDate = a.DateToString(new Date(), "yyyy-MM-dd");
a.ShowDate = a.StartDate;
+ a.LastDate = null;
a.GraphRectangle = a.calcGraphArea();
a.Enabled = false;
a.Debug = false;
@@ -62,11 +63,11 @@ class BBTimeline {
AddEvent(date, label, options) {
const a = this;
- const _options = Object.assign(a.GetEventItem(), options);
+ const _options = Object.assign(a.GenerateEventItem(), options);
let event = a.FindEvent(date);
if (event == null) {
- a.Events.push(a.GetEvent(date));
+ a.Events.push(a.GenerateEvent(date));
event = a.FindEvent(date);
}
@@ -87,6 +88,7 @@ class BBTimeline {
a.ShowDate = a.StartDate;
a.Enabled = false;
a.Events = [];
+ a.LastDate = null;
}
DeleteMarker(date)
@@ -295,7 +297,7 @@ class BBTimeline {
}
- GetEvent(date) {
+ GenerateEvent(date) {
const a = this;
return {
@@ -309,7 +311,7 @@ class BBTimeline {
};
}
- GetEventItem() {
+ GenerateEventItem() {
return {
Title: "",
Description: "",
@@ -509,6 +511,8 @@ class BBTimeline {
const labelSize = a.drawText(e.X, (y + a.Axis.X.DayLineHeight), a.DateToString(date, "dd"), a.Axis.Font, a.Axis.LabelColour, "center");
const label2Spacing = 6;
+ a.LastDate = a.DateToString(date, "yyyy-MM-dd");
+
// Write month on first of the month
if (writeLabel) {
a.drawText(e.X, (y + a.Axis.X.DayLineHeight + labelSize.Height + label2Spacing), a.DateToString(date, "MMMM yyyy"), a.Axis.Font, a.Axis.LabelColour, "left");
diff --git a/demo-test.html b/demo-test.html
index ac46b4c..6c4582e 100644
--- a/demo-test.html
+++ b/demo-test.html
@@ -34,7 +34,12 @@
-
+
+
+
+
+
+