foresight_backend_svg
foresight_backend_svg, SVG output device.
The document is streamed to <file>.tmp and renamed over <file> when the page ends, so a viewer polling <file> never reads a partial document. The plot area is a nested <svg class="fs-plot"> whose viewBox is the unit square: data geometry lives in unit coordinates, and vector-effect="non-scaling-stroke" keeps its line widths in pixels. Panels are <g class="fs-axes"> carrying their geometry and axis ranges as data-* attributes; decorations the interactive viewer regenerates are <g class="fs-..."> groups. The second y axis and the mirror settings add their attributes only when active or not the default, so a plain panel reads the same as before them.
Source: src/lib/foresight_backend_svg.F90
Dependencies
Contents
- backend_svg
- begin_page
- end_page
- begin_axes
- end_axes
- begin_group
- end_group
- rect
- polyline
- dots
- polygon
- image
- text
- text_raw
- begin_plot_area
- end_plot_area
- data_polyline
- data_dots
- data_bars
- data_arrows
- pixmap
- front_area
- hover
- data_label
- data_label_raw
- data_polygon
- data_image
- readout
- glyph_defs
- close_file
- open_file
- open_svg
- put
- write_pairs
- pattern_fill
- textbox_attribute
- text_width
- text_face
- readout_extent
- glyph_group
- output_unit
- marker_element
- marker_line
- marker_path
- glass_geometry
- segment_path
- polygon_paint
- glow_attribute
- paint
- dash_attribute
- series_attribute
- flag
- px
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
PX_DECIMALS | integer(kind=I4P) | parameter | Decimals of pixel coordinates. |
UNIT_DECIMALS | integer(kind=I4P) | parameter | Decimals of unit-square coordinates. |
PAIRS_PER_LINE | integer(kind=I4P) | parameter | Coordinate pairs per output line. |
FONT_FAMILY | character(len=*) | parameter | Default font family. |
IMAGE_ATTRIBUTES | character(len=*) | parameter | Sharp pixels, any scale; the xlink namespace declared here, the root kept unchanged. |
DIGIT_WIDTH | real(kind=R8P) | parameter | Digit width, between the vertical segment axes. |
DIGIT_PITCH | real(kind=R8P) | parameter | Distance between the cells. |
SEGMENT_WIDTH | real(kind=R8P) | parameter | Segment thickness, also the decimal point side. |
POINT_OFFSET | real(kind=R8P) | parameter | Decimal point left side, from its cell. |
SLANT | real(kind=R8P) | parameter | Slant: tan(8 deg), the bottom shifted left. |
SEGMENT_GAP | real(kind=R8P) | parameter | Gap between segment ends [segment thickness]. |
Derived Types
backend_svg
SVG output device.
Inheritance
Extends: backend_object
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). | |
glyphs | logical | Texts drawn from the compiled-in glyphs (gnuplot-style fontglyphs: the same shapes as the PDF), each text kept transparent for selection; else by name. | |
glyph_face | integer(kind=I4P) | allocatable | Face of each glyph drawn (fontglyphs). |
glyph_number | integer(kind=I4P) | allocatable | Its glyph index. |
nglyphs | integer(kind=I4P) | Glyphs drawn. | |
unit | integer(kind=I4P) | Output unit. | |
file | character(len=:) | allocatable | Final output file. |
tmp_file | character(len=:) | allocatable | File being written. |
area | real(kind=R8P) | Current plot area: left, top, width, height [px]. | |
caps | character(len=:) | allocatable | Error bar caps of the current plot area, pixel overlay. |
marks | character(len=:) | allocatable | Point type markers of the current plot area, pixel overlay. |
spill | logical | A marker of the current plot area crosses its border. | |
heads | character(len=:) | allocatable | Arrowheads of the current plot area, pixel overlay. |
labels | character(len=:) | allocatable | Text labels of the data of the current plot area, pixel overlay. |
patterns | integer(kind=I4P) | Fill pattern definitions written. | |
pattern_key | character(len=:) | allocatable | Key of the last pattern definition (pattern, color, space). |
series | integer(kind=I4P) | Series of the open group, 0 for none. | |
textbox | logical | The textbox filter is defined. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
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. |
begin_page | pass(self) | Open the output file with a page of width x height px and the default font_size [px]. |
end_page | pass(self) | Close the document and publish it atomically. |
begin_axes | pass(self) | Open a panel group carrying geometry and axis ranges as data-* attributes. |
end_axes | pass(self) | Close the panel group. |
begin_group | pass(self) | Open the group of class name; hidden with display="none" when visible is false; a series group carries its number as data-series, as do its overlay markers and caps; fs-crisp draws its shapes with crisp edges. |
end_group | pass(self) | Close the group. |
rect | pass(self) | Rectangle of top-left corner (x, y) [px]. |
polyline | pass(self) | Open polyline through the points (x, y) [px]. |
dots | pass(self) | Filled round dots centred on the points (x, y) [px], or point type markers. |
polygon | pass(self) | Closed polygon of the vertices (x, y) [px], filled and stroked; a ghost faintly filled only. |
image | pass(self) | Raster image over the box of top-left (x0, y0) and bottom-right (x1, y1) corners [px], an embedded PNG. |
text | pass(self) | Text (text_raw), ISO 8859-1 texts in UTF-8 first (latin1). |
text_raw | pass(self) | text without the ISO 8859-1 conversion. |
begin_plot_area | pass(self) | Open the clipped plot area; its user space is the unit square, y upward. |
end_plot_area | pass(self) | Close the plot area, then write the overlays of error bar caps and point type markers (pixel space, clipped to the plot area): they keep their pixel size under zoom, the interactive viewer regenerates them from the data. |
data_polyline | pass(self) | Open polyline through the points (x, y) [unit square]. |
data_dots | pass(self) | Filled round dots centred on the points (x, y) [unit square], or point type markers. |
data_bars | pass(self) | Error bars [unit square] as one path of Mx1,y1Lx2,y2 segments, classed fs-ybars/fs-xbars with the cap length in data-cap; caps are queued for the pixel overlay written by end_plot_area. |
data_polygon | pass(self) | Closed polygon of the vertices (x, y) [unit square], clipped by the plot area; its border keeps its pixel width under zoom. |
data_image | pass(self) | Raster image over the box of bottom-left (x0, y0) and top-right (x1, y1) corners [unit square], an embedded PNG in the plot area: zoomed with the data, its pixels kept sharp (pixelated). |
text_width | pass(self) | Width of string with its superscript sup [px], from the compiled-in fonts (foresight_font): the face of the texts written now (self%font, unset parts the page's family), kerned; the superscript at 0.75 size. |
text_face | pass(self) | The compiled-in face (foresight_fontdata, 1-8) of the texts written now: self%font, its family the page's when unset (set terminal ... font, else Arial: the sans face). |
readout | pass(self) | Seven-segment readout of top-left corner (x, y) [px], a ``: the bold label above a glass slanted by 8 degrees, the unlit segments drawn faintly (GHOST_OPACITY), the unit text beside it. |
readout_extent | pass(self) | Width and height [px] of a readout: label row, glass with its slant and segment overhangs, unit text. |
data_arrows | pass(self) | Arrows [unit square]: the shafts as one path of Mx1,y1Lx2,y2 segments classed fs-vectors (the heads as data-head, data-filled), the heads queued for the pixel overlay written by end_plot_area, which the interactive viewer regenerates after a zoom. |
pattern_fill | pass(self) | Fill of a polygon, a pattern defined if needed. |
data_label | pass(self) | Text at a data point (data_label_raw), ISO 8859-1 texts in UTF-8 first (latin1). |
hover | pass(self) | Text on mouse-over of a point: a transparent disk with its title. |
front_area | pass(self) | The front layer of the plot area: an svg over the overlays. |
pixmap | pass(self) | A PNG image: an `` of the file as data. |
data_label_raw | pass(self) | data_label without the ISO 8859-1 conversion. |
close_file | pass(self) | Close the stream and publish the file atomically. |
open_file | pass(self) | Open the stream on .tmp. |
open_svg | pass(self) | Write the root `` start tag. |
output_unit | pass(self) | Unit of the open stream. |
put | pass(self) | Write a line. |
write_pairs | pass(self) | Write coordinate pairs. |
glyph_group | pass(self) | A text drawn from the glyphs (fontglyphs). |
glyph_defs | pass(self) | The definitions of the glyphs drawn (the HTML device's too). |
backend_svg%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
backend_svg%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
backend_svg%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
backend_svg%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
Subroutines
begin_page
Open the output file with a page of width x height px and the default font_size [px].
subroutine begin_page(self, file, width, height, font_size)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
file | character(len=*) | in | Output file. | |
width | real(kind=R8P) | in | Page width [px]. | |
height | real(kind=R8P) | in | Page height [px]. | |
font_size | real(kind=R8P) | in | Default font size [px]. |
Call graph
end_page
Close the document and publish it atomically.
subroutine end_page(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. |
Call graph
begin_axes
Open a panel group carrying geometry and axis ranges as data-* attributes.
subroutine begin_axes(self, view)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
view | type(axes_view) | in | Panel geometry and axis ranges. |
Call graph
end_axes
Close the panel group.
subroutine end_axes(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. |
Call graph
begin_group
Open the group of class name; hidden with display="none" when visible is false; a series group carries its number as data-series, as do its overlay markers and caps; fs-crisp draws its shapes with crisp edges.
subroutine begin_group(self, name, visible, series)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
name | character(len=*) | in | Group name. | |
visible | logical | in | optional | Group shown. |
series | integer(kind=I4P) | in | optional | Series number. |
Call graph
end_group
Close the group.
subroutine end_group(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. |
Call graph
rect
Rectangle of top-left corner (x, y) [px].
subroutine rect(self, x, y, width, height, stroke, fill, line_width)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | 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]. | |
stroke | character(len=*) | in | Stroke color. | |
fill | character(len=*) | in | Fill color. | |
line_width | real(kind=R8P) | in | Stroke width [px]. |
Call graph
polyline
Open polyline through the points (x, y) [px].
subroutine polyline(self, x, y, color, line_width, dasharray)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x | real(kind=R8P) | in | Abscissae [px]. | |
y | real(kind=R8P) | in | Ordinates [px]. | |
color | character(len=*) | in | Stroke color. | |
line_width | real(kind=R8P) | in | Stroke width [px]. | |
dasharray | character(len=*) | in | SVG dash array, empty for solid. |
Call graph
dots
Filled round dots centred on the points (x, y) [px], or point type markers.
subroutine dots(self, x, y, color, diameter, pt, line_width)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x | real(kind=R8P) | in | Abscissae [px]. | |
y | real(kind=R8P) | in | Ordinates [px]. | |
color | character(len=*) | in | Fill color. | |
diameter | real(kind=R8P) | in | Dot diameter, or marker width [px]. | |
pt | integer(kind=I4P) | in | optional | gnuplot point type; negative or absent: round dots. |
line_width | real(kind=R8P) | in | optional | Marker line width [px], default gnuplot's (marker_line). |
Call graph
polygon
Closed polygon of the vertices (x, y) [px], filled and stroked; a ghost faintly filled only.
subroutine polygon(self, x, y, fill, opacity, stroke, line_width, ghost)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x | real(kind=R8P) | in | Vertex abscissae [px]. | |
y | real(kind=R8P) | in | Vertex ordinates [px]. | |
fill | character(len=*) | in | Fill color. | |
opacity | real(kind=R8P) | in | Fill opacity. | |
stroke | character(len=*) | in | Border color. | |
line_width | real(kind=R8P) | in | Border width [px]. | |
ghost | logical | in | optional | Unlit cell of a segmented fill. |
Call graph
image
Raster image over the box of top-left (x0, y0) and bottom-right (x1, y1) corners [px], an embedded PNG.
subroutine image(self, x0, y0, x1, y1, rgba)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x0 | real(kind=R8P) | in | Left [px]. | |
y0 | real(kind=R8P) | in | Top [px]. | |
x1 | real(kind=R8P) | in | Right [px]. | |
y1 | real(kind=R8P) | in | Bottom [px]. | |
rgba | integer(kind=I4P) | in | Pixels. |
Call graph
text
Text (text_raw), ISO 8859-1 texts in UTF-8 first (latin1).
subroutine text(self, x, y, string, anchor, sup, rotate, color)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x | real(kind=R8P) | in | Anchor abscissa [px]. | |
y | real(kind=R8P) | in | Anchor ordinate (baseline) [px]. | |
string | character(len=*) | in | Text. | |
anchor | character(len=*) | in | Horizontal anchor: start, middle or end. | |
sup | character(len=*) | in | optional | Superscript appended to string. |
rotate | real(kind=R8P) | in | optional | Rotation. |
color | character(len=*) | in | optional | Text color. |
Call graph
text_raw
Text whose baseline passes through the anchor point (x, y) [px], in color if given. Superscript. Color. Rotation.
subroutine text_raw(self, x, y, string, anchor, sup, rotate, color)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x | real(kind=R8P) | in | Anchor abscissa [px]. | |
y | real(kind=R8P) | in | Anchor ordinate (baseline) [px]. | |
string | character(len=*) | in | Text. | |
anchor | character(len=*) | in | Horizontal anchor: start, middle or end. | |
sup | character(len=*) | in | optional | Superscript appended to string. |
rotate | real(kind=R8P) | in | optional | Rotation about the anchor point [deg, clockwise]. |
color | character(len=*) | in | optional | Text color, the frame's if absent. |
Call graph
begin_plot_area
Open the clipped plot area; its user space is the unit square, y upward.
subroutine begin_plot_area(self, x, y, width, height)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | 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]. |
Call graph
end_plot_area
Close the plot area, then write the overlays of error bar caps and point type markers (pixel space, clipped to the plot area): they keep their pixel size under zoom, the interactive viewer regenerates them from the data.
subroutine end_plot_area(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. |
Call graph
data_polyline
Open polyline through the points (x, y) [unit square].
subroutine data_polyline(self, x, y, color, line_width, dasharray)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x | real(kind=R8P) | in | Abscissae [unit]. | |
y | real(kind=R8P) | in | Ordinates [unit]. | |
color | character(len=*) | in | Stroke color. | |
line_width | real(kind=R8P) | in | Stroke width [px]. | |
dasharray | character(len=*) | in | SVG dash array, empty for solid. |
Call graph
data_dots
Filled round dots centred on the points (x, y) [unit square], or point type markers.
Markers keep their shape only in pixels: the plot area holds their centres as an invisible fs-pts path of M moves (unit square) carrying the marker as data-* attributes, and the markers are queued for the pixel overlay written by end_plot_area, which the interactive viewer regenerates from the centres after a zoom.
subroutine data_dots(self, x, y, color, diameter, pt, line_width)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x | real(kind=R8P) | in | Abscissae [unit]. | |
y | real(kind=R8P) | in | Ordinates [unit]. | |
color | character(len=*) | in | Fill color. | |
diameter | real(kind=R8P) | in | Dot diameter, or marker width [px]. | |
pt | integer(kind=I4P) | in | optional | gnuplot point type; negative or absent: round dots. |
line_width | real(kind=R8P) | in | optional | Marker line width [px], default gnuplot's (marker_line). |
Call graph
data_bars
Error bars [unit square] as one path of Mx1,y1Lx2,y2 segments, classed fs-ybars/fs-xbars with the cap length in data-cap; caps are queued for the pixel overlay written by end_plot_area.
subroutine data_bars(self, x1, y1, x2, y2, color, line_width, cap, vertical)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x1 | real(kind=R8P) | in | Bar start abscissae. | |
y1 | real(kind=R8P) | in | Bar start ordinates. | |
x2 | real(kind=R8P) | in | Bar end abscissae. | |
y2 | real(kind=R8P) | in | Bar end ordinates. | |
color | character(len=*) | in | Stroke color. | |
line_width | real(kind=R8P) | in | Stroke width [px]. | |
cap | real(kind=R8P) | in | Cap length [px]. | |
vertical | logical | in | Vertical bars (horizontal caps), else horizontal. |
Call graph
data_arrows
Arrows [unit square]: the shafts as one path of Mx1,y1Lx2,y2 segments classed fs-vectors (the heads as data-head, data-filled), the heads queued for the pixel overlay written by end_plot_area, which the interactive viewer regenerates after a zoom.
subroutine data_arrows(self, x1, y1, x2, y2, color, line_width, head, filled)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x1 | real(kind=R8P) | in | Tail abscissae [unit]. | |
y1 | real(kind=R8P) | in | Tail ordinates [unit]. | |
x2 | real(kind=R8P) | in | Tip abscissae [unit]. | |
y2 | real(kind=R8P) | in | Tip ordinates [unit]. | |
color | character(len=*) | in | Stroke color. | |
line_width | real(kind=R8P) | in | Stroke width [px]. | |
head | integer(kind=I4P) | in | Heads: 0 none, 1 end, 2 start, 3 both. | |
filled | logical | in | Filled heads. |
Call graph
pixmap
The PNG image png (base64) with its top left corner at (x, y), width x height [px], stretched: an <image> holding the file, as gnuplot's svg set pixmap.
subroutine pixmap(self, x, y, width, height, png)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | 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: an svg of the plot area's geometry (fs-front, zoomed with it by the viewer) written after the overlays, so that gnuplot's front objects cover the markers.
subroutine front_area(self, opening, separate)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
opening | logical | in | Open, else close. | |
separate | logical | out | A layer of its own. |
Call graph
hover
gnuplot's hypertext: text shown on mouse-over of the point (x, y) [unit square], a transparent disk of diameter [px] (at least 8) over the markers carrying it as its title (the browser's tooltip).
subroutine hover(self, x, y, text, diameter)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | 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]. |
Call graph
data_label
Text at a data point (data_label_raw), ISO 8859-1 texts in UTF-8 first (latin1).
subroutine data_label(self, x, y, string, anchor, rotate, color, dx, dy)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x | real(kind=R8P) | in | Anchor abscissa [unit]. | |
y | real(kind=R8P) | in | Anchor ordinate [unit]. | |
string | character(len=*) | in | Text. | |
anchor | character(len=*) | in | Horizontal anchor: start, middle or end. | |
rotate | real(kind=R8P) | in | Rotation [deg, counterclockwise]. | |
color | character(len=*) | in | Text color. | |
dx | real(kind=R8P) | in | Horizontal offset [px]. | |
dy | real(kind=R8P) | in | Vertical offset [px, downward]. |
Call graph
data_label_raw
Text anchored at a data point [unit square], queued for the pixel overlay of the labels: each fs-label text carries its anchor (data-u, data-v, unit square, y downward) and offset (data-dx, data-dy) for the interactive viewer to move it after a zoom.
subroutine data_label_raw(self, x, y, string, anchor, rotate, color, dx, dy)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x | real(kind=R8P) | in | Anchor abscissa [unit]. | |
y | real(kind=R8P) | in | Anchor ordinate [unit]. | |
string | character(len=*) | in | Text. | |
anchor | character(len=*) | in | Horizontal anchor: start, middle or end. | |
rotate | real(kind=R8P) | in | Rotation [deg, counterclockwise]. | |
color | character(len=*) | in | Text color. | |
dx | real(kind=R8P) | in | Horizontal offset [px]. | |
dy | real(kind=R8P) | in | Vertical offset [px, downward]. |
Call graph
data_polygon
Closed polygon of the vertices (x, y) [unit square], clipped by the plot area; its border keeps its pixel width under zoom.
subroutine data_polygon(self, x, y, fill, opacity, stroke, line_width, ghost)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x | real(kind=R8P) | in | Vertex abscissae [unit]. | |
y | real(kind=R8P) | in | Vertex ordinates [unit]. | |
fill | character(len=*) | in | Fill color. | |
opacity | real(kind=R8P) | in | Fill opacity. | |
stroke | character(len=*) | in | Border color. | |
line_width | real(kind=R8P) | in | Border width [px]. | |
ghost | logical | in | optional | Unlit cell of a segmented fill. |
Call graph
data_image
Raster image over the box of bottom-left (x0, y0) and top-right (x1, y1) corners [unit square], an embedded PNG in the plot area: zoomed with the data, its pixels kept sharp (pixelated).
subroutine data_image(self, x0, y0, x1, y1, rgba)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x0 | real(kind=R8P) | in | Left [unit]. | |
y0 | real(kind=R8P) | in | Bottom [unit]. | |
x1 | real(kind=R8P) | in | Right [unit]. | |
y1 | real(kind=R8P) | in | Top [unit]. | |
rgba | integer(kind=I4P) | in | Pixels. |
Call graph
readout
Seven-segment readout of top-left corner (x, y) [px], a <g class="fs-readout">: the bold label above a glass slanted by 8 degrees, the unlit segments drawn faintly (GHOST_OPACITY), the unit text beside it.
subroutine readout(self, x, y, height, masks, label, prefix, suffix, color, font_size)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x | real(kind=R8P) | in | Left side [px]. | |
y | real(kind=R8P) | in | Top side [px]. | |
height | real(kind=R8P) | in | Digit height [px]. | |
masks | integer(kind=I4P) | in | Segments of each cell. | |
label | character(len=*) | in | Label, empty for none. | |
prefix | character(len=*) | in | Text before the glass. | |
suffix | character(len=*) | in | Text after the glass. | |
color | character(len=*) | in | Color of the lit segments. | |
font_size | real(kind=R8P) | in | Font size of the texts [px]. |
Call graph
glyph_defs
The definitions of the glyphs drawn: their outlines in font units, y upward (fontglyphs).
subroutine glyph_defs(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. |
Call graph
close_file
Close the stream and rename <file>.tmp over <file>.
subroutine close_file(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. |
Call graph
open_file
Open the output stream on <file>.tmp.
subroutine open_file(self, file)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
file | character(len=*) | in | Output file. |
Call graph
open_svg
Write the root <svg> start tag, with optional extra attributes (a leading space included).
subroutine open_svg(self, width, height, font_size, attributes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
width | real(kind=R8P) | in | Page width [px]. | |
height | real(kind=R8P) | in | Page height [px]. | |
font_size | real(kind=R8P) | in | Default font size [px]. | |
attributes | character(len=*) | in | optional | Extra attributes. |
Call graph
put
Write a complete line.
subroutine put(self, line)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
line | character(len=*) | in | Line. |
Call graph
write_pairs
Write prefix x,y suffix for each point, space separated, PAIRS_PER_LINE per line, without final newline.
subroutine write_pairs(self, x, y, ndec, prefix, suffix)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x | real(kind=R8P) | in | Abscissae. | |
y | real(kind=R8P) | in | Ordinates. | |
ndec | integer(kind=I4P) | in | Decimals. | |
prefix | character(len=*) | in | Text before each pair. | |
suffix | character(len=*) | in | Text after each pair. |
Call graph
Functions
pattern_fill
Paint of the fill of a polygon: the fill itself, or for a pattern fill (foresight_style fill_color) a reference to its definition, written before the polygon (once while pattern, color, width and space do not change): an 8 px tile of gnuplot's svg terminal, in page pixels or (unit) mapped to the unit square of the plot area, its lines as wide as the polygon's border (gnuplot's tile inherits the line width in effect; 1 px without).
Returns: character(len=:)
function pattern_fill(self, fill, unit, line_width) result(paint)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
fill | character(len=*) | in | Fill color, or pattern fill. | |
unit | logical | in | The polygon is in the unit square of the plot area. | |
line_width | real(kind=R8P) | in | Border width [px], not positive without a border. |
Call graph
textbox_attribute
The filter attribute of a boxed text, gnuplot's svg textbox: the background flooding the text's bounding box (no border, no margin, as gnuplot's svg terminal draws it); the filter defined once, before its first use.
Returns: character(len=:)
function textbox_attribute(self) result(attribute)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. |
Call graph
text_width
Width of string with its superscript sup [px], from the compiled-in fonts (foresight_font): the face of the texts written now (self%font, unset parts the page's family), kerned; the superscript at 0.75 size.
Attributes: pure
Returns: real(kind=R8P)
function text_width(self, string, sup, font_size) result(width)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | in | Device. | |
string | character(len=*) | in | Text. | |
sup | character(len=*) | in | Superscript. | |
font_size | real(kind=R8P) | in | Font size [px]. |
Call graph
text_face
The compiled-in face (foresight_fontdata, 1-8) of the texts written now: self%font, its family the page's when unset (set terminal ... font, else Arial: the sans face).
Attributes: pure
Returns: integer(kind=I4P)
function text_face(self) result(face)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | in | Device. |
Call graph
readout_extent
Width and height [px] of a readout: label row, glass with its slant and segment overhangs, unit text.
Attributes: pure
Returns: real(kind=R8P)
function readout_extent(self, height, cells, label, prefix, suffix, font_size) result(extent)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | in | Device. | |
height | real(kind=R8P) | in | Digit height [px]. | |
cells | integer(kind=I4P) | in | Glass cells. | |
label | character(len=*) | in | Label, empty for none. | |
prefix | character(len=*) | in | Text before the glass. | |
suffix | character(len=*) | in | Text after the glass. | |
font_size | real(kind=R8P) | in | Font size of the texts [px]. |
Call graph
glyph_group
The glyphs of string and its superscript sup (foresight_textlayout), the baseline through (x, y) [px] anchored by anchor, rotated by rotate [deg, clockwise]: a group of <use> of the glyph definitions, filled with color (the page's text color if empty).
Returns: character(len=:)
function glyph_group(self, x, y, string, anchor, sup, rotate, color) result(group)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | inout | Device. | |
x | real(kind=R8P) | in | Anchor abscissa [px]. | |
y | real(kind=R8P) | in | Baseline [px]. | |
string | character(len=*) | in | Text, UTF-8. | |
anchor | character(len=*) | in | start, middle or end. | |
sup | character(len=*) | in | Superscript, empty for none. | |
rotate | real(kind=R8P) | in | Rotation [deg, clockwise]. | |
color | character(len=*) | in | Fill, empty for the page's. |
Call graph
output_unit
Unit of the open output stream.
Attributes: pure
Returns: integer(kind=I4P)
function output_unit(self) result(unit)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | in | Device. |
Call graph
marker_element
One <path> of the markers of gnuplot point type pt, width_px px wide, centred on the points (x, y) [px]: the filled shapes (the odd types from 5, and the dot) are filled with color, the others stroked only.
Returns: character(len=:)
function marker_element(x, y, color, width_px, pt, line_width, series) result(element)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
x | real(kind=R8P) | in | Abscissae [px]. | |
y | real(kind=R8P) | in | Ordinates [px]. | |
color | character(len=*) | in | Color. | |
width_px | real(kind=R8P) | in | Marker width [px]. | |
pt | integer(kind=I4P) | in | gnuplot point type, >= 0. | |
line_width | real(kind=R8P) | in | optional | Line width [px], default gnuplot's (marker_line). |
series | integer(kind=I4P) | in | optional | Series number, 0 or absent for none. |
Call graph
marker_line
gnuplot's svg marker line [px]: the symbols are drawn 0.222 of their half width wide whatever the line width (about ps px), the dot (type 0) 0.5 px.
Attributes: elemental
Returns: real(kind=R8P)
function marker_line(width_px, pt) result(width)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
width_px | real(kind=R8P) | in | Marker width [px]. | |
pt | integer(kind=I4P) | in | gnuplot point type, >= 0. |
Call graph
marker_path
Path data of a marker of half width r centred on (x, y) [px]: gnuplot's svg shapes, 1 plus, 2 cross, 3 star, 4-5 square, 6-7 circle, 8-9 triangle, 10-11 inverted triangle, 12-13 diamond, 14-15 pentagon, 0 a 1 px dot.
Attributes: pure
Returns: character(len=:)
function marker_path(x, y, r, shape) result(d)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
x | real(kind=R8P) | in | Centre abscissa [px]. | |
y | real(kind=R8P) | in | Centre ordinate [px]. | |
r | real(kind=R8P) | in | Half width [px]. | |
shape | integer(kind=I4P) | in | Shape, 0..15. |
Call graph
glass_geometry
Glass of a readout of top-left corner (x, y): origin of its first cell (left, top of the digits), width up to the last decimal point, the prefix width and the label row height [px]. The origin leaves room for the slant of the digit bottoms and for the half thickness of the segments.
Attributes: pure
Returns: real(kind=R8P)
function glass_geometry(self, x, y, height, cells, label, prefix, font_size) result(geometry)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | in | Device. | |
x | real(kind=R8P) | in | Left side [px]. | |
y | real(kind=R8P) | in | Top side [px]. | |
height | real(kind=R8P) | in | Digit height [px]. | |
cells | integer(kind=I4P) | in | Glass cells. | |
label | character(len=*) | in | Label, empty for none. | |
prefix | character(len=*) | in | Text before the glass. | |
font_size | real(kind=R8P) | in | Font size of the texts [px]. |
Call graph
segment_path
Path data of the hexagon of segment (0-6: a, b, c, d, e, f, g) of the cell of left side ox, digits height px high, in glass coordinates (origin at the top left of the first cell).
Attributes: pure
Returns: character(len=:)
function segment_path(ox, segment, height) result(d)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ox | real(kind=R8P) | in | Cell left [px]. | |
segment | integer(kind=I4P) | in | Segment, 0-6. | |
height | real(kind=R8P) | in | Digit height [px]. |
Call graph
polygon_paint
Paint attributes of a polygon in the theme colors; a ghost (an unlit cell) at the theme ghost opacity, no border.
Attributes: pure
Returns: character(len=:)
function polygon_paint(self, fill, opacity, stroke, line_width, ghost) result(attributes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | in | Device. | |
fill | character(len=*) | in | Fill color. | |
opacity | real(kind=R8P) | in | Fill opacity. | |
stroke | character(len=*) | in | Border color. | |
line_width | real(kind=R8P) | in | Border width [px]. | |
ghost | logical | in | optional | Unlit cell. |
Call graph
glow_attribute
filter="url(#fs-glow)" with a glowing theme, else nothing.
Attributes: pure
Returns: character(len=:)
function glow_attribute(self) result(attribute)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(backend_svg) | in | Device. |
Call graph
paint
Fill and stroke attributes of a polygon: fill-opacity only below 1, the stroke width only with a stroke.
Attributes: pure
Returns: character(len=:)
function paint(fill, opacity, stroke, line_width) result(attributes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
fill | character(len=*) | in | Fill color. | |
opacity | real(kind=R8P) | in | Fill opacity. | |
stroke | character(len=*) | in | Border color. | |
line_width | real(kind=R8P) | in | Border width [px]. |
Call graph
dash_attribute
stroke-dasharray="..." attribute, empty for solid lines.
Attributes: pure
Returns: character(len=:)
function dash_attribute(dasharray) result(attribute)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
dasharray | character(len=*) | in | SVG dash array. |
Call graph
series_attribute
data-series="N" attribute.
Attributes: pure
Returns: character(len=:)
function series_attribute(series) result(attribute)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
series | integer(kind=I4P) | in | Series number. |
Call graph
flag
1 or 0.
Attributes: pure
Returns: character(len=:)
function flag(value) result(str)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
value | logical | in | Flag. |
Call graph
px
Pixel coordinate text.
Attributes: pure
Returns: character(len=:)
function px(v) result(str)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
v | real(kind=R8P) | in | Value [px]. |
Call graph