Yahoo! UI Library

charts  3.3.0

Yahoo! UI Library > charts > VMLGraphics
Search:
 
Filters

Class VMLGraphics

VMLGraphics is a fallback drawing api used for basic drawing operations when SVG is not available.

Constructor

VMLGraphics ( )

Properties

_shape - private object


_typeConversionHash - private Object

Used to convert certain shape types to the appropriate vml node type.

autoSize - String

Indicates whether or not the instance will size itself based on its contents.

Methods

_clearPath

private void _clearPath ( )
Clears path properties

_createGraphicNode

private _createGraphicNode ( type , pe )
Creates a graphic node
Parameters:
type <String> node type to create
pe <String> specified pointer-events value
Returns:
HTMLElement

_createGraphics

private void _createGraphics ( )
Creates a group element

_draw

private void _draw ( )
Completes a shape

_getFill

private void _getFill ( )
Returns ths actual fill object to be used in a drawing or shape

_getNodeShapeType

private _getNodeShapeType ( type )
Converts a shape type to the appropriate vml node type.
Parameters:
type <String> The shape to convert.
Returns:
String

_getWedgePath

private _getWedgePath ( config )
Generates a path string for a wedge shape
Parameters:
config <Object> attributes used to create the path
Returns:
String

_initProps

private void _initProps ( )
Clears the properties

_removeChildren

private void _removeChildren ( node )
Removes all child nodes.
Parameters:
node <object>

_toggleVisible

private void _toggleVisible ( node , val )
Toggles visibility
Parameters:
node <HTMLElement> element to toggle
val <Boolean> indicates visibilitye

_trackSize

private void _trackSize ( w , h )
Updates the size of the graphics object
Parameters:
w <Number> width
h <Number> height

addChild

private void addChild ( element )
Adds a child to the node.
Parameters:
element <HTMLElement> to add

beginBitmapFill

void beginBitmapFill ( config )
Specifies a bitmap fill used by subsequent calls to other drawing methods.
Parameters:
config <Object>

beginFill

void beginFill ( color , alpha )
Specifes a solid fill used by subsequent calls to other drawing methods.
Parameters:
color <String> Hex color value for the fill.
alpha <Number> Value between 0 and 1 used to specify the opacity of the fill.

beginGradientFill

void beginGradientFill ( config )
Specifies a gradient fill used by subsequent calls to other drawing methods.
Parameters:
config <Object>

clear

void clear ( )
Clears the graphics object.

curveTo

void curveTo ( cp1x , cp1y , cp2x , cp2y , x , y )
Draws a bezier curve.
Parameters:
cp1x <Number> x-coordinate for the first control point.
cp1y <Number> y-coordinate for the first control point.
cp2x <Number> x-coordinate for the second control point.
cp2y <Number> y-coordinate for the second control point.
x <Number> x-coordinate for the end point.
y <Number> y-coordinate for the end point.

destroy

void destroy ( )
Removes all nodes.

drawCircle

void drawCircle ( x , y , r )
Draws a circle.
Parameters:
x <Number> y-coordinate
y <Number> x-coordinate
r <Number> radius

drawEllipse

void drawEllipse ( x , y , w , h )
Draws an ellipse.
Parameters:
x <Number> x-coordinate
y <Number> y-coordinate
w <Number> width
h <Number> height

drawRect

void drawRect ( x , y , w , h )
Draws a rectangle.
Parameters:
x <Number> x-coordinate
y <Number> y-coordinate
w <Number> width
h <Number> height

drawWedge

void drawWedge ( x , y , startAngle , arc , radius , yRadius )
Draws a wedge.
Parameters:
x <Number> x-coordinate of the wedge's center point
y <Number> y-coordinate of the wedge's center point
startAngle <Number> starting angle in degrees
arc <Number> sweep of the wedge. Negative values draw clockwise.
radius <Number> radius of wedge. If [optional] yRadius is defined, then radius is the x radius.
yRadius <Number> [optional] y radius for wedge.

end

void end ( )
Completes a drawing operation.

getShape

getShape ( config )
Creates a Shape instance and adds it to the graphics object.
Parameters:
config <Object> Object literal of properties used to construct a Shape.
Returns:
Shape

lineGradientStyle

private void lineGradientStyle ( )
Specifies a gradient to use for the stroke when drawing lines. Not implemented

lineStyle

void lineStyle ( thickness , color , alpha )
Specifies a line style used for subsequent calls to drawing methods.
Parameters:
thickness <Number> indicates the thickness of the line
color <String> hex color value for the line
alpha <Number> Value between 0 and 1 used to specify the opacity of the fill.

lineTo

void lineTo ( point1 , point2 )
Draws a line segment using the current line style from the current drawing position to the specified x and y coordinates.
Parameters:
point1 <Number> x-coordinate for the end point.
point2 <Number> y-coordinate for the end point.

moveTo

void moveTo ( x , y )
Moves the current drawing position to specified x and y coordinates.
Parameters:
x <Number> x-coordinate for the end point.
y <Number> y-coordinate for the end point.

quadraticCurveTo

void quadraticCurveTo ( cpx , cpy , x , y )
Draws a quadratic bezier curve.
Parameters:
cpx <Number> x-coordinate for the control point.
cpy <Number> y-coordinate for the control point.
x <Number> x-coordinate for the end point.
y <Number> y-coordinate for the end point.

render

void render ( parentNode )
Adds the graphics node to the dom.
Parameters:
parentNode <HTMLElement> node in which to render the graphics node into.

setPosition

void setPosition ( x , y )
Sets the positon of the graphics object.
Parameters:
x <Number> x-coordinate for the object.
y <Number> y-coordinate for the object.

setSize

void setSize ( w , h )
Sets the size of the graphics object.
Parameters:
w <Number> width to set for the instance.
h <Number> height to set for the instance.

toggleVisible

void toggleVisible ( val )
Shows and and hides a the graphic instance.
Parameters:
val <Boolean> indicates whether the instance should be visible.


Copyright © 2011 Yahoo! Inc. All rights reserved.