Class: DVLegend

DVLegend

new DVLegend(args)

A DVisual graph element indicate a Legend,an important structure of most chart
Parameters:
Name Type Description
args Array.<Object> a array contain arguments below
Properties
Name Type Attributes Default Description
classes Array(string) the classes's texts for the legend
colors Array(DVColor) <optional>
DVgetRandomColor(this.args.classes.length,0.7); the classes's colors for the legend
x double the x value of the Legend's start node(left bottom node)
y double the y value of the Legend's start node(left bottom node)
style string <optional>
'rect' the legend's note shape for each class,'rect','line' or 'bubble'
outerbox boolean <optional>
'true' whether draw the outerbox of legend
direction string <optional>
'vertical' the direction of legend,'vertical' means put all data in a column.'horizontal' means in a row
height double <optional>
!!according to the canvas!! the height limit of Legend
width double <optional>
!!according to the canvas!! the width limit of Legend
Source:
Example
new DVLegend({'xDescript':"time",'yDescript':"value",'xSpan':20,'ySpan'});

Methods

draw(dv)

draw the Coordinate on dv's canvas
Parameters:
Name Type Description
dv DVisual the Dvisual instance you want to draw
Source:

getHeightWidth(dv) → {Array}

get the legend's height and width according to the dvisual instance
Parameters:
Name Type Description
dv DVisual the Dvisual instance you want to draw
Source:
Returns:
result - [height,width]
Type
Array

prepare(dv)

prepare the needed elements on the first time to draw it
Parameters:
Name Type Description
dv DVisual the Dvisual instance you want to draw
Source: