foresight_backend
foresight_backend, abstract output device.
Two coordinate spaces. Page primitives take pixel coordinates (origin top-left, y downward). The data_* primitives, valid between begin_plot_area and end_plot_area, take unit-square coordinates of the plot area (origin bottom-left, y upward, [0, 1] spanning the axis ranges) and are clipped to it. Keeping data in unit coordinates lets an interactive device zoom and pan by changing a single view transform.
A panel is bracketed by begin_axes/end_axes, which hand the device the panel geometry and axis ranges, and its redrawable decorations (grid, ticks) by named begin_group/end_group: an interactive device regenerates them after a zoom, a static one just writes them.
Source: src/lib/foresight_backend.F90
Dependencies
Contents
- axes_view
- backend_object
- scene
- hover
- pixmap
- front_area
- arrow_head
- sized_head
- rotates_text
- wants_scene
- row_height
- default_head_length
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
HEAD_LENGTH | real(kind=R8P) | parameter | Longest default arrowhead barb [px], gnuplot svg (2 tics). |
HEAD_ANGLE | real(kind=R8P) | parameter | Arrowhead barb angle off the shaft [deg], gnuplot default. |
Derived Types
axes_view
Geometry and axis ranges of a plot panel.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
area | real(kind=R8P) | Plot area: left, right, top, bottom [px]. | |
x | real(kind=R8P) | x axis values at the axis start and end. | |
y | real(kind=R8P) | y axis values at the axis start and end. | |
xlog | logical | Log x axis. | |
ylog | logical | Log y axis. | |
grid | logical | Grid shown. | |
markup | logical | Tick labels with enhanced text markup, drawn again by the viewer as such. | |
font_size | real(kind=R8P) | Font size [px]. | |
xtics | character(len=:) | allocatable | x tick positions for the viewer (tics_object%attribute), empty for auto. |
ytics | character(len=:) | allocatable | y tick positions for the viewer, empty for auto. |
xformat | character(len=:) | allocatable | x tick label format, empty for the default. |
yformat | character(len=:) | allocatable | y tick label format, empty for the default. |
mirror | logical | Ticks mirrored on the opposite border: x, y, y2. | |
y2_active | logical | Second y axis drawn; the y2* components are meaningful only then. | |
y2 | real(kind=R8P) | y2 axis values at the axis start and end. | |
y2log | logical | Log y2 axis. | |
y2tics | character(len=:) | allocatable | y2 tick positions for the viewer, empty for auto. |
y2format | character(len=:) | allocatable | y2 tick label format, empty for the default. |
x2_active | logical | Second x axis drawn; the x2* components are meaningful only then. | |
x2 | real(kind=R8P) | x2 axis values at the axis start and end. | |
x2log | logical | Log x2 axis. | |
x2mirror | logical | x2 ticks mirrored on the bottom border. | |
x2tics | character(len=:) | allocatable | x2 tick positions for the viewer, empty for auto. |
x2format | character(len=:) | allocatable | x2 tick label format, empty for the default. |
xtime | character(len=:) | allocatable | Input time format of a time x axis (its timefmt), empty if numeric. |
ytime | character(len=:) | allocatable | Input time format of a time y axis, empty if numeric. |
y2time | character(len=:) | allocatable | Input time format of a time y2 axis, empty if numeric. |
x2time | character(len=:) | allocatable | Input time format of a time x2 axis, empty if numeric. |
gridlines | character(len=:) | allocatable | Grid lines (x y2 mx), empty for the x and y major ones. |
gridstyle | character(len=:) | allocatable | Grid line color width dashes, empty for the theme's. |
three_d | logical | A 3D view: static on an interactive device (no zoom, no pan). |
backend_object
Abstract output device.
Inheritance
Attributes: abstract
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
theme | type(theme_object) | Output theme: colors the layout's ones are mapped to (foresight_theme). | |
enhanced | logical | Texts read as gnuplot's enhanced text (foresight_enhanced). | |
latin1 | logical | Texts in ISO 8859-1, written in UTF-8 (set encoding iso_8859_1). | |
literal | logical | The texts written now as they are (an automatic title, noenhanced). | |
tex | logical | Texts are LaTeX source, set by LaTeX (cairolatex): numbers in math mode. | |
text_size | real(kind=R8P) | Default font size of the texts [px]. | |
boxed | logical | The texts written now are boxed (gnuplot's textbox): on the background. | |
page_family | character(len=48) | Font family of the page (set terminal ... font), empty: the device's. | |
font | type(font_object) | The font of the texts written now (gnuplot font "..."); unset parts the page's. | |
head_px | real(kind=R8P) | Length [px] and angle [deg] of the data arrowheads drawn now, 0 for the default head. | |
head_fixed | logical | Those heads keep their size on short arrows (gnuplot fixed). |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
begin_page | pass(self) | Open the output page. |
end_page | pass(self) | Close the output page. |
begin_axes | pass(self) | Open a plot panel. |
end_axes | pass(self) | Close the plot panel. |
begin_group | pass(self) | Open a named group. |
end_group | pass(self) | Close the group. |
rect | pass(self) | Rectangle [px]. |
polyline | pass(self) | Polyline [px]. |
dots | pass(self) | Round dots or markers [px]. |
polygon | pass(self) | Filled polygon [px]. |
image | pass(self) | Raster image [px]. |
text | pass(self) | Text [px]. |
begin_plot_area | pass(self) | Open the clipped plot area. |
end_plot_area | pass(self) | Close the plot area. |
data_polyline | pass(self) | Polyline [unit square]. |
data_dots | pass(self) | Dots or markers [unit square]. |
data_bars | pass(self) | Error bars [unit square]. |
data_polygon | pass(self) | Filled polygon [unit square]. |
data_image | pass(self) | Raster image [unit square]. |
text_width | pass(self) | Text width [px]. |
readout | pass(self) | Seven-segment readout [px]. |
readout_extent | pass(self) | Readout size [px]. |
data_arrows | pass(self) | Arrows [unit square]. |
data_label | pass(self) | Text at a point [unit square]. |
rotates_text | pass(self) | Whether text can be rotated. |
wants_scene | pass(self) | Whether 3D scenes are written. |
scene | pass(self) | A 3D view's scene (JSON). |
row_height | pass(self) | Text row height, 0 if none. |
hover | pass(self) | Text on mouse-over of a point. |
pixmap | pass(self) | A PNG image [px]. |
front_area | pass(self) | Open or close the front layer of the plot area. |
Subroutines
scene
The scene of a 3D view (foresight_scene3d's JSON), in the open panel: nothing on a device without a viewer.
subroutine scene(self, json)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_object) | inout | Device. | |
json | character(len=*) | in | Scene. |
Call graph
hover
text shown on mouse-over of the point (x, y) [unit square], a disk of diameter [px] (gnuplot's hypertext): nothing on a device without a mouse.
subroutine hover(self, x, y, text, diameter)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_object) | inout | Device. | |
x | real(kind=R8P) | in | Abscissa [unit]. | |
y | real(kind=R8P) | in | Ordinate [unit]. | |
text | character(len=*) | in | Text. | |
diameter | real(kind=R8P) | in | Sensitive disk [px]. |
pixmap
The PNG image png (base64) with its top left corner at (x, y), width x height [px], stretched (gnuplot set pixmap): nothing on a device without images.
subroutine pixmap(self, x, y, width, height, png)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_object) | inout | Device. | |
x | real(kind=R8P) | in | Left side [px]. | |
y | real(kind=R8P) | in | Top side [px]. | |
width | real(kind=R8P) | in | Width [px]. | |
height | real(kind=R8P) | in | Height [px]. | |
png | character(len=*) | in | The PNG file, base64. |
Call graph
front_area
Open (opening) or close the front layer of the plot area, after its overlays (markers, caps): the data space objects of gnuplot's front layer go above the points. separate false on a device that draws them in the plot area (before it closes): this one, nothing to open or close.
subroutine front_area(self, opening, separate)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_object) | inout | Device. | |
opening | logical | in | Open, else close. | |
separate | logical | out | A layer of its own. |
Call graph
arrow_head
The barbs of gnuplot's default arrowhead at tip pointing away from tail [px, any orientation], HEAD_ANGLE degrees off the shaft, barbs(:, 1) and barbs(:, 2): gnuplot's do_arrow (term.c) scales the head with the shaft, 0.3 of its length L, within 0.3 and 2 average tic lengths (HEAD_LENGTH is the longest), so heads shrink on arrows shorter than about 60 px and stop shrinking at 2.7 px. A zero length shaft has no head (both barbs at the tip), as gnuplot's.
Attributes: pure
subroutine arrow_head(tail, tip, barbs)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
tail | real(kind=R8P) | in | Tail [px]. | |
tip | real(kind=R8P) | in | Tip [px]. | |
barbs | real(kind=R8P) | out | Barb ends [px]. |
Call graph
sized_head
The barbs of an arrowhead at tip pointing away from tail [px, any orientation], length px long, angle degrees off the shaft: barbs(:, 1) and barbs(:, 2). A zero length shaft has no head (both barbs at the tip), as gnuplot's do_arrow. On a shaft shorter than twice the barbs the head shrinks to half the shaft, its angle widened so the barbs spread as far (gnuplot's effective_length), unless fixed.
Attributes: pure
subroutine sized_head(tail, tip, length, angle, barbs, fixed)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
tail | real(kind=R8P) | in | Tail [px]. | |
tip | real(kind=R8P) | in | Tip [px]. | |
length | real(kind=R8P) | in | Barb length [px]. | |
angle | real(kind=R8P) | in | Barb angle [deg]. | |
barbs | real(kind=R8P) | out | Barb ends [px]. | |
fixed | logical | in | optional | The head keeps its size (gnuplot fixed). |
Call graph
Functions
rotates_text
Whether the device draws text rotated, as tick labels rotated by gnuplot: true but on text devices, which write them horizontally, as gnuplot's dumb terminal.
Attributes: pure
Returns: logical
function rotates_text(self) result(rotates)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_object) | in | Device. |
Call graph
wants_scene
Whether the device writes the scene of a 3D view (the HTML page, for the viewer's mouse rotation): no.
Attributes: pure
Returns: logical
function wants_scene(self) result(wants)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_object) | in | Device. |
Call graph
row_height
Height of a text row of the device [px]: 0 on vector devices, where text sits anywhere.
Attributes: pure
Returns: real(kind=R8P)
function row_height(self) result(height)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_object) | in | Device. |
Call graph
default_head_length
Barb length of gnuplot's default arrowhead on a shaft shaft px long (term.c do_arrow): HEAD_COEFF (0.3) of the shaft, at least HEAD_SHORT_LIMIT (0.3) and at most HEAD_LONG_LIMIT (2) average tic lengths, the tic HEAD_LENGTH/2 (9 px, gnuplot's svg).
Attributes: elemental
Returns: real(kind=R8P)
function default_head_length(shaft) result(length)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
shaft | real(kind=R8P) | in | Shaft length [px]. |
Call graph