new DVisual(canvasName)
The Main Class of DVisual
Parameters:
Name | Type | Description |
---|---|---|
canvasName |
string | the canvas's id you want to paint |
- Source:
Example
new DVisual(canvas_id);
Methods
addElement(ele)
add the element to the main class
Parameters:
Name | Type | Description |
---|---|---|
ele |
DVElement | DVElement can be any DVisual Graph Class,contain a draw() fucntion to draw itself on canvas. |
- Source:
draw()
draw all graph on the canvas
- Source:
getClickDot() → {Objects}
return
- Source:
Returns:
clickDot - return the clicked dot data
- Type
- Objects
initial(X, Y)
intialize the zoom and margin of X and Y
Parameters:
Name | Type | Description |
---|---|---|
X |
Array(double) | the data'X |
Y |
Array(double) | the data'Y |
- Source:
initialZ(Z)
initialize the Z data degree for zoom
Parameters:
Name | Type | Description |
---|---|---|
Z |
Array(double) | the Z degree data,should contain the maxium and minum. |
- Source:
setClickDot(color)
set the clickDot to true,you can click the canvas to add a dot on the canvas
Parameters:
Name | Type | Description |
---|---|---|
color |
DVColor | the color of the dot you want |
- Source:
setinc(Xinc, Yinc)
set the base value of X and Y
Parameters:
Name | Type | Description |
---|---|---|
Xinc |
double | the base increment value of X |
Yinc |
double | the base increment value of Y |
- Source:
setmargin(Xmargin, Ymargin)
set the margin of data space,set the zoom value of x and y;
Parameters:
Name | Type | Description |
---|---|---|
Xmargin |
double | the margin of X in data space |
Ymargin |
double | the margin of Y in data space |
- Source:
setMouseMove()
set the mouseMove to true,you can get the coordinate when you move the mouse on the canvas
- Source:
transXY(x, y) → {Array(double)}
translate the x and y coordinate from real canvas space to data space
Parameters:
Name | Type | Description |
---|---|---|
x |
double | x value in real canvas space |
y |
double | y value in real canvas space |
- Source:
Returns:
[resultX,resultY] - the real coordinate value of (x,y)
- Type
- Array(double)
xLenTrans(len) → {double}
translate the x length from data space to real canvas space
Parameters:
Name | Type | Description |
---|---|---|
len |
double | the length in data space |
- Source:
Returns:
length - the length in real canvas space
- Type
- double
xyTrans(x, y) → {Array(double)}
translate the x and y coordinate from data space to real canvas space
Parameters:
Name | Type | Description |
---|---|---|
x |
double | x value in data space |
y |
double | y value in data space |
- Source:
Returns:
[resultX,resultY] - the real coordinate value of (x,y)
- Type
- Array(double)
yLenTrans(len) → {double}
translate the y length from data space to real canvas space
Parameters:
Name | Type | Description |
---|---|---|
len |
double | the length in data space |
- Source:
Returns:
length - the length in real canvas space
- Type
- double
zLenTrans(len) → {double}
translate the z length from data space to real canvas space
Parameters:
Name | Type | Description |
---|---|---|
len |
double | the length in data space |
- Source:
Returns:
length - the length in real canvas space
- Type
- double