diff --git a/src/bar.js b/src/bar.js
index 31ea7e4..361e0e3 100644
--- a/src/bar.js
+++ b/src/bar.js
@@ -341,7 +341,6 @@ export default class Bar {
const posX = e.offsetX || e.layerX;
const cx = +this.$handle_progress.getAttribute('cx');
if (cx > posX - 1 && cx < posX + 1) return;
- console.log(this.gantt.bar_being_dragged);
if (this.gantt.bar_being_dragged) return;
if (!this.popup_opened)
this.gantt.show_popup({
diff --git a/src/defaults.js b/src/defaults.js
index 1b5771d..329a97b 100644
--- a/src/defaults.js
+++ b/src/defaults.js
@@ -119,23 +119,11 @@ const DEFAULT_OPTIONS = {
holidays: { 'var(--g-weekend-highlight-color)': 'weekend' },
ignore: [],
language: 'en',
- lines: 'both',
+ lines: 'none',
move_dependencies: true,
padding: 18,
popup: (ctx) => {
ctx.set_title(ctx.task.name);
- let title = ctx.get_title();
- title.style.border = '0.5px solid black';
- title.style.borderRadius = '1.5px';
- title.style.padding = '3px 5px ';
- title.style.backgroundColor = 'black';
- title.style.opacity = '0.85';
- title.style.color = 'white';
- title.style.width = 'fit-content';
- title.onclick = () => {
- let ans = prompt('New Title: ');
- if (ans) ctx.set_title(ans);
- };
if (ctx.task.description) ctx.set_subtitle(ctx.task.description);
else ctx.set_subtitle('');
@@ -151,27 +139,18 @@ const DEFAULT_OPTIONS = {
);
ctx.set_details(
- `Progress: ${ctx.task.progress.toFixed(2)}%
Duration: ${ctx.task.actual_duration} days
Dates: ${ctx.task._start.toLocaleDateString('en-US')} - ${ctx.task._end.toLocaleDateString('en-US')}`,
+ `${start_date} - ${end_date} (${ctx.task.actual_duration} days${ctx.task.ignored_duration ? ' + ' + ctx.task.ignored_duration + ' excluded' : ''})
Progress: ${Math.floor(ctx.task.progress * 100) / 100}%`,
);
- let details = ctx.get_details();
- details.style.lineHeight = '1.75';
- details.style.margin = '10px 4px';
- const COLORS = [
- 'FAEDCB',
- 'C9E4DE',
- 'C6DEF1',
- 'DBCDF0',
- 'F2C6DE',
- 'F7D9C4',
- ];
+
if (!ctx.chart.options.readonly) {
if (!ctx.chart.options.readonly_progress) {
- ctx.add_action('Set Color', (task, chart) => {
- const bar = chart.bars.find(
- ({ task: t }) => t.id === task.id,
- ).$bar;
- bar.style.fill =
- '#' + COLORS[Math.floor(Math.random() * 6)];
+ ctx.add_action('+', (task, chart) => {
+ task.progress += (1 / task.actual_duration) * 100;
+ chart.update_task(task);
+ });
+ ctx.add_action('-', (task, chart) => {
+ task.progress -= (1 / task.actual_duration) * 100;
+ chart.update_task(task);
});
}
}
diff --git a/src/index.js b/src/index.js
index 06f02f2..c3257f6 100644
--- a/src/index.js
+++ b/src/index.js
@@ -81,8 +81,11 @@ export default class Gantt {
};
for (let name in CSS_VARIABLES) {
let setting = this.options[CSS_VARIABLES[name]];
- if (setting === 'auto') continue;
- this.$container.style.setProperty('--gv-' + name, setting + 'px');
+ if (setting !== 'auto')
+ this.$container.style.setProperty(
+ '--gv-' + name,
+ setting + 'px',
+ );
}
this.config = {
@@ -396,7 +399,8 @@ export default class Gantt {
this.config.header_height +
this.options.padding +
(this.options.bar_height + this.options.padding) *
- this.tasks.length;
+ this.tasks.length -
+ 10;
createSVG('rect', {
x: 0,
diff --git a/src/popup.js b/src/popup.js
index 2240d8b..673f46d 100644
--- a/src/popup.js
+++ b/src/popup.js
@@ -44,7 +44,6 @@ export default class Popup {
action.onclick = (e) => func(task, this.gantt, e);
},
});
- console.log(html);
if (html === false) return;
if (html) this.parent.innerHTML = html;