PertChart
A PERT chart: the plan as a network of boxes, one for each piece of work, joined by arrows in the order the work has to happen, with the dates the critical-path method gives each task.
public partial class PertChart : Control
Inherits from / implements: Control
Remarks
Give the chart the same Tasks and Links as a Gantt chart or a task board and the three agree: they schedule the same objects with the same arithmetic, and a change made in any of them is seen by all. Each box shows the task's name, then its earliest start, duration and earliest finish, then its latest start, total float and latest finish. A summary task is not a box: a PERT chart shows the work, not the outline it is filed in. The chart is one tab stop. The arrow keys move between boxes - Right to the nearest task that follows, Left to the nearest it follows, Up and Down along a column - Home and End go to the first and last box, and Enter raises TaskActivated. Drag the background to pan, use the wheel to scroll, and hold Ctrl with the wheel, or with Plus and Minus, to zoom.
Members at a glance
PertChart | Creates an empty PERT chart. |
ColumnGap | The space between columns of boxes, in logical units, where the connectors turn. 64 by default, and never less than 24. |
CriticalBrush | The outline of a critical box, the connectors along the critical path and a critical task's float. A red-orange by default. |
Holidays | Dates that are not worked, beside the days WorkingWeek leaves out. Never null; an observable collection is watched. |
LinkBrush | The connectors that are not on the critical path. A grey by default. |
Links | The links between tasks. Never null; setting null gives the chart an empty list of its own. |
NodeBackgroundBrush | The fill of a box. Null, the default, fills boxes with the chart's Background, so that they follow a light or a dark theme. |
NodeBorderBrush | The outline of a box and the lines inside it. A mid grey by default, which reads on light and dark alike. |
NodeHeight | The height of a box, in logical units. 92 by default; a box is never drawn shorter than 48, the least that holds its three rows of text. |
NodeWidth | The width of a box, in logical units (1/96 inch). 188 by default; a box is never drawn narrower than 80, the least that holds three short dates side by side. |
ProgressBrush | The progress bar along the bottom of a box. A calm blue by default. |
ProjectStart | The first day work can happen. Null starts the plan at its earliest planned date, or today when no task has one. |
RowGap | The space between rows of boxes, in logical units, where connectors that skip a column run. 28 by default, and never less than 8. |
Schedule | The plan as last scheduled: every task's early and late dates, its float, and the critical path. Scheduled again first when anything has changed. |
SelectedTask | The selected task, which is also the box the arrow keys move from; null when none is. A task that is not a box of this chart - a summary, or one not in Tasks - selects nothing. |
SelectionBrush | The ring round the selected box and the connectors into and out of it. Null, the default, uses the system's highlight colour. |
ShowCriticalPath | Draws the critical tasks and the links between them in CriticalBrush. True by default. |
Tasks | The tasks: a flat list in outline order, each naming its parent. Never null; setting null gives the chart an empty list of its own. |
Today | The date the charts treat as today; null for the computer's own date. The Gantt chart draws its today line here. A PERT chart has no timeline and draws nothing for it; the property is here so that one set of settings can be given to all three charts alike. |
VisualChildrenCount | The children are the two scroll bars; everything else is drawn. |
WorkingWeek | The days of the week that are worked. Monday to Friday by default. |
ZoomFactor | How large the network is drawn: 1 is its own size, 0.25 the smallest and 3 the largest. Ctrl and the mouse wheel change it about the pointer. |
ArrangeOverride | Places the scroll bars, which appear only when the network is larger than the chart. |
ExportImage | Draws the whole chart as a picture, at its own size and zoom 1, whatever part of it is in view and whatever is selected. |
GetEnumerator | The scroll bars, as logical children, so that they inherit the chart's resources and font. |
GetVisualChild | Returns a scroll bar. |
MeasureOverride | Asks for the network's size at the current zoom, or the space available when that is less. |
OnCreateAutomationPeer | Gives UI Automation the chart as a list of boxes. |
OnDpiChanged | The scene and the text in it were drawn for a different screen density; draw them again. |
OnGotKeyboardFocus | Shows the focus cue and tells a screen reader which box is current. |
OnKeyDown | The arrows, Home and End move between boxes; Enter activates the selected one; the page keys scroll; Ctrl with Plus, Minus or 0 zooms. |
OnLostKeyboardFocus | Takes the focus cue away when the chart loses the keyboard. |
OnLostMouseCapture | A pan ends if something else takes the mouse, such as a window coming to the front. |
OnMouseLeave | Hides the tooltip when the pointer leaves the chart. |
OnMouseLeftButtonDown | Selects the box under the pointer, or starts panning from the background. |
OnMouseLeftButtonUp | Ends a pan. |
OnMouseMove | Pans while the background is dragged; otherwise follows the pointer for the tooltip and cursor. |
OnMouseWheel | Scrolls down and up; with Shift, across; with Ctrl, zooms about the pointer. |
OnPropertyChanged | Drops what was drawn from the inherited text and colour settings - the font, the foreground, the background, the language, the reading direction and the text formatting mode - when one changes. |
OnQueryCursor | A hand over a box, which can be chosen; a four-way arrow while panning. |
OnRender | Draws the chart: the scene under the view's transform, then the selection and focus over it. |
Reschedule | Schedules the plan again now and redraws. Needed only after changing a plain list that does not say when it changes, or a task in one. |
ScrollToTask | Scrolls the view, as little as it needs to, so that a task's box is in it. Nothing happens for a task that is not a box of this chart. |
ZoomIn | Draws the network larger, keeping the middle of the view where it is. |
ZoomOut | Draws the network smaller, keeping the middle of the view where it is. |
ZoomToFit | Chooses the zoom at which the whole network fits the chart, within the zoom's limits, and scrolls to its start. A chart not yet laid out does this as soon as it is. |
ScheduleChanged | Raised after the plan has been scheduled again because something changed: a task, a link, a collection, or one of the scheduling settings. |
SelectedTaskChanged | Raised when SelectedTask changes, by the reader or by the application. |
TaskActivated | Raised when the reader double-clicks a box, or presses Enter on the selected one. |
ZoomFactorChanged | Raised when ZoomFactor changes, by the reader or by the application. |
ColumnGapProperty | Identifies the ColumnGap dependency property. |
CriticalBrushProperty | Identifies the CriticalBrush dependency property. |
HolidaysProperty | Identifies the Holidays dependency property. |
LinkBrushProperty | Identifies the LinkBrush dependency property. |
LinksProperty | Identifies the Links dependency property. |
NodeBackgroundBrushProperty | Identifies the NodeBackgroundBrush dependency property. |
NodeBorderBrushProperty | Identifies the NodeBorderBrush dependency property. |
NodeHeightProperty | Identifies the NodeHeight dependency property. |
NodeWidthProperty | Identifies the NodeWidth dependency property. |
ProgressBrushProperty | Identifies the ProgressBrush dependency property. |
ProjectStartProperty | Identifies the ProjectStart dependency property. |
RowGapProperty | Identifies the RowGap dependency property. |
SelectedTaskProperty | Identifies the SelectedTask dependency property. |
SelectionBrushProperty | Identifies the SelectionBrush dependency property. |
ShowCriticalPathProperty | Identifies the ShowCriticalPath dependency property. |
TasksProperty | Identifies the Tasks dependency property. |
TodayProperty | Identifies the Today dependency property. |
WorkingWeekProperty | Identifies the WorkingWeek dependency property. |
ZoomFactorProperty | Identifies the ZoomFactor dependency property. |
Constructors
PertChart
Creates an empty PERT chart.
Properties
ColumnGap
The space between columns of boxes, in logical units, where the connectors turn. 64 by default, and never less than 24.
CriticalBrush
The outline of a critical box, the connectors along the critical path and a critical task's float. A red-orange by default.
Holidays
Dates that are not worked, beside the days WorkingWeek leaves out. Never null; an observable collection is watched.
LinkBrush
The connectors that are not on the critical path. A grey by default.
Links
The links between tasks. Never null; setting null gives the chart an empty list of its own.
NodeBackgroundBrush
The fill of a box. Null, the default, fills boxes with the chart's Background, so that they follow a light or a dark theme.
NodeBorderBrush
The outline of a box and the lines inside it. A mid grey by default, which reads on light and dark alike.
NodeHeight
The height of a box, in logical units. 92 by default; a box is never drawn shorter than 48, the least that holds its three rows of text.
NodeWidth
The width of a box, in logical units (1/96 inch). 188 by default; a box is never drawn narrower than 80, the least that holds three short dates side by side.
ProgressBrush
The progress bar along the bottom of a box. A calm blue by default.
ProjectStart
The first day work can happen. Null starts the plan at its earliest planned date, or today when no task has one.
RowGap
The space between rows of boxes, in logical units, where connectors that skip a column run. 28 by default, and never less than 8.
Schedule
The plan as last scheduled: every task's early and late dates, its float, and the critical path. Scheduled again first when anything has changed.
SelectedTask
The selected task, which is also the box the arrow keys move from; null when none is. A task that is not a box of this chart - a summary, or one not in Tasks - selects nothing.
SelectionBrush
The ring round the selected box and the connectors into and out of it. Null, the default, uses the system's highlight colour.
ShowCriticalPath
Draws the critical tasks and the links between them in CriticalBrush. True by default.
Tasks
The tasks: a flat list in outline order, each naming its parent. Never null; setting null gives the chart an empty list of its own.
ObservableCollection{T} or a BindingList is watched, and so is every task in it. A plain list is read when it is assigned; call Reschedule after changing one.Today
The date the charts treat as today; null for the computer's own date. The Gantt chart draws its today line here. A PERT chart has no timeline and draws nothing for it; the property is here so that one set of settings can be given to all three charts alike.
VisualChildrenCount
The children are the two scroll bars; everything else is drawn.
WorkingWeek
The days of the week that are worked. Monday to Friday by default.
ZoomFactor
How large the network is drawn: 1 is its own size, 0.25 the smallest and 3 the largest. Ctrl and the mouse wheel change it about the pointer.
Methods
ArrangeOverride
Places the scroll bars, which appear only when the network is larger than the chart.
- arrangeBounds
- The size the chart has been given.
Returns. The size used: all of it.
ExportImage
Draws the whole chart as a picture, at its own size and zoom 1, whatever part of it is in view and whatever is selected.
- dpi
- Dots per inch of the image; 96 is one pixel per logical unit.
Returns. The image, frozen so that it can be used on any thread.
- ArgumentOutOfRangeException
dpiis not a positive number.
dpi that fits; its DpiX says which.GetEnumerator
The scroll bars, as logical children, so that they inherit the chart's resources and font.
GetVisualChild
Returns a scroll bar.
- index
- 0 for the vertical bar, 1 for the horizontal.
Returns. The scroll bar.
MeasureOverride
Asks for the network's size at the current zoom, or the space available when that is less.
- constraint
- The space available.
Returns. The size wanted.
OnCreateAutomationPeer
Gives UI Automation the chart as a list of boxes.
Returns. The chart's automation peer.
OnDpiChanged
The scene and the text in it were drawn for a different screen density; draw them again.
- oldDpi
- The density before.
- newDpi
- The density now.
OnGotKeyboardFocus
Shows the focus cue and tells a screen reader which box is current.
- e
- The event data.
OnKeyDown
The arrows, Home and End move between boxes; Enter activates the selected one; the page keys scroll; Ctrl with Plus, Minus or 0 zooms.
- e
- The key.
OnLostKeyboardFocus
Takes the focus cue away when the chart loses the keyboard.
- e
- The event data.
OnLostMouseCapture
A pan ends if something else takes the mouse, such as a window coming to the front.
- e
- The event data.
OnMouseLeave
Hides the tooltip when the pointer leaves the chart.
- e
- The event data.
OnMouseLeftButtonDown
Selects the box under the pointer, or starts panning from the background.
- e
- The press.
OnMouseLeftButtonUp
Ends a pan.
- e
- The release.
OnMouseMove
Pans while the background is dragged; otherwise follows the pointer for the tooltip and cursor.
- e
- The move.
OnMouseWheel
Scrolls down and up; with Shift, across; with Ctrl, zooms about the pointer.
- e
- The wheel turn.
OnPropertyChanged
Drops what was drawn from the inherited text and colour settings - the font, the foreground, the background, the language, the reading direction and the text formatting mode - when one changes.
- e
- The property that changed.
OnQueryCursor
A hand over a box, which can be chosen; a four-way arrow while panning.
- e
- The event data.
OnRender
Draws the chart: the scene under the view's transform, then the selection and focus over it.
- drawingContext
- Where to draw.
Reschedule
Schedules the plan again now and redraws. Needed only after changing a plain list that does not say when it changes, or a task in one.
ScrollToTask
Scrolls the view, as little as it needs to, so that a task's box is in it. Nothing happens for a task that is not a box of this chart.
- task
- The task to show.
ZoomIn
Draws the network larger, keeping the middle of the view where it is.
ZoomOut
Draws the network smaller, keeping the middle of the view where it is.
ZoomToFit
Chooses the zoom at which the whole network fits the chart, within the zoom's limits, and scrolls to its start. A chart not yet laid out does this as soon as it is.
Events
ScheduleChanged
Raised after the plan has been scheduled again because something changed: a task, a link, a collection, or one of the scheduling settings.
SelectedTaskChanged
Raised when SelectedTask changes, by the reader or by the application.
TaskActivated
Raised when the reader double-clicks a box, or presses Enter on the selected one.
ZoomFactorChanged
Raised when ZoomFactor changes, by the reader or by the application.
Fields
ColumnGapProperty
Identifies the ColumnGap dependency property.
CriticalBrushProperty
Identifies the CriticalBrush dependency property.
HolidaysProperty
Identifies the Holidays dependency property.
LinkBrushProperty
Identifies the LinkBrush dependency property.
LinksProperty
Identifies the Links dependency property.
NodeBackgroundBrushProperty
Identifies the NodeBackgroundBrush dependency property.
NodeBorderBrushProperty
Identifies the NodeBorderBrush dependency property.
NodeHeightProperty
Identifies the NodeHeight dependency property.
NodeWidthProperty
Identifies the NodeWidth dependency property.
ProgressBrushProperty
Identifies the ProgressBrush dependency property.
ProjectStartProperty
Identifies the ProjectStart dependency property.
RowGapProperty
Identifies the RowGap dependency property.
SelectedTaskProperty
Identifies the SelectedTask dependency property.
SelectionBrushProperty
Identifies the SelectionBrush dependency property.
ShowCriticalPathProperty
Identifies the ShowCriticalPath dependency property.
TasksProperty
Identifies the Tasks dependency property.
TodayProperty
Identifies the Today dependency property.
WorkingWeekProperty
Identifies the WorkingWeek dependency property.
ZoomFactorProperty
Identifies the ZoomFactor dependency property.