Fluent builder for a chart's title, axis labels, dimensions, orientation and data points. Obtained from ChartManager.newChartBuilder() and passed to buildBarChart() or buildXYLineChart() to render it as PNG bytes. Each setter returns this builder so calls can be chained.

Group: Builders


Properties

PropertyReturnsDescription
dataList<DataPoint>Data points added to this builder so far, in the order they were added.
heightintHeight, in pixels, the rendered chart image will be. Zero until set via height(int).
showLegendbooleanWhether the rendered chart includes a legend.
titleStringTitle displayed at the top of the rendered chart. Null until set via title(String).
vertOrientiationbooleanWhether a bar chart renders with vertical bars rather than horizontal ones; has no effect on line charts.
widthintWidth, in pixels, the rendered chart image will be. Zero until set via width(int).
xLabelStringLabel displayed on the chart's x-axis. Null until set via xLabel(String).
yLabelStringLabel displayed on the chart's y-axis. Null until set via yLabel(String).

Methods

dateRange(boolean b) · height(int i) · width(int i) · title(String i) · xLabel(String i) · yLabel(String i) · isVertOrientiation(boolean i) · showLegend(boolean i) · addXY(Number x, Number y) · addXY(ZonedDateTime x, Number y) · addXY(Date x, Number y) · add(Number value, String rowLabel, String colLabel) · getHeight() · setHeight(int height) · getWidth() · setWidth(int width) · getTitle() · setTitle(String title) · getxLabel() · setxLabel(String xLabel) · getyLabel() · setyLabel(String yLabel) · isVertOrientiation() · setVertOrientiation(boolean isVertOrientiation) · isShowLegend() · setShowLegend(boolean showLegend) · getData()

dateRange(boolean b)

Returns: ChartBuilder

Sets whether the x-axis should be treated as a date range and rendered with date-formatted tick units. Set automatically by addXY(Date, Number); call directly to force date formatting when adding points of another type.

ParameterDescription
btrue to render the x-axis as dates

height(int i)

Returns: ChartBuilder

Sets the rendered chart image's height.

ParameterDescription
ithe image height, in pixels

width(int i)

Returns: ChartBuilder

Sets the rendered chart image's width.

ParameterDescription
ithe image width, in pixels

title(String i)

Returns: ChartBuilder

Sets the chart's title.

ParameterDescription
ithe chart title

xLabel(String i)

Returns: ChartBuilder

Sets the chart's x-axis label.

ParameterDescription
ithe x-axis label

yLabel(String i)

Returns: ChartBuilder

Sets the chart's y-axis label.

ParameterDescription
ithe y-axis label

isVertOrientiation(boolean i)

Returns: ChartBuilder

Sets whether a bar chart is rendered with vertical bars rather than horizontal ones; has no effect on line charts.

ParameterDescription
itrue for vertical bars, false for horizontal

showLegend(boolean i)

Returns: ChartBuilder

Sets whether the rendered chart includes a legend.

ParameterDescription
itrue to show a legend

addXY(Number x, Number y)

Returns: ChartBuilder

Adds a line chart data point. Use this overload for a plain numeric x-axis; use addXY(Date, Number) or addXY(ZonedDateTime, Number) for a date-based x-axis.

ParameterDescription
xthe point's x-axis value
ythe point's y-axis value

addXY(ZonedDateTime x, Number y)

Returns: ChartBuilder

Adds a line chart data point at the given date and time, rendering the x-axis as a date range. See addXY(Date, Number).

ParameterDescription
xthe point's date and time
ythe point's y-axis value

addXY(Date x, Number y)

Returns: ChartBuilder

Adds a line chart data point at the given date, plotted by the date's epoch millisecond value, and sets dateRange(true) so the x-axis is rendered with date-formatted tick units.

ParameterDescription
xthe point's date
ythe point's y-axis value

add(Number value, String rowLabel, String colLabel)

Returns: ChartBuilder

Adds a bar chart data point.

ParameterDescription
valuethe bar's value, plotted on the y-axis
rowLabelthe series (row) key; data points sharing the same row label are grouped into one series and shown together in the legend
colLabelthe category (x-axis) label for this data point

getHeight()

Returns: int

Height, in pixels, the rendered chart image will be. Zero until set via height(int).

setHeight(int height)

Returns: void

Sets the rendered chart image's height, the same value as height(int) but as a plain setter.

ParameterDescription
heightthe image height, in pixels

getWidth()

Returns: int

Width, in pixels, the rendered chart image will be. Zero until set via width(int).

setWidth(int width)

Returns: void

Sets the rendered chart image's width, the same value as width(int) but as a plain setter.

ParameterDescription
widththe image width, in pixels

getTitle()

Returns: String

Title displayed at the top of the rendered chart. Null until set via title(String).

setTitle(String title)

Returns: void

Sets the title displayed at the top of the rendered chart, the same value as title(String) but as a plain setter.

ParameterDescription
titlethe chart title

getxLabel()

Returns: String

Label displayed on the chart's x-axis. Null until set via xLabel(String).

setxLabel(String xLabel)

Returns: void

Sets the label displayed on the chart's x-axis, the same value as xLabel(String) but as a plain setter.

ParameterDescription
xLabelthe x-axis label

getyLabel()

Returns: String

Label displayed on the chart's y-axis. Null until set via yLabel(String).

setyLabel(String yLabel)

Returns: void

Sets the label displayed on the chart's y-axis, the same value as yLabel(String) but as a plain setter.

ParameterDescription
yLabelthe y-axis label

isVertOrientiation()

Returns: boolean

Whether a bar chart renders with vertical bars rather than horizontal ones; has no effect on line charts.

setVertOrientiation(boolean isVertOrientiation)

Returns: void

Sets whether a bar chart renders with vertical bars rather than horizontal ones; has no effect on line charts. The same value as isVertOrientiation(boolean) but as a plain setter.

ParameterDescription
isVertOrientiationtrue for vertical bars, false for horizontal

isShowLegend()

Returns: boolean

Whether the rendered chart includes a legend.

setShowLegend(boolean showLegend)

Returns: void

Sets whether the rendered chart includes a legend, the same value as showLegend(boolean) but as a plain setter.

ParameterDescription
showLegendtrue to show a legend

getData()

Returns: List<DataPoint>

Data points added to this builder so far, in the order they were added.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.