Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label rows in left, current time marker and week precision #102

Merged
merged 28 commits into from
Mar 19, 2024

Conversation

Pedrocanoas
Copy link
Contributor

Hey folks!

This PR brings the functionality of placing the row labels in a separate column to the left, instead of being next to the bars

#31 -> Placing line labels to the left

Some examples of how the functionality looked:
2024-03-09_20-20
2024-03-09_20-19

I apologize, but I just noticed that this PR has the same changes as before (#101) Anyone to help ?

Pedrocanoas and others added 20 commits February 28, 2024 19:51
adding DyslexiaS's change from PR zunnzunn#20; adjusting week start of the year
adjusting tooltip text
adjusting the end of the lowe unit
adjusting configs
creating current time component; adjusting color schemes to receive new fields
adjusting version
refactoring the logic of units time
adjusting the dynamic format
creating a column with labels on the left side of the gantt; leaving the feature dynamic and optional; adjusting the lint of existing code
border: `1px dashed ${colors.markerCurrentTime}`
}"
/>
<span class="g-grid-current-time-text" :style="{ color: colors.markerCurrentTime }">TODAY</span>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"TODAY" is not always a fitting label, e.g. in case the time range of the chart (chart-start - chart-end) is within a single day. It'd be good to omit the label or, even better, make it an optional prop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by default, i changed the span to NOW, but now it's possible to change the span and the div with a <slot> tag

Default behaviour:
image

Custom behaviour:
image
image

Copy link
Owner

@zunnzunn zunnzunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request is much appreciated! The features it brings have been highly anticipated. I have addressed some issues that ought to be resolved before we merge this.
PR #101 will be deleted as it is fully included in this PR.

@@ -0,0 +1,70 @@
<template>
<div class="g-gantt-column" :style="{ fontFamily: font, color: colors.text }">
<span class="g-gantt-header" :style="{ background: colors.primary }">{{ columnTitle }}</span>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we are at it, we could expose a <slot>for the label column title.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by default, column title and label are the same behaviour before, but now it's possible to change them with a <slot> tag

Default behaviour:
image

Custom behaviour:
image
image

making the changes requested by zunnzunn
making the changes requested by zunnzunn
adjusting lint code
@zunnzunn zunnzunn changed the title Label rows in left Label rows in left, current time marker and week precision Mar 16, 2024
@@ -68,6 +92,9 @@ export interface GGanttChartProps {
rowHeight?: number
highlightedUnits?: number[]
font?: string
labels?: string[]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prop seems to be superfluous. I assume it's a leftover from some other implementation you have tried? Anyways, it should be deleted.

@@ -153,6 +184,32 @@ const getChartRows = () => {
return allBars
}

const labels = computed(() => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is basically a duplicate of getChartRows(). It'd be better to extend getChartRows() so that it collects the row labels alongside the bars.

@zunnzunn zunnzunn self-assigned this Mar 17, 2024
@zunnzunn zunnzunn added the enhancement New feature or request label Mar 17, 2024
@zunnzunn
Copy link
Owner

zunnzunn commented Mar 17, 2024

@Pedrocanoas Since I haven't been working on this repo for a while, I got the urge to step in and address all the aforementioned issues together with you. A pleasant collaboration with you! 😄
When using precision="week", the calendar weeks follow the US standard of starting on Sunday (hence, at the moment of writing this comment, the calendar week is 12 instead of 11). It makes more sense to stick to the more formal ISO-8601 standard by default and ideally provide a prop for toggling that behavior.

@zunnzunn
Copy link
Owner

The formatting of the tooltip text for precision="week" as well as the position of the time marker (at the moment of writing this comment, it's Sunday, March 17th, which should be at the end of week 11, not at the beginning) need to be fixed:
image

@zunnzunn
Copy link
Owner

Alright, we are done here! New release with these features coming next week!

@zunnzunn zunnzunn self-requested a review March 17, 2024 17:15
@Pedrocanoas
Copy link
Contributor Author

Alright, we are done here! New release with these features coming next week!

I am happy to collaborate with this project and for having accepted my features. I hope to continue contributing to the open source community

@zunnzunn zunnzunn merged commit 4db55d4 into zunnzunn:master Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants