search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Use Duration Bar as "Percent Complete"

Asked by David
9 years ago.

Is the duration bar in the scheduler "hard-coded" to the start and end times of the entry? We have scheduler entries (tasks or jobs) that stretch over several days or weeks and would like to use the duration bar as a "percentage complete", based on properties of the datasource. That way our managers can see the progress of a task at a glance.

Comment posted by Dan Letecky [DayPilot]
9 years ago.

Yes, at this moment it is used to show the actual start and end.

Please let me check how to change it to show the percentage, it shouldn't be that difficult.

Answer posted by Dan Letecky [DayPilot]
9 years ago.

It's now implemented in the latest sandbox build (2662). See here:

http://www.daypilot.org/sandbox/Scheduler/PercentComplete.aspx

Use DurationBarMode = "PercentComplete" and e.PercentComplete = 50; in BeforeEventRender event handler.

Just note that the API (especially DurationBarMode property) may be changed a bit for 7.1 release:

http://www.daypilot.org/daypilot-pro-for-asp-net-webforms-7-1.html

Comment posted by Ruben
9 years ago.

Is there a possibility to change the colour of the percentbar from the BeforeEventRender?
Lets say, I want to colour the percentbar in green under 30%, in orange between 31% and 70%, and red if more than 71%?

Comment posted by Dan Letecky [DayPilot]
9 years ago.

You can add custom CSS class to events in BeforeEventRender, depending on the conditions, e.g. "complete30", "complete70", "complete100".

Then define the CSS rules (an example for scheduler_green theme):

.scheduler_green_event_bar_inner  
{
	position: absolute;
	height: 2px;
}

.complete30 .scheduler_green_event_bar_inner  
{
	background-color: green;
}
.complete70 .scheduler_green_event_bar_inner  
{
	background-color: orange;
}
.complete100 .scheduler_green_event_bar_inner  
{
	background-color: red;
}

Answer posted by Ruben
9 years ago.

Hi Dan,

thanks for the reply. This was a great proposal

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.