Libraries.Data.Formats.ScalableVectorGraphics.Label Documentation
The Label class is an implementation of text in the SVG standard. Like other ScalableVectorGraphicsObjects the Label class inherits global attributes but it also has its own attributes.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
// make text
Label label
label:SetPosition(50, 50)
label:SetText("words words words")
label:SetTextAnchor("middle")
label:SetFontSize("12pt")
Inherits from: Libraries.Language.Object, Libraries.Data.Formats.ScalableVectorGraphics.ScalableVectorGraphicsObject
Summary
Actions Summary Table
Actions | Description |
---|---|
Compare(Libraries.Language.Object object) | This action compares two object hash codes and returns an integer. |
Equals(Libraries.Language.Object object) | This action determines if two objects are equal based on their hash code values. |
GetAriaDescribedBy() | This action will give a aria-describedby attribute to the SVG element. |
GetAriaDescription() | This action will give a aria-description attribute to the SVG element. |
GetAriaLabel() | This action will give a aria-label attribute to the SVG element. |
GetAriaLabelledBy() | This action will give a aria-labelledby attribute to the SVG element. |
GetAriaRoleDescription() | This action will give a aria-roledescription attribute to the SVG element. |
GetCloseTag(text name, boolean container) | This is an interal action that allows the ScalableVectorGraphicsObject generate the correct closing tag. |
GetColor() | This action returns the color of the object. |
GetDescription() | This action will return the currently set description to a ScalableVectorGraphicsObject. |
GetFill() | This action returns the fill of the object. |
GetFontFamily() | This action returns the current font-family to the list of fonts give (can list multiple with comma-delimited list). |
GetFontSize() | This action returns the current font size with the unit appended. |
GetHashCode() | This action gets the hash code for an object. |
GetHorizontalShift() | This action returns the shift the text on the x axis from its position with the unit appended. |
GetID() | This action returns the id of the object. |
GetRole() | This action will give a role attribute to the SVG element. |
GetRotation() | This action returns how much each individual glyph of the text is being rotated. |
GetStroke() | This action returns the stroke of the object. |
GetStrokeWidth() | This action returns the stroke width of the object. |
GetStyle() | This action returns the style information of the object. |
GetStyleClass() | This action will give a class attribute to the SVG element. |
GetTabIndex() | This action returns the tab index of the object. |
GetText() | This action returns the text that this object would show. |
GetTextAnchor() | This action returns where the text anchor is set. |
GetTextLength() | This action returns the width that the text of the label will be scaled to fit with the unit appended. |
GetTitle() | This action will return the currently set title of the object. |
GetTransform() | This action returns the current transform applied on the element |
GetVerticalShift() | This action returns the shift the text on the y axis from its position with the unit appended. |
GlobalAttributesToText() | This is an interal action that allows the ScalableVectorGraphicsObject to write out its global attributes. |
IsContainer() | This action is used internally by the system to designate whether the SVG element is a single tag or contains more objects within it. |
SetAriaDescribedBy(text ariaDescribedBy) | This action will give a aria-describedby attribute to the SVG element. |
SetAriaDescription(text ariaDescription) | This action will give a aria-description attribute to the SVG element. |
SetAriaLabel(text ariaLabel) | This action will give a aria-label attribute to the SVG element. |
SetAriaLabelledBy(text ariaLabelledBy) | This action will give a aria-labelledby attribute to the SVG element. |
SetAriaRoleDescription(text ariaRoleDescription) | This action will give a aria-roledescription attribute to the SVG element. |
SetColor(text color) | This action will give a color attribute to the SVG element. |
SetDescription(text description) | This action will give a description to a ScalableVectorGraphicsObject. |
SetFill(Libraries.Game.Graphics.Color fill) | This action will give a fill attribute to the SVG element. |
SetFill(text fill) | This action will give a fill attribute to the SVG element. |
SetFontFamily(text fontFamily) | This action sets the current font-family to the list of fonts give (can list multiple with comma-delimited list). |
SetFontSize(text fontSize) | This action sets the current font size with the unit appended. |
SetHorizontalShift(number dx, text unit) | This action sets how much to shift the text on the x axis from its position. |
SetHorizontalShift(number dx) | This action sets how much to shift the text on the x axis from its position. |
SetID(text id) | This action will give an ID attribute to the SVG element. |
SetIsContainer(boolean isContainer) | This action is used internally by the system to designate whether the SVG element is a single tag or contains more objects within it. |
SetPosition(number x, number y, text unit) | This action sets the position of the label. |
SetPosition(number x, number y) | This action sets the position of the label. |
SetPositionX(number x, text unit) | This action sets the x position of the label. |
SetPositionX(number x) | This action sets the x position of the label. |
SetPositionY(number y) | This action sets the y position of the label. |
SetPositionY(number y, text unit) | This action sets the y position of the label. |
SetRole(text role) | This action will give a role attribute to the SVG element. |
SetRotation(integer degrees) | This action sets how much to rotate each individual glyph of the text. |
SetStroke(text stroke) | This action will give a stroke attribute to the SVG element. |
SetStroke(Libraries.Game.Graphics.Color stroke) | This action will give a stroke attribute to the SVG element. |
SetStrokeWidth(number strokeWidth) | This action sets the width of the stroke of the SVG element. |
SetStrokeWidth(number strokeWidth, text unit) | This action sets the width of the stroke of the SVG element along with which unit to use. |
SetStyle(text style) | This action will give a style attribute to the SVG element. |
SetStyleClass(text styleClass) | This action will give a class attribute to the SVG element. |
SetTabIndex(integer tabIndex) | This action will give the ScalableVectorGraphicsObject a tab index. |
SetText(text labelText) | This action sets the text that this element will render. |
SetTextAnchor(text textAnchor) | This action sets where the text anchor is. |
SetTextLength(number textLength, text unit) | This action sets the width that the text of the label will be scaled to fit. |
SetTextLength(number textLength) | This action sets the width that the text of the label will be scaled to fit. |
SetTitle(text title) | This action will give a title to a ScalableVectorGraphicsObject. |
SetTransform(text transform) | This action sets a transform on the current element. |
SetVerticalShift(number dy, text unit) | This action sets how much to shift the text on the y axis from its position. |
SetVerticalShift(number dy) | This action sets how much to shift the text on the y axis from its position. |
ToText() | This action writes out all of the necessary tags and attributes that make up this label. |
Actions Documentation
Compare(Libraries.Language.Object object)
This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.
Example Code
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Compare result, Smaller, Equal, or Larger.
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their hash code values.
Example Code
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
GetAriaDescribedBy()
This action will give a aria-describedby attribute to the SVG element. This aria-describedby can be for general use by a web browser.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetAriaDescribedBy("This is a blue circle with a radius of 5.0")
Return
text:
GetAriaDescription()
This action will give a aria-description attribute to the SVG element. This aria-description can be for general use by a web browser.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetAriaDescription("This is a blue circle with a radius of 5.0")
Return
text:
GetAriaLabel()
This action will give a aria-label attribute to the SVG element. This aria-label can be for general use by a web browser.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetAriaLabel("My Circle")
Return
text:
GetAriaLabelledBy()
This action will give a aria-labelledby attribute to the SVG element. This aria-labelledby can be for general use by a web browser.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetAriaLabelledBy("id")
Return
text:
GetAriaRoleDescription()
This action will give a aria-roledescription attribute to the SVG element. This aria-roledescription can be for general use by a web browser.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetAriaRoleDescription("This is a blue circle with a radius of 5.0")
Return
text:
GetCloseTag(text name, boolean container)
This is an interal action that allows the ScalableVectorGraphicsObject generate the correct closing tag.
Parameters
Return
text:
GetColor()
This action returns the color of the object.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetColor("navy")
output circle:GetColor()
Return
text: the color of the object.
GetDescription()
This action will return the currently set description to a ScalableVectorGraphicsObject.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetDescription("This is my circle and it will be blue")
text myDescpription = circle:GetDescription()
Return
text: The current text description of the object.
GetFill()
This action returns the fill of the object.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetFill("navy")
output circle:GetFill()
Return
text: the fill of the object.
GetFontFamily()
This action returns the current font-family to the list of fonts give (can list multiple with comma-delimited list).
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetFontFamily("Arial")
myLabel:SetFontFamily("Arial, Halvetica, sans-serif")
output myLabel:GetFontSize()
Return
text: the value for the current font family
GetFontSize()
This action returns the current font size with the unit appended.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetFontSize("12pt")
output myLabel:GetFontSize()
Return
text: The current font size
GetHashCode()
This action gets the hash code for an object.
Example Code
Object o
integer hash = o:GetHashCode()
Return
integer: The integer hash code of the object.
GetHorizontalShift()
This action returns the shift the text on the x axis from its position with the unit appended.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:GetHorizontalShift(12)
output myLabel:GetHorizontalShift()
Return
text: The amount of shift on the x axis.
GetID()
This action returns the id of the object.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetID("My Circle")
output circle:GetID()
Return
text: the id of the object.
GetRole()
This action will give a role attribute to the SVG element. This role can be for general use by a web browser.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetRole("region")
Return
text:
GetRotation()
This action returns how much each individual glyph of the text is being rotated.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetRotation(270)
output myLabel:GetRotation()
Return
integer: The amount of rotation in degrees.
GetStroke()
This action returns the stroke of the object.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetStroke("navy")
output circle:GetStroke()
Return
text: the stroke of the object.
GetStrokeWidth()
This action returns the stroke width of the object. Since lengths can have varying units in SVG the unit will be appended to the returned length
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetStrokeWidth(5, "%")
text strokeWidth = circle:GetStrokeWidth()
Return
text: the stroke width with the unit appended if one was given.
GetStyle()
This action returns the style information of the object.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetStyle("fill: skyblue; stroke: navy;")
output circle:GetStyle()
Return
text: the style information of the object.
GetStyleClass()
This action will give a class attribute to the SVG element. This class can be for gerneral use by a web browser or for when using a styling sheet on the SVG file.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetStyleClass("circleClass")
Return
text:
GetTabIndex()
This action returns the tab index of the object.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetTabIndex(5)
output circle:GetTabIndex()
Return
integer: the tab index of the object.
GetText()
This action returns the text that this object would show.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetText("Words Words and more words")
output myLabel:GetText()
Return
text: the text that this label shows
GetTextAnchor()
This action returns where the text anchor is set.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:GetTextAnchor("middle")
output myLabel:GetTextAnchor()
Return
text: The current text anchor.
GetTextLength()
This action returns the width that the text of the label will be scaled to fit with the unit appended.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetTextLength(50)
output myLabel:GetTextLength()
Return
text: The width that the text will be fit to
GetTitle()
This action will return the currently set title of the object.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetTitle("My Circle")
text myTitle = circle:GetTitle()
Return
text: The current title of the object.
GetTransform()
This action returns the current transform applied on the element
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetTransfrom("rotate(270,100,100)")
output myLabel:GetTransform()
Return
text: The current applied transform.
GetVerticalShift()
This action returns the shift the text on the y axis from its position with the unit appended.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:GetVerticalShift(12)
output myLabel:GetVerticalShift()
Return
text: The amount of shift on the y axis.
GlobalAttributesToText()
This is an interal action that allows the ScalableVectorGraphicsObject to write out its global attributes.
Return
text:
IsContainer()
This action is used internally by the system to designate whether the SVG element is a single tag or contains more objects within it.
Return
boolean:
SetAriaDescribedBy(text ariaDescribedBy)
This action will give a aria-describedby attribute to the SVG element. This aria-describedby can be for general use by a web browser.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetAriaDescribedBy("This is a blue circle with a radius of 5.0")
Parameters
- text ariaDescribedBy: The aria-describedby for the object.
SetAriaDescription(text ariaDescription)
This action will give a aria-description attribute to the SVG element. This aria-description can be for general use by a web browser.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetAriaDescription("This is a blue circle with a radius of 5.0")
Parameters
- text ariaDescription: The aria-description for the object.
SetAriaLabel(text ariaLabel)
This action will give a aria-label attribute to the SVG element. This aria-label can be for general use by a web browser.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetAriaLabel("My Circle")
Parameters
- text ariaLabel: The aria-label name for the object.
SetAriaLabelledBy(text ariaLabelledBy)
This action will give a aria-labelledby attribute to the SVG element. This aria-labelledby can be for general use by a web browser.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetAriaLabelledBy("id")
Parameters
- text ariaLabelledBy: The aria-labelledby name for the object.
SetAriaRoleDescription(text ariaRoleDescription)
This action will give a aria-roledescription attribute to the SVG element. This aria-roledescription can be for general use by a web browser.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetAriaRoleDescription("This is a blue circle with a radius of 5.0")
Parameters
- text ariaRoleDescription: The aria-roledescription for the object.
SetColor(text color)
This action will give a color attribute to the SVG element. This attribute does not directly change an objects color. It provides a color for other attriubtes, such as fill and stroke that may not have a defined color, to inherit a color.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetColor("green")
Parameters
- text color: The color for the object. Color in SVG is defined by the CSS data type so this could be defined a keyword, the RGB cubic-coordinate system, or the HSL cyclindrical-coordinate system.
SetDescription(text description)
This action will give a description to a ScalableVectorGraphicsObject. When an object has a non-empty description a description tag will be generated when the whole object is written out. A description in SVG functions similarly to the description of an image in HTML.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetDescription("This is my circle and it will be blue")
Parameters
- text description: The text that will be the description of the object.
SetFill(Libraries.Game.Graphics.Color fill)
This action will give a fill attribute to the SVG element. This attribute may do different things depending on the type of SVG element. For shapes and text it will define the color used to paint the object
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
use Libraries.Game.Graphics.Color
Color blue
blue:SetColor(0, 0, 1, 1)
Circle circle
circle:SetFill(blue)
Parameters
- Libraries.Game.Graphics.Color: The fill attribute for the object. For shapes and text this will be a color and color in SVG is defined by the CSS data type so this could be defined a keyword, the RGB cubic-coordinate system, or the HSL cyclindrical-coordinate system.
SetFill(text fill)
This action will give a fill attribute to the SVG element. This attribute may do different things depending on the type of SVG element. For shapes and text it will define the color used to paint the object
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetFill("green")
Parameters
- text fill: The fill attribute for the object. For shapes and text this will be a color and color in SVG is defined by the CSS data type so this could be defined a keyword, the RGB cubic-coordinate system, or the HSL cyclindrical-coordinate system.
SetFontFamily(text fontFamily)
This action sets the current font-family to the list of fonts give (can list multiple with comma-delimited list).
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetFontFamily("Arial")
myLabel:SetFontFamily("Arial, Halvetica, sans-serif")
output myLabel:GetFontSize()
Parameters
SetFontSize(text fontSize)
This action sets the current font size with the unit appended.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetFontSize("12pt")
output myLabel:GetFontSize()
Parameters
SetHorizontalShift(number dx, text unit)
This action sets how much to shift the text on the x axis from its position.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetHorizontalShift(50, "%")
Parameters
- number dx: The amount of shift on the x axis.
- text unit: The unit of the length given.
SetHorizontalShift(number dx)
This action sets how much to shift the text on the x axis from its position.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetHorizontalShift(12)
Parameters
- number dx: The amount of shift on the x axis.
SetID(text id)
This action will give an ID attribute to the SVG element. This is useful in contexts where you need to reference an SVG element by a name such as when using a styling sheet with the SVG file.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetID("circle1")
Parameters
- text id: The id of the object.
SetIsContainer(boolean isContainer)
This action is used internally by the system to designate whether the SVG element is a single tag or contains more objects within it.
Parameters
- boolean isContainer: true if it will contain other objects, false if not
SetPosition(number x, number y, text unit)
This action sets the position of the label. Note that text in SVG is positioned based where the text anchor is.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetPosition(50,50, "em")
Parameters
- number x: The x position of the label.
- number y: The y position of the label.
- text unit: The unit of the length given.
SetPosition(number x, number y)
This action sets the position of the label. Note that text in SVG is positioned based where the text anchor is.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetPosition(60,60)
Parameters
- number x: The x position of the label.
- number y: The y position of the label.
SetPositionX(number x, text unit)
This action sets the x position of the label. Note that text in SVG is positioned based where the text anchor is.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetPositionX(12,"em")
Parameters
- number x: The x position of the label.
- text unit: The unit of the length given.
SetPositionX(number x)
This action sets the x position of the label. Note that text in SVG is positioned based where the text anchor is.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetPositionX(60)
Parameters
- number x: The x position of the label.
SetPositionY(number y)
This action sets the y position of the label. Note that text in SVG is positioned based where the text anchor is.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetPositionY(60)
Parameters
- number y: The y position of the label.
SetPositionY(number y, text unit)
This action sets the y position of the label. Note that text in SVG is positioned based where the text anchor is.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetPositionY(12,"em")
Parameters
- number y: The y position of the rectangle.
- text unit: The unit of the length given.
SetRole(text role)
This action will give a role attribute to the SVG element. This role can be for general use by a web browser.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetRole("region")
Parameters
- text role: The role name for the object.
SetRotation(integer degrees)
This action sets how much to rotate each individual glyph of the text.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetRotation(270)
Parameters
- integer degrees: The amount of rotation in degrees.
SetStroke(text stroke)
This action will give a stroke attribute to the SVG element. This attribute defines the color used to paint the outline of a shape. For shapes like lines that have no fill a stroke must be set so that the line will be visible.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetStroke("navy")
Parameters
- text stroke: The stroke attribute for the object. For shapes and text this will be a color and color in SVG is defined by the CSS data type so this could be defined a keyword, the RGB cubic-coordinate system, or the HSL cyclindrical-coordinate system.
SetStroke(Libraries.Game.Graphics.Color stroke)
This action will give a stroke attribute to the SVG element. This attribute defines the color used to paint the outline of a shape. For shapes like lines that have no fill a stroke must be set so that the line will be visible.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
use Libraries.Game.Graphics.Color
Color blue
blue:SetColor(0, 0, 1, 1)
Circle circle
circle:SetStroke(blue)
Parameters
- Libraries.Game.Graphics.Color: The stroke attribute for the object. For shapes and text this will be a color and color in SVG is defined by the CSS data type so this could be defined a keyword, the RGB cubic-coordinate system, or the HSL cyclindrical-coordinate system.
SetStrokeWidth(number strokeWidth)
This action sets the width of the stroke of the SVG element. Shapes with an outline have a stroke width.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetStrokeWidth(5)
Parameters
- number strokeWidth: The width of the stroke
SetStrokeWidth(number strokeWidth, text unit)
This action sets the width of the stroke of the SVG element along with which unit to use. Shapes with an outline have a stroke width. In SVG, units are defined by unit identifiers giving by the CSS specification along with percentages.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetStrokeWidth(5, "%")
Parameters
- number strokeWidth: The width of the stroke
- text unit: The unit of the length given.
SetStyle(text style)
This action will give a style attribute to the SVG element. This attribute also for embedding CSS declarations inline with the SVG element. Use of this attribute requires knowledge of CSS.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetStyle("fill: skyblue; stroke: navy;")
Parameters
- text style: The style information that will be added to the object.
SetStyleClass(text styleClass)
This action will give a class attribute to the SVG element. This class can be for gerneral use by a web browser or for when using a styling sheet on the SVG file.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetStyleClass("circleClass")
Parameters
SetTabIndex(integer tabIndex)
This action will give the ScalableVectorGraphicsObject a tab index. A non-negative tab index attribute will allow the element to be focusable and it can define the relative order for sequential navigation with the tab key. If two objects have the same tab index then whichever was added first is first in the naviagation. Default is 0 which means the item is focusable.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle1
Circle circle2
Circle circle3
circle1:SetTabIndex(1)
circle2:SetTabIndex(2)
circle3:SetTabIndex(3)
Parameters
- integer tabIndex: The index of the object in the tab navigation.
SetText(text labelText)
This action sets the text that this element will render.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetText("Words Words and more words")
Parameters
- text labelText: the text that this label will show
SetTextAnchor(text textAnchor)
This action sets where the text anchor is. The text anchor affects how a text chunk is aligned to the point that is the label's position. Possible values are start, middle, and end. By default a label will use start.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetTextAnchor("middle")
Parameters
SetTextLength(number textLength, text unit)
This action sets the width that the text of the label will be scaled to fit.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetTextLength(10,"%")
Parameters
- number textLength: the width that the text will be fit to.
- text unit: The unit of the length given.
SetTextLength(number textLength)
This action sets the width that the text of the label will be scaled to fit.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetTextLength(50)
Parameters
- number textLength: the width that the text will be fit to.
SetTitle(text title)
This action will give a title to a ScalableVectorGraphicsObject. When an object has a non-empty title a title tag will be generated when the whole object is written out which will show the title as a popup box when hovering over the object in the final SVG file.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Circle circle
circle:SetTitle("My Circle")
Parameters
- text title: The text that will be the title of the object.
SetTransform(text transform)
This action sets a transform on the current element.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetTransform("rotate(270,100,100)")
Parameters
SetVerticalShift(number dy, text unit)
This action sets how much to shift the text on the y axis from its position.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetVerticalShift(50, "%")
Parameters
- number dy: The amount of shift on the y axis.
- text unit: The unit of the length given.
SetVerticalShift(number dy)
This action sets how much to shift the text on the y axis from its position.
Example Code
Libraries.Data.Formats.ScalableVectorGraphics.all
Label myLabel
myLabel:SetVerticalShift(12)
Parameters
- number dy: The amount of shift on the y axis.
ToText()
This action writes out all of the necessary tags and attributes that make up this label. This action will be called automatically by the parent ScalableVectorGraphics, as such this action does not need to be used directly by the user.
Return
text: the formatted string of all tags and attributes for this shape