Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Inhalt:

  • Füllen von Daten

  • Properties

Allgemein

Detailierte Information finden Sie zusätzlich hier: https://developers.google.com/chart/interactive/docs/gallery/ganttchart

Beispiel: Füllen der Daten

final ChartModel model = ChartModel.New()
	.addColumn(Column.New(Column.Type.STRING, "topic", "topic"))
	.addColumn(Column.New(Column.Type.STRING, "task", "task"))
	.addColumn(Column.New(Column.Type.DATE, "startDate", "startDate"))
	.addColumn(Column.New(Column.Type.DATE, "endDate", "endDate"))
	.addColumn(Column.New(Column.Type.NUMBER, "duration", "duration"))
	.addColumn(Column.New(Column.Type.NUMBER, "percentcomplete", "percentcomplete"))
	.addColumn(Column.New(Column.Type.STRING, "dependencies", "dependencies"));

model.addRow("Research", "Find sources",
	LocalDate.of(2015, 1, 1), LocalDate.of(2015, 1, 5), null, 100, null);
model.addRow("Write", "Write paper",
	null, LocalDate.of(2015, 1, 9), Duration.ofDays(3).toMillis(), 25, "Research,Outline");
model.addRow("Cite", "Create bibliography",
	null, LocalDate.of(2015, 1, 7), Duration.ofDays(1).toMillis(), 20, "Research");
model.addRow("Complete", "Hand in paper",
	null, LocalDate.of(2015, 1, 10), Duration.ofDays(1).toMillis(), 0, "Cite,Write");
model.addRow("Outline", "Outline paper",
	null, LocalDate.of(2015, 1, 6), Duration.ofDays(1).toMillis(), 100, "Research");

this.ganttChart.setModel(model);

API und Methoden:

Properties

Gantt Arrow Configuration

Examle:

final Arrow arrow = Arrow.Builder()
	.angle(1)
	.color("blue")
	.length(4)
	.radius(0)
	.spaceAfter(3)
	.build();

.angle

.color

Gantt Configuration

A suffix to be added to all values in the legend and tick labels in the vertical axes.

annotationChart.setAllValuesSuffix("Suf");

AnnotationWidth

The width (in percent) of the annotations area, out of the entire chart area. Must be a number in the range 5-80.

annotationChart.setAnnotationsWidth(10);

DateFormat

The format used to display the date information in the top right corner. The format of this field is as specified by the java SimpleDateFormat class.

annotationChart.setDateFormat("HH:mm MMMM dd, yyyy");

Default: Either 'MMMM dd, yyyy' or 'HH:mm MMMM dd, yyyy', depending on the type of the first column (date, or datetime, respectively).

DisplayAnnotations

If set to false, the chart will hide the annotations table, and the annotations and annotationText will not be visible (the annotations table will also not be displayed if there are no annotations in your data, regardless of this option). When this option is set to true, after every numeric column, two optional annotation string columns can be added, one for the annotation title and one for the annotation text.

annotationChart.setDisplayAnnotations(true);

DisplayAnnotationFilter

If set to true, the chart will display a filter control to filter annotations. Use this option when there are many annotations.

annotationChart.setDisplayAnnotationsFilter(true);

DisplayDateBarSeparator

Whether to display a small bar separator ( | ) between the series values and the date in the legend, where true means yes.

annotationChart.setDisplayDateBarSeparator(true);

DisplayExactValues

Whether to display a shortened, rounded version of the values on the top of the graph, to save space; false indicates that it may. For example, if set to false, 56123.45 might be displayed as 56.12k.

annotationChart.setDisplayExactValues(true);

DisplayLegendDots

Whether to display dots next to the values in the legend text, where true means yes.

annotationChart.setDisplayLegendDots(true);

DisplayLegendValues

Whether to display the highlighted values in the legend, where true means yes.

annotationChart.setDisplayLegendValues(true);

DisplayRangeSelector

Whether to show the zoom range selection area (the area at the bottom of the chart), where false means no. The outline in the zoom selector is a log scale version of the first series in the chart, scaled to fit the height of the zoom selector.

annotationChart.setDisplayRangeSelector(true);

DisplayZoomButtons

Whether to show the zoom buttons ("1d 5d 1m" and so on), where false means no.

annotationChart.setDisplayZoomButtons(true);

Fill

A number from 0—100 (inclusive) specifying the alpha of the fill below each line in the line graph. 100 means 100% opaque, and 0 means no fill at all. The fill color is the same color as the line above it.

annotationChart.setFill(50);

LegenPosition

Whether to put the colored legend on the same row with the zoom buttons and the date ('sameRow'), or on a new row ('newRow').

annotationChart.setLegendPosition(LegendPosition.SAME_ROW);

ScaleFormat

Number format to be used for the axis tick labels. The default of '#' displays as an integer.

annotationChart.setScaleFormat("#");

NumberFormats

Specifies the number format patterns to be used to format the values at the top of the graph.

The patterns should be in the format as specified by: https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html

  • If not specified, the default format pattern is used.

  • If a single string pattern is specified, it is used for all of the values.

  • If a map is specified, the keys are (zero-based) indexes of series, and the values are the patterns to be used to format the specified series.

    You are not required to include a format for every series on the chart; any unspecified series will use the default format.

If this option is specified, the displayExactValues option is ignored.

annotationChart.setNumberFormats(NumberFormats.ForAll("#"));

ScaleType

Sets the maximum and minimum values shown on the Y axis. The following options are available:

  • 'maximized' - The Y axis will span the minimum to the maximum values of the series. If you have more than one series, use allmaximized.

  • 'fixed' [default] - The Y axis varies, depending on the data values values:

    • If all values are >=0, the Y axis will span from zero to the maximum data value.

    • If all values are <=0, the Y axis will span from zero to the minimum data value.

    • If values are both positive and negative, the Y axis will range from the series maximum to the series minimum.
      For multiple series, use 'allfixed'.

  • 'allmaximized' - Same as 'maximized,' but used when multiple scales are displayed. Both charts will be maximized within the same scale, which means that one will be misrepresented against the Y axis, but hovering over each series will display its true value.

  • 'allfixed' - Same as 'fixed,' but used when multiple scales are displayed. This setting adjusts each scale to the series to which it applies (use this in conjunction with scaleColumns).

If you specify the min and/or max options, they will take precedence over the minimum and maximum values determined by your scale type.

annotationChart.setScaleType(ScaleType.ALL_MAXIMIZED);	

Thickness

A number from 0—10 (inclusive) specifying the thickness of the lines, where 0 is the thinnest.

annotationChart.setThickness(5);

ZoomStartTime

Sets the start date/time of the selected zoom range.

annotationChart.setZoomStartTime(DateValue.Date(LocalDate.now()));

ZoomEndTime

Sets the end date/time of the selected zoom range.

annotationChart.setZoomEndTime(DateValue.Date(LocalDate.now().plusDays(5)));

  • No labels