• Tidak ada hasil yang ditemukan

PDF Drawing Gantt Charts in LATEX with Ti Z

N/A
N/A
Nguyễn Gia Hào

Academic year: 2023

Membagikan "PDF Drawing Gantt Charts in LATEX with Ti Z"

Copied!
54
0
0

Teks penuh

Overview

Specifying Keys

You can specify a key in two ways: (1) Pass it to the optional argument present in each command, e.g.

The Canvas

The key can be specified in four different ways: First, hgrid=false eliminates the horizontal grid. Second, activate bothhgriddandhgrid=true the horizontal grid, which is then drawn in the default dotted style. You must explicitly change the style of the horizontal grid with the grid style if you only want to draw selected grid lines with \ganttnewline[grid](see section 2.4).

If the chart contains many time slots, drawing vertical grid lines between them all will lead to a confusing picture. Consequently, the horizontal grid lines must be shifted up (ie, along the negative y-axis) from their standard positions (see graph at left). Otherwise, they will collide with the top of the bars (see graphic on the right).

With the default spacing parameters, the last line will be too tall and the element it contains will appear vertically offset (see the diagram on the left). This rule appears in hstylei denoted by today's rule, while label today contains thehtexti below the rule.

Line Breaks between Chart Elements

Titles

To draw twelve title elements containing the numbers 1 to 12 (denoting the months of a year), enter 1,..,12 as the hpgffori list. However, you must use the title label's font key if you intend to change the font size. Otherwise, the vertical alignment of the title label will be incorrect with the default anchor.

The first three keys move the coordinates of the edges of the title element (or its corners), and the height of the title changes its height. The figure below shows a Gantt chart with two lines and one (large) time slot, and indicates the distances changed by these keys. For example, you can design a layout where the title element does not touch the edges of the start and end timeslot.

However, you may want your title elements to consist only of text that lacks a frame or background. In this case, the canvas should probably exclude all lines containing title elements, which you achieve by including title in canvas=false.

Bars

Note that a bar usually touches the left boundary of the start time slot rather than the right, as it would if the start time slot were strictly interpreted as anx-coordinate. This feature can be useful if you decide to use real numbers for several time periods. This switch must contain a single parameter token (#1), which is replaced by the mandatory first argument of \ganttbar.

The first three keys move the coordinates of the borders of the bar (or rather its corners), while the height of the bar changes its height. For example, you can create a layout with small, rounded bars that do not touch the boundaries of the start and end time ranges.

Groups

This key must contain a single parameter token (#1), which is replaced by the mandatory first argument of \ganttgroup. \strut at default value ensures equal vertical spacing of labels. group label font selects the group label font, group label anchor defines its anchor. The first three keys move the coordinates of the borders of a group (or rather its corners), while the height of the group changes its height.

By default, the top of each peak extends 0.2 units inward from the bottom corner of a group and 0.1 unit down, while the groove extends 0.4 units inward. While group top left only applies to the left top and group top right only affects the right top, group top sets the dimensions for both tops simultaneously. For example, you may prefer that your groups stay within the start and end time period and that the peaks are sharper:.

Progress Bars and Progress Groups

By changing the default value, you can prevent the label from overlapping with other elements in your chart.

Milestones

This key must contain a single parameter token (#1), which is replaced by the first mandatory argument of \ganttmilestone. The last macro in hfont commandsi can take a single argument, as we show in the following (somewhat silly) example. These keys set the width and height of a milestone and move the coordinates of its center.

Since the ideal x-vector/y-vector ratio of the parent image is 1:2, the timeline looks square with these settings. Its center lies at the right boundary and 0.2 units below the upper boundary of its time slot. The figure below shows a Gantt chart with a single milestone and two (major) time periods; it shows the distances modified by the four keys explained above.

Links

The syntax for a link type key is similar to the syntax for specifying arrow tips in TikZ: each such key is composed of two letters separated by a hyphen. Note that it is the default link type, so you don't need to specify it to connect two columns. As you can see from this graph, arrow-like links consist of three segments (two horizontal, one vertical) if their start and end time slots are sufficiently separated.

The middle link key changes the position of a single vertical segment (in three-part links) or the middle horizontal segment (in five-part links). By default, these segments are horizontally centered between the left and right vertical segments or vertically centered between the top and bottom horizontal segments. If the truex coordinates of the link start and end differ by at least the link tolerance (this is the case for the second link in the example below), the package draws a five-part link.

They are only intended to connect two bars together to establish start-to-end relationships (s-f), start-to-start relationships (s-s), etc. You can redefine these labels with the link label key, which changes the hlabeltexti for ahlink-type keyi. The link label font key specifies the font for the label, the link label anchor determines its placement (by default, the label appears to the right of the center of the straight link).

Linked Bars and Linked Milestones

Style Examples

More precisely, the code below tries to render the Gantt chart from the English Wikipedia website, see http://en.wikipedia.org/wiki/Gantt_chart.).

Packages

Global Counters and Booleans

Macros for Key Management

Option Declarations

The Main Environment

If we exclude the title from the canvas, we'll omit the top horizontal gridline because it coincides with the canvas border.

Starting a New Line

Title Elements

Bars

Since the latter always starts after the last time slot occupied by the previous element, Since the first bar clearly appears after the last line containing a title element, we set the \ifgtt@intitleto boolean false.

Links

Otherwise, the elements lie in adjacent time spaces or even overlap, in this case we draw an arrow of five parts. For elements that lie on the same line, we draw an arrow only if they are separated by at least a certain place. Due to our conventions for specifying time slots instead of "real" x-coordinates, some subtleties arise.

The rest is simple: A vertical line connects the two elements; the label is anchored halfway between the start and end coordinates.

Groups

This macro does nothing unless (a) the progress key is different from none and (b) the progress label text is different from \relax.

Milestones

If the first mandatory argument i\ganttmilestone is not empty, we print a label whose anchor extends to the left border of the canvas at the height of the center of the milestone.

Referensi

Dokumen terkait

We reported a case of congenital muscular torticollis, characterized with shortening of the right sternocleidomastoid muscle, with head leaning to the right and turning to the