Class zebkit.draw.FunctionRender
extends <zebkit.draw.Render>

Function render. The render draws a chart for the specified function within the given interval.

zebkit.draw.FunctionRender (fn, x1, x2, [granularity], [color])

  • 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

 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));

public void setGranularity (g)

Set the given granularity. Granularity defines how smooth the rendered chart should be.

  • g <Integer>

    a granularity

public void setRange (x1, x2)

Set the specified interval - minimal and maximal function argument values.


Inherited attributes:
public Object target   

public <String> color

Function chart color.

public <Integer> 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