upper text issues
This commit is contained in:
parent
e20c7e0b6b
commit
268d82ad35
@ -69,13 +69,13 @@ const DEFAULT_VIEW_MODES = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Month',
|
name: 'Month',
|
||||||
padding: '1m',
|
padding: '2m',
|
||||||
step: '1m',
|
step: '1m',
|
||||||
column_width: 120,
|
column_width: 120,
|
||||||
format_string: 'YYYY-MM',
|
format_string: 'YYYY-MM',
|
||||||
lower_text: 'MMMM',
|
lower_text: 'MMMM',
|
||||||
upper_text: (d, ld, lang) =>
|
upper_text: (d, ld, lang) =>
|
||||||
d.getMonth() !== ld.getMonth()
|
!ld || d.getFullYear() !== ld.getFullYear()
|
||||||
? date_utils.format(d, 'YYYY', lang)
|
? date_utils.format(d, 'YYYY', lang)
|
||||||
: '',
|
: '',
|
||||||
thick_line: (d) => d.getMonth() % 3 === 0,
|
thick_line: (d) => d.getMonth() % 3 === 0,
|
||||||
@ -83,16 +83,11 @@ const DEFAULT_VIEW_MODES = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Year',
|
name: 'Year',
|
||||||
padding: '1m',
|
padding: '2y',
|
||||||
step: '1y',
|
step: '1y',
|
||||||
column_width: 120,
|
column_width: 120,
|
||||||
format_string: 'YYYY',
|
format_string: 'YYYY',
|
||||||
lower_text: 'YYYY',
|
upper_text: 'YYYY',
|
||||||
upper_text: (d, ld, lang) =>
|
|
||||||
d.getMonth() !== ld.getMonth()
|
|
||||||
? date_utils.format(d, 'YYYY', lang)
|
|
||||||
: '',
|
|
||||||
upper_text_frequency: 30,
|
|
||||||
default_snap: '30d',
|
default_snap: '30d',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
17
src/index.js
17
src/index.js
@ -569,7 +569,6 @@ export default class Gantt {
|
|||||||
* @returns Object containing the x-axis distance and date of the current date, or null if the current date is out of the gantt range.
|
* @returns Object containing the x-axis distance and date of the current date, or null if the current date is out of the gantt range.
|
||||||
*/
|
*/
|
||||||
computeGridHighlightDimensions(view_mode) {
|
computeGridHighlightDimensions(view_mode) {
|
||||||
|
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
if (today < this.gantt_start || today > this.gantt_end) return null;
|
if (today < this.gantt_start || today > this.gantt_end) return null;
|
||||||
let diff_in_units = date_utils.diff(
|
let diff_in_units = date_utils.diff(
|
||||||
@ -611,7 +610,6 @@ export default class Gantt {
|
|||||||
if ($today) {
|
if ($today) {
|
||||||
$today.classList.add('current-date-highlight');
|
$today.classList.add('current-date-highlight');
|
||||||
$today.style.top = +$today.style.top.slice(0, -2) - 4 + 'px';
|
$today.style.top = +$today.style.top.slice(0, -2) - 4 + 'px';
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,26 +658,25 @@ export default class Gantt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_dates_to_draw() {
|
get_dates_to_draw() {
|
||||||
let last_date = null;
|
let last_date_info = null;
|
||||||
const dates = this.dates.map((date, i) => {
|
const dates = this.dates.map((date, i) => {
|
||||||
const d = this.get_date_info(date, last_date, i);
|
console.log('starting', date, last_date_info);
|
||||||
last_date = d;
|
const d = this.get_date_info(date, last_date_info, i);
|
||||||
|
last_date_info = d;
|
||||||
return d;
|
return d;
|
||||||
});
|
});
|
||||||
return dates;
|
return dates;
|
||||||
}
|
}
|
||||||
|
|
||||||
get_date_info(date, last_date_info) {
|
get_date_info(date, last_date_info) {
|
||||||
let last_date = last_date_info
|
let last_date = last_date_info ? last_date_info.date : null;
|
||||||
? last_date_info.date
|
|
||||||
: date_utils.add(date, 1, 'day');
|
|
||||||
|
|
||||||
let column_width = this.config.column_width;
|
let column_width = this.config.column_width;
|
||||||
|
|
||||||
const base_pos = {
|
const base_pos = {
|
||||||
x: last_date_info
|
x: last_date_info
|
||||||
? last_date_info.base_pos_x + last_date_info.column_width
|
? last_date_info.base_pos_x + last_date_info.column_width
|
||||||
: 0,
|
: 20,
|
||||||
lower_y: this.options.header_height - 20,
|
lower_y: this.options.header_height - 20,
|
||||||
upper_y: this.options.header_height - 50,
|
upper_y: this.options.header_height - 50,
|
||||||
};
|
};
|
||||||
@ -710,7 +707,7 @@ export default class Gantt {
|
|||||||
1) /
|
1) /
|
||||||
2,
|
2,
|
||||||
upper_y: base_pos.upper_y,
|
upper_y: base_pos.upper_y,
|
||||||
lower_x: base_pos.x + column_width / 2,
|
lower_x: base_pos.x + column_width / 2 - 20,
|
||||||
lower_y: base_pos.lower_y,
|
lower_y: base_pos.lower_y,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user