pnp / List-Formatting

List Formatting Samples for use in SharePoint and Microsoft Lists
https://pnp.github.io/List-Formatting/
MIT License
1.74k stars 833 forks source link

Let's make SAMPLE even better! #579

Closed boileru closed 11 months ago

boileru commented 2 years ago

generic-yearly-gantt-chart/

Suggestion (the more details, the better)

I am trying to use this for start and ends dates from 2022 and into 2023. For example, Jan 2022 = 0, July 2022 = 6, Dec 2022= 12, June 2023 = 18, Dec 2023 = 24. essentially to be able to see a full 2 year window for projects. However, not able to get the dark bars to line up to the right places . In the first row in the example , the start date is correct at 2/1/2022 but it should end at 8/01/2022 but goes further than it should

image Capturesharepoint

josephspengler commented 1 year ago

You didn't include your code, but it sounds like your issue is in "width" formula. Specifically I'm guessing you didn't change the denominator to divide by two years instead of one year.

The code in the repo is: "width": "=((Number(Date([$End])) - Number(Date([$Start]))) / (Number(Date('' + getYear([$Start]) + '/12/31')) - Number(Date('' + getYear([$Start]) + '/01/01')))) * 100 + '%'",

You probably want to change that denominator to be two years

tecchan1107 commented 11 months ago

I created a column formatting that allows you to set the start and end dates of the Gantt chart to any value. If you want to create a Gantt chart for two years, please use the following column formatting. https://github.com/pnp/List-Formatting/tree/master/column-samples/generic-gantt-chart