October 23, 2020, 09:07:30 AM

See more Support incidents in our old archived forum.

Author Topic: Global WorkTimeSchedule w/ individual Bar Schedules  (Read 5246 times)

michael.fried

  • Customers
  • Newbie
  • *
  • Posts: 23
Global WorkTimeSchedule w/ individual Bar Schedules
« on: January 14, 2015, 10:21:06 PM »
Hi again,

Quick question: I want to show (gray background) public holidays additionally to weekends in the GanntChart (i.e. a global WorkTimeSchedule). However, I also need a custom Schedule for each operation (i.e. weekends/holidays are not necessarily nonworkinghours).

When defining a global Schedule as well as individual schedules the Bars do not render correctly any more.

Is there any workaround for achieving this functionallity?

I ran into this problem before see for reference:
http://newforum.radiantq.com/index.php?topic=17.msg79#msg79

Kind regards,
Michael

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 149
Re: Global WorkTimeSchedule w/ individual Bar Schedules
« Reply #1 on: January 15, 2015, 04:54:53 PM »
Michael,

In FlexyGantt:
a) To highlight certain dates (like holidays, weekends) use the CustomBackgroundRanges feature. Please refer "Samples\Common\CustomChartBackgroundRanges" sample. This will make the gantt simply color those dates, and not affect any scheduling.
b) Set the FlexyGantt's WorkTimeSchedule and your individual row-data's WorkTimeSchedule property to always indicate non-working hours, that will affect scheduling.


Thanks
Raja

michael.fried

  • Customers
  • Newbie
  • *
  • Posts: 23
Re: Global WorkTimeSchedule w/ individual Bar Schedules
« Reply #2 on: January 22, 2015, 10:30:32 AM »
Thanks Raja, works nicely :)

michael.fried

  • Customers
  • Newbie
  • *
  • Posts: 23
Re: Global WorkTimeSchedule w/ individual Bar Schedules
« Reply #3 on: January 22, 2015, 01:44:54 PM »
Hi again,

After playing around a bit I'm just facing a small issue. When loading CustomRanges from a background thread (in order to not block the rest of the UI) the custom ranges are not added.

Is there a possibility to refresh the gantt?

Example code for CustomChartBackgroundRanges project:

Code: [Select]
// Repeating Ranges
            customRangesInfos.ProvideRepeatingCustomRanges += new CustomRangeInformationEventHandler(
                  async delegate(object sender, CustomRangeInformationEventArgs args)
                  {
                      TimeSpan viewSpan = args.ViewEndTime - args.ViewStartTime;
                      // Don't provide repeating ranges above certain zoom levels.
                      if (viewSpan > TimeSpan.FromDays(5))
                          return;
                      var task = Task.Run(() => asdf());
                      await task;
                      DateTime start = args.ViewStartTime.Date;
                      while (start < args.ViewEndTime)
                      {
                          args.CustomRanges.Add(new CustomRangeInfo(start, start + TimeSpan.FromHours(5), this.LayoutRoot.Resources["dailyTimeOff"] as DataTemplate));
                          start += TimeSpan.FromDays(1);
                      }
                  });

            return customRangesInfos;           
        }

        private void asdf()
        {
            System.Threading.Thread.Sleep(5000);
        }

Kind regards,
Michael

Rajagopal

  • RQ Members
  • Full Member
  • *
  • Posts: 149
Re: Global WorkTimeSchedule w/ individual Bar Schedules
« Reply #4 on: January 23, 2015, 01:34:11 PM »
Michael,

We do expect the args to be set right when the event is fired (setting it later in a bg thread wouldn't work). Is this because you want to ensure zoom in/out is fast? We have optimized things pretty well, so as long as your handlers for this event are also written efficiently this shouldn't slow zooming down.


Thanks,
-Raja.

michael.fried

  • Customers
  • Newbie
  • *
  • Posts: 23
Re: Global WorkTimeSchedule w/ individual Bar Schedules
« Reply #5 on: January 26, 2015, 10:27:34 AM »
Hi Raja,

I see your point. I'm loading public holidays from an external source (which I necessarily have to do on a BG Thread) when paging/zooming which either freezes the UI (when waiting for the BGT) or does not show the CustomBackgrounds.

In this scenario should use DiscreetCustomRanges instead of the event logic ProvideRepeatingCustomRanges?

Thanks,
Michael

ForumAdmin

  • Administrator
  • Jr. Member
  • *****
  • Posts: 89
Re: Global WorkTimeSchedule w/ individual Bar Schedules
« Reply #6 on: January 27, 2015, 06:25:46 PM »
Michael,

So, when the gantt's visible timeline changes, you listen to that and call an external source, passing in the current visible timeline in the gantt, asking for public holidays in that timeline?

Thanks
RadiantQ Support

michael.fried

  • Customers
  • Newbie
  • *
  • Posts: 23
Re: Global WorkTimeSchedule w/ individual Bar Schedules
« Reply #7 on: January 29, 2015, 02:54:38 PM »
Hi Raja,

Basically yes. As soon as the view changes (through zooming or paging) i load a list of public holidays from an external source which takes some time. I do cache the list of holidays but the first load operation still freezes the UI. 

ForumAdmin

  • Administrator
  • Jr. Member
  • *****
  • Posts: 89
Re: Global WorkTimeSchedule w/ individual Bar Schedules
« Reply #8 on: January 30, 2015, 06:24:59 PM »
Michael,

Yes, in this case, it would be better if you simply retrieve the public holidays for a reasonable range right at the beginning, on load, and use DiscreetCustomRanges to color these ranges appropriately.

You can continue to monitor time line changes and if the user happens to browse to a range outside the cached range for which you know the holidays, you then fire another call to the external source to retrieve more holiday info and update the DiscreetCustomRanges again.

Thanks
RadiantQ Support