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

wide margins with empty days around activities (undocumented scrollableHorizonFactor) #73

Open
watery opened this issue Apr 11, 2023 · 1 comment

Comments

@watery
Copy link

watery commented Apr 11, 2023

This can be seen in the Activity Chart example:

immagine

By scrolling to the left of the first activity, a lot of days are present, but empty; the same is rendered to the right, after the last activity.

I've tracked down this behavoiur to these lines:

this.scrollableHorizon = {
start: Math.round(start - ((this.scrollableHorizonFactor - 1) / 2) * span),
end: Math.round(end + ((this.scrollableHorizonFactor - 1) / 2) * span),
};

Where scrollableHorizonFactor is used to calculate the (vis) Timeline component start and end parameters from the activity times. It can be configured too, thus giving it a value of e.g. 1.2 brings the component to a much narrow size:

const config = {
  scrollableHorizonFactor: 1.2,
  type: Gantt.type.ACTIVITY_CHART,
  data: {

A couple of notes:

  1. the configuration parameter is undocumented
  2. it is still a multiplicative factor, so the wider the span (difference between the start of the earlier activity and end of the later one) the bigger the empty timeline areas - it would be better if a fixed margin / padding was available
@watery
Copy link
Author

watery commented Apr 11, 2023

Configuring the timeWindow seems to have an effect on the timetable area, so with:

const config = {
  scrollableHorizonFactor: 1,
  type: Gantt.type.ACTIVITY_CHART,
  data: {
    timeWindow: {
        data: {
          start: '2023-04-01 00:00:00',
          end: '2023-05-16 00:00:00',
        },
    },
    dateFormat : "yyyy-MM-dd HH:mm:ss",

The whole chart can be centered and maximized so there's almost no need for horizontal scrolling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant