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

DurationBar for DayPilotMonth object

Asked by pretty rose
7 years ago.

i want to add DurationBar in DayPilotMonth object like DayPilotCalendar object . Pls Help me.

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

DayPilot Month doesn't have built-in duration bar support. However, you can add a custom bar easily using "active areas" (in the Pro version):

protected void DayPilotMonth1_BeforeEventRender(object sender, DayPilot.Web.Ui.Events.Month.BeforeEventRenderEventArgs e)
{
  e.Areas.Add(new Area().Left(2).Top(2).Right(2).Height(5).BackColor("red").Visible());
}

This code will add a red bar to the top of the event. If you want to use variable width you can use an inner div with percentage:

protected void DayPilotMonth1_BeforeEventRender(object sender, DayPilot.Web.Ui.Events.Month.BeforeEventRenderEventArgs e)
{
  e.Areas.Add(new Area().Left(2).Top(2).Right(2).Height(5).Html("<div style='background-color:red; position: absolute; left: 30%; width: 40%; top: 0px; bottom: 0px'></div>").Visible());
}

This will display a red bar from 30% to 70% inside the event.

See also:
https://doc.daypilot.org/month/event-active-areas/

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