index.mustache revision a31d4503481b752a9ea058cce3d9b025d040a87c
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<div class="intro">
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <img src="{{componentAssets}}/img/graphics.png" alt="Screenshot of the Graphics" style="border: 1px solid #bfbfbf; float:right; height:150px; margin: 0 0 8px 8px; width:275px;">
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp The Graphics module provides a JavaScript API for creating shapes in a variety of formats across all A-grade browsers. Based on device and browser capabilities, Graphics leverages SVG, HTML Canvas and VML to render its graphical elements.
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp The Graphics module features a `Graphic` class that allows you to easily create and manage shapes. Currently, a `Graphic` instance can be used to create predifined shapes and free-form polygons with fill and stroke properties.
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp{{>getting-started}}
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h2 id="using">Using the Graphics module</h2>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>The `Graphic` class acts a factory and container for shapes. You need at least one `Graphic` instance to create shapes for your application.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h3 id="instantiating">Instantiating A Graphic instance</h3>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>All you need to instantiate a Graphic instance is an HTML element in which to render. Alternatively, you can attach your instance to the body of your page.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h4>CSS</h4>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp#mygraphiccontainer {
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp width: 600px;
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp height: 400px;
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h4>HTML</h4>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<div id="mygraphiccontainer"></div>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h4>JavaScript</h4>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp// Instantiate a graphic instance
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Trippvar mygraphic = new Y.Graphic({
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp render: "#mygraphiccontainer"
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <p>By default, `Graphic` will size to its parent container. The API also provides the option of explicitly setting its `width` and `height` attributes. Additionally, the Graphic class provides an `autoSize` attribute. When set to true, the Graphic instance will expand to fit its contents.
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h3>Creating shapes</h3>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>Shapes are created using the `getShape` method. The `getShape` method takes a config parameter that defines the shape and its properties. When creating a shape, the shape is determined by the `type`
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Trippattribute. The `Graphics` module includes four pre-defined shapes. They can be created by passing a `String` reference.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <th>key</th>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <th>shape</th>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>circle</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>ellipse</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>rect</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>path</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>Alternatively, you can create your own custom class and pass it directly through the `type` attribute.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>The below code would create a 300x200 rectangle with a blue fill and a red border.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Trippvar mygraphic = new Y.Graphic({render:"#mygraphiccontainer"}),
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp type: "rect",
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp width: 300,
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp height: 200,
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp color: "#0000ff"
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp color: "#ff0000"
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>This code would create an instance of a custom shape that you have created.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Trippvar mygraphic = new Y.Graphic({render:"#mygraphiccontainer"}),
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp width: 300,
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp height: 200,
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp color: "#0000ff"
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp color: "#ff0000"
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h3 id="aboutgraphic">Working with the Graphic Class</h3>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>The `Graphics` module uses different technologies based on browser capabilities. The `Graphics` module normalizes these different technologies with a consistent API. Ideally, you should not
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripphave to interact directly with the underlying technologies or their corresponding HTML elements. Both the `Graphic` and `Shape` classes provide APIs for sizing, positioning and customization.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h4 id="graphicattributes">Graphic Attributes</h4>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>The `Graphic` class exposes the following attributes.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <th>Attribute</th>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <th>Type</th>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <th>Description</th>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`id`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`String`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Unique identifier for the `Graphic` instance. If not explicity set, one will be generated.</td></tr>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`shapes`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Object`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Key value pairs containing all shape instances contained in the `Graphic` instance.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`contentBounds`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Object`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Object containing size and coordinate data for the content of a Graphic in relation to the coordinate space of the `Graphic` instance. The following values are included: `top`, `right`, `bottom`, `left`, `width` and `height`.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`node`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`HTMLElement`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Outermost HTMLElement of the `Graphic` instance. (read-only)</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`width`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Number`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>The width of the `Graphic` instance.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`height`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Number`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>The height of the `Graphic` instance.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`autoSize`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`boolean`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Determines how the size of instance is calculated. If true, the width and height are determined by the size of the contents. If false, the width and height values are either explicitly set or determined by the size of the parent node's dimensions. The default value is false.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`resizeDown`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`boolean`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>When overflow is set to true, by default, `the contentBounds` will resize to greater values but not to smaller values. (for performance) When resizing the `contentBounds` down is desirable, set the resizeDown value to true. The default value is false.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`x`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Number`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Indicates the x-coordinate for the instance.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`y`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Number`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Indicates the y-coordinate for the instance.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`autoDraw`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`boolean`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Indicates whether or not the instance will automatically redraw after a change is made to a shape. When performing multiple operations, such adding many shapes, `autoDraw` can be set to false. Calling `_redraw` will force a redraw when `autoDraw` is `false`.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`visible`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`boolean`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Toggles visibility for a `Graphic` instance.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h4 id="graphicmethods">Graphic Methods</h4>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>The `Graphic` class also has the following public methods.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <th>`Method`</th>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <th>Description</th>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>getXY</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Returns an array containing the current position of the graphic instance in page coordinates.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>getShape</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Generates and returns a shape instance by type.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>removeShape</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Removes a shape instance from from the graphic instance.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>removeAllShapes</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Removes all shape instances</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>destroy</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Destroys the graphic instance and all its children.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>getShapeById</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Returns a shape instance based on an id.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>batch</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Allows for creating multiple shapes in order to batch appending and redraw operations.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h3 id="aboutshapes">Working with Shapes</h3>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h4 id="shapeattributes">Shape Attributes</h4>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>Each shape shares a common set of attributes. Attributes shared across all shapes are listed below:</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <th>Attribute</th>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <th>Type</th>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <th>Description</th>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`id`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`String`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Unique identifier for the `Shape` instance. If not explicity set, one will be generated.</td></tr>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`node`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`HTMLElement`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>HTMLElement of the `Shape` instance. (read-only)</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`x`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Number`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>The x-coordinate of the shape.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`y`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Number`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>The y-coordinate of the shape.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`width`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Number`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>The width of the `Shape` instance.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`height`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Number`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>The height of the `Shape` instance.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`visible`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`boolean`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Toggles visibility for a `Shape` instance.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`fill`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Object`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp Contains information about the fill of the shape.
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>stroke</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Object`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp Contains information about the stroke of the shape.
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`rotation`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Number` (0 - 360)</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Rotates the shape.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`transformOrigin`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Array`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>The x and y values for the transformOrigin of a transform.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`translateX`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Number`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>The x-coordinate for applying a translate transform.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`translateY`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`Number`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>The x-coordinate for applying a translate transform.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h4 id="shapemethods">Shape Methods</h4>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>Shapes can also be manipulated by the following methods:</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <th>Method</th>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <th>Description</th>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`addClass`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Adds a class to the underlying HTMLElement.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`removeClass`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Removes a class to the underlying HTMLElement.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`getXY`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Gets the current position of the shape in page coordinates. Returns an array, `[x, y,]`, with the coordinates.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`setXY`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Sets the current position of the shape in page coordinates. Accepts an array, `[x, y]`, with the coordinates.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`get`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Returns the value of a given attribute.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>`set`</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <td>Sets the value of an attribute.</td>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h4 id="drawingmethods">Drawing Methods</h4>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>Unlike the other included shapes, the `Path` class is not pre-defined. Setting the size, fill and/or stroke of a pre-defined shape will render the shape. This is not true with the `Path`. To render
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Trippa `Path` instance, its drawing methods need to be leveraged. Available drawing methods include:
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>moveTo</dt><dd>Moves to a coordinate point without drawing a line.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>lineTo</dt><dd>Draws a line segment from the current point to the specified point.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>curveTo</dt><dd>Draws a curve based on a start point, end point and two control points.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>quadraticCurveTo</dt><dd>Draws a quadratic curve based on a start point, end point and two control points.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>end</dt><dd>Ends a drawing operation. The shape will draw after end is called.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>clear</dt><dd>Clears all contents of the path element.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>These drawing methods can also be leveraged when creating custom shapes.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h4 id="strokesandfills">Strokes and Fills</h4>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>All `Shape` instances contain `stroke` and `fill` attributes. They are used to define the colors for a `Shape`.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h5 id="definingstrokes">Defining a Stroke</h5>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>The `stroke` attribute has four properties.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>color</dt><dd>The color of the stroke.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>weight</dt><dd>Number that indicates the width of the stroke.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>opacity</dt><dd>Number between 0 and 1 that indicates the opacity of the stroke. The default value is 1.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>dashstyle</dt>Indicates whether to draw a dashed stroke. When set to "none", a solid stroke is drawn. When set to an array, the first index indicates the
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp length of the dash. The second index indicates the length of gap.
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>The code below would set a 2 pixel solid red stroke on `myshape`.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp color: "#ff0000",
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>The `dashstyle` property can be used to create a dashed stroke on a shape.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp color: "#ff0000",
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp dashstyle: [3, 2]
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h5 id="definingfills">Defining a Fill</h5>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>The `fill` attribute has the following properties.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>color</dt><dd>The color of the fill.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>opacity</dt><dd>Number between 0 and 1 that indicates the opacity of the fill. The default value is 1.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>type</dt><dd>Type of fill.
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>solid</dt><dd>Solid single color fill. (default)</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>linear</dt><dd>Linear gradient fill.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>radial</dt><dd>Radial gradient fill.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<p>If a `linear` or `radial` is specified as the fill type. The following additional property is used:
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>stops</dt><dd>An array of objects containing the following properties:
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>color</dt><dd>The color of the stop.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>opacity</dt><dd>Number between 0 and 1 that indicates the opacity of the stop. The default value is 1. Note: No effect for IE <= 8</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>offset</dt><dd>Number between 0 and 1 indicating where the color stop is positioned.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <p>Linear gradients also have the following property:</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>rotation</dt><dd>Linear gradients flow left to right by default. The rotation property allows you to change the flow by rotation. (e.g. A rotation of 180 would make the gradient pain from right to left.)</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <p>Radial gradients have the following additional properties:</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>cx</dt><dd>The x-coordinate of the center of the gradient circle.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>cy</dt><dd>The y-coordinate of the center of the gradient circle.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>r</dt><dd>Radius of the gradient circle.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>fx</dt><dd>Focal point x-coordinate of the gradient.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <dt>fy</dt><dd>Focal point y-coordinate of the gradient.</dd>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<h2 id="issues">Known Issues</h2>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp<ul class="spaced">
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <p>Radial gradients need to be finalized. The current implementation can only be approximated to work in vml. Need to ensure normalizations are not adversely affecting other technologies.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <p>Linear gradient rotations need some minor bug fixes.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <p>The Canvas implementation of the path element lacks the ability to have interactivity.</p>
5e878519d1a8afcc3b0c5d9aa68d4751ed294c86Tripp <p>`Graphic` should extend `Base`. It currently does not.</p>