Class
zebkit.draw.FunctionRender
extends <zebkit.draw.Render> |
<zebkit.draw> |
Function render. The render draws a chart for the specified function within the given interval.
zebkit.draw.FunctionRender
(fn, x1, x2, [granularity], [color]
)
Parameters:
-
fn
<Function>a function to be rendered
-
x1
<Number>a minimal value of rendered function interval
-
x2
<Number>a maximal value of rendered function interval
-
[granularity]
<Integer>a granularity
-
[color]
<String>a chart color
Example:
zebkit.require("ui", "draw", function(ui, draw) {
var root = new ui.zCanvas(400, 300).root;
// paint sin(x) function as a background of root component
root.setBackground(new draw.FunctionRender(function(x) {
return Math.sin(x);
}, -3, 3));
});
Inherited methods:
getBottom( )
getLeft( )
getPreferredSize( )
getRight( )
getTop( )
getValue( )
paint(g, x, y, w, h, c)
setValue(o)
public
void
setGranularity (g )
Set the given granularity. Granularity defines how smooth the rendered chart should be. Parameters:
|
public
![]() granularity
Granularity defines how many points the given interval have to be split. |
public
<Integer>
lineWidth
Chart line width. |
public
<Boolean>
stretch
Indicates if the function chart has to be stretched vertically to occupy the whole vertical space |