RadiantQ Forum
Product => WPF Gantt Package => Topic started by: michael.fried 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
-
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
-
Thanks Raja, works nicely :)
-
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:
// 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
-
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.
-
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
-
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
-
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.
-
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