Author image Claes Jakobsson
and 1 contributors

NAME

VS::Chart::Renderer::XY - Base class for grafs that uses a XY planar coordinate system

DESCRIPTION

This class performs common rendering of stuff like chart background, grids and labels for XY planar coordinate charts.

ATTRIBUTES

BACKGROUND

chart_background ( 0 | 1 | COLOR )

Controls if a chart_background should be drawn or not. Defaults to 1. Standard color is white.

BASELINE

A baseline is a line rendered at a specific value from left to right in the chart to indicate a comparision value, for example 100%.

baseline ( VALUE )

The value at where to draw the baseline. Baseline will only be drawn if this option is set.

baseline_color (COLOR)

Controls the color that the baseline should be drawn with. Standard color is black.

baseline_dash ( DASH )

Controls if the baseline should be dashed. Standard is a solid line.

BORDERS & PADDING

borders ( 0 | 1 | COLOR )

Controls if a 1 point border around the chart should be drawn or not. Defaults to 0. Standard color is black.

padding ( SIZE )

Controls if there should be a padding around what's rendered. Defaults to 0

COMMON ATTRIBUTES FOR BOTH AXES

labels_font_face

Sets the font-face for the labels. Values understood are normally serif, sans-serif and monospace but others might work.

labels_font_size

The size of the text to render in points.

labels_font_slant

If the font is in italics or not. Valid values are normal, italic, oblique. Defaults to normal which means no italic.

labels_font_weight

If the font is in bold or not. Valid values are normal, bold. Defaults to normal which means not bold.

X AXIS

x_axis ( 0 | 1 | COLOR )

Controls if the X axis should be drawn. Defaults to 1. Standard color is axis.

x_grid ( 0 | 1 | COLOR ).

Controls if a vertical grid should be drawn. Defaults to 1. Standard color is grid.

x_label_fmt ( FORMAT )

Controls how X axis labels will be formated using printf syntax. Default is %.${x_label_decimals}f for numeric values and ISO 8601 for dates.

x_label_decimals ( NUM )

Controls how many decimals should be shown for X labels. Defaults to 0. If the labels isn't numeric this has no effect.

x_labels ( 0 | 1 | COLOR )

Controls if labels on the X axis should be drawn. Defaults to 1. Standard color is text.

x_minor_grid ( 0 | 1 | COLOR )

Controls if minor vertical grid should be drawn. Defaults to 0. Standard color is minor_tick.

x_minor_ticks (0 | 1 | COLOR )

Controls if minor ticks (between lables / major ticks ) should be drawn. Defaults to 0. Standard color is minor_tick.

x_minor_ticks_count ( NUM )

Controls the number of minor ticks (and minor grid lines) to show between major ticks.

x_ticks ( 0 | 1 | COLOR )

Controls if major ticks (at labels) should be drawn. Defaults to 0. Standard color is major_tick.

Y AXIS

show_y_min ( 0 | 1)

Controls if the minimum value for Y should be shown or not.

y_grid ( 0 | 1 | COLOR )

Controls if a horizontal grid should be drawn. Defaults to 1. Standard color is grid.

y_minor_grid ( 0 | 1 | COLOR )

Controls if a horizontal minor grid should be drawn. Defaults to 0. Standard color is minor_tick.

y_steps ( NUM )

Controls how many steps on the Y axis should be shown.

y_axis ( 0 | 1 | COLOR )

Controls if the Y axis should be drawn. Defaults to 1. Standard color is axis.

y_labels ( 0 | 1 | COLOR )

Controls if labels on the X axis should be drawn. Defaults to 1. Standard color is text.

y_label_fmt ( FORMAT )

Controls how Y axis labels will be formated using printf syntax. Default is %.${y_label_decimals}f for numeric values.

y_label_decimals ( NUM )

Controls how many decimals should be shown for Y labels. Defaults to 1.

y_major_ticks ( 0 | 1 | COLOR )

Controls if major ticks (at labels) should be drawn. Defaults to 0. Standard color is major_tick.

y_minor_ticks (0 | 1 | COLOR )

Controls if minor ticks (between lables / major ticks ) should be drawn. Defaults to 0. Standard color is minor_tick.

y_minor_ticks_count ( NUM )

Controls the number of minor ticks to show between major ticks/grid lines.

TITLE

title

Sets the title that will be displayed centered above the chart.

title_font_face

Sets the font-face for the title. Values understood are normally serif, sans-serif and monospace but others might work.

title_font_size

The size of the text to render in points.

title_font_slant

If the font is in italics or not. Valid values are normal, italic, oblique. Defaults to normal which means no italic.

title_font_weight

If the font is in bold or not. Valid values are normal, bold. Defaults to normal which means not bold.

INTERFACE

CLASS METHODS

set_defaults ( CHART )

Sets defaults attribute for the chart and returns a list of keys it's added. If an attribute already exists it's unaffected.

render ( CHART, SURFACE )

Render CHART to SURFACE

render_chart_background ( CHART, SURFACE, LEFT, TOP, WIDTH, HEIGHT )

Renders the charts background. This is the area on which the actually data will be drawn, and not the axes, labels or ticks. The WIDTH and HEIGHT are calculated by taking their respetive values minus any offsets.

render_axes ( CHART, SURFACE, LEFT, TOP, WIDTH, HEIGHT )

Renders the axes, labels and ticks.

render_baseline ( CHART, SURFACE, LEFT, TOP, WIDTH, HEIGHT )

Renders the baseline.

render_title ( CHART, SURFACE, LEFT, TOP, WIDTH, HEIGHT )

Renders the title.

x_offsets ( CHART, SURFACE )

Returns left and right offsets for the chart.

y_offsets ( CHART, SURFACE )

Returns the top and bottom offsets for the chart.

type

Returns the type of chart that will be used by VS::Chart/render to determine what renderer to use,

SEE MORE

VS::Chart::Color.