class Svg extends XMLWriter (View source)

This Class inherits the XMLwriter class and helps in developing structure of SVG Schema Export

Properties

string $title
string $author
string $font
int $fontSize

Methods

__construct()

Upon instantiation This starts writing the RelationStatsSvg XML document

void
setTitle(string $value)

Set document title

void
setAuthor(string $value)

Set document author

void
setFont(string $value)

Set document font

string
getFont()

Get document font

void
setFontSize(int $value)

Set document font size

int
getFontSize()

Get document font size

void
startSvgDoc(int $width, int $height, int $x = 0, int $y = 0)

Starts RelationStatsSvg Document

void
endSvgDoc()

Ends RelationStatsSvg Document

void
showOutput(string $fileName)

output RelationStatsSvg Document

void
printElement(string $name, int $x, int $y, int|string $width = '', int|string $height = '', string|null $text = '', string $styles = '')

Draws RelationStatsSvg elements

void
printElementLine(string $name, int $x1, int $y1, int $x2, int $y2, string $styles)

Draws RelationStatsSvg Line element

Details

__construct()

Upon instantiation This starts writing the RelationStatsSvg XML document

See also

\XMLWriter::openMemory()
\XMLWriter::setIndent()
\XMLWriter::startDocument()

void setTitle(string $value)

Set document title

Parameters

string $value

sets the title text

Return Value

void

void setAuthor(string $value)

Set document author

Parameters

string $value

sets the author

Return Value

void

void setFont(string $value)

Set document font

Parameters

string $value

sets the font e.g Arial, Sans-serif etc

Return Value

void

string getFont()

Get document font

Return Value

string

returns the font name

void setFontSize(int $value)

Set document font size

Parameters

int $value

sets the font size in pixels

Return Value

void

int getFontSize()

Get document font size

Return Value

int

returns the font size

void startSvgDoc(int $width, int $height, int $x = 0, int $y = 0)

Starts RelationStatsSvg Document

svg document starts by first initializing svg tag which contains all the attributes and namespace that needed to define the svg document

Parameters

int $width

total width of the RelationStatsSvg document

int $height

total height of the RelationStatsSvg document

int $x

min-x of the view box

int $y

min-y of the view box

Return Value

void

See also

\XMLWriter::startElement()
\XMLWriter::writeAttribute()

void endSvgDoc()

Ends RelationStatsSvg Document

Return Value

void

See also

\XMLWriter::endElement()
\XMLWriter::endDocument()

void showOutput(string $fileName)

output RelationStatsSvg Document

svg document prompted to the user for download RelationStatsSvg document saved in .svg extension and can be easily changeable by using any svg IDE

Parameters

string $fileName

file name

Return Value

void

See also

\XMLWriter::startElement()
\XMLWriter::writeAttribute()

void printElement(string $name, int $x, int $y, int|string $width = '', int|string $height = '', string|null $text = '', string $styles = '')

Draws RelationStatsSvg elements

SVG has some predefined shape elements like rectangle & text and other elements who have x,y co-ordinates are drawn. specify their width and height and can give styles too.

Parameters

string $name

RelationStatsSvg element name

int $x

The x attr defines the left position of the element (e.g. x="0" places the element 0 pixels from the left of the browser window)

int $y

The y attribute defines the top position of the element (e.g. y="0" places the element 0 pixels from the top of the browser window)

int|string $width

The width attribute defines the width the element

int|string $height

The height attribute defines the height the element

string|null $text

The text attribute defines the text the element

string $styles

The style attribute defines the style the element styles can be defined like CSS styles

Return Value

void

See also

\XMLWriter::startElement()
\XMLWriter::writeAttribute()
\XMLWriter::text()
\XMLWriter::endElement()

void printElementLine(string $name, int $x1, int $y1, int $x2, int $y2, string $styles)

Draws RelationStatsSvg Line element

RelationStatsSvg line element is drawn for connecting the tables. arrows are also drawn by specify its start and ending co-ordinates

Parameters

string $name

RelationStatsSvg element name i.e line

int $x1

Defines the start of the line on the x-axis

int $y1

Defines the start of the line on the y-axis

int $x2

Defines the end of the line on the x-axis

int $y2

Defines the end of the line on the y-axis

string $styles

The style attribute defines the style the element styles can be defined like CSS styles

Return Value

void

See also

\XMLWriter::startElement()
\XMLWriter::writeAttribute()
\XMLWriter::endElement()