Database Reference
In-Depth Information
How it works...
The magic in this recipe is in the call to incanter.charts/dynamic-xy-plot .
This deines the domain of the chart, the range of the parameters, and the function.
Let's look at a few lines from it in more detail:
(let [x (range -1 1 0.1)]
This deines the domain of the chart, that is, the extent of the x-axis:
(c/dynamic-xy-plot
This is the macro call that creates the chart. The parameters passed to this deine the
parameters and the function for the chart:
[a (range -1.0 1.0 0.1)
b (range -1.0 1.0 0.1)
c (range -1.0 1.0 0.1)]
The irst parameter to dynamic-xy-plot deines the function parameters for the chart.
This deines three variables that range from -1 to 1 , incremented by 0.1 :
[x (i/plus (i/mult a x x) (i/mult b x) c)]))
This deines the function. It speciies the quadratic equation in terms of the range of the
x-axis, and using the current values of the parameters from the sliders. The dynamic plot
shows the output of this equation and those parameters on the chart.
 
Search WWH ::




Custom Search