From 0a0325617534fab66b144da57b705154e696d435 Mon Sep 17 00:00:00 2001
From: Mauricio Poppe
+ +
+
import functionPlot from 'function-plot'
functionPlot({
- // ..options
+ // ..options below
})
@@ -124,18 +137,8 @@ - -
-var instance = functionPlot({
+change affects the way the functions are sampled
functionPlot({
target: '#logarithmic',
xAxis: {
type: 'log',
@@ -390,7 +390,7 @@
b.addLink(a, c)
c.addLink(a, b)
To update a graphic one needs to call functionPlot
on the same target
-element with any object that is configured properly
var options = {
+element with any object that is configured properly
const options = {
target: '#quadratic-update',
data: [
{
@@ -398,7 +398,7 @@
}
]
}
-$('#update').click(function () {
+document.querySelector('#update').addEventListener('click', function () {
if (!options.title) {
// add a title, a tip and change the function to y = x * x
options.title = 'hello world'
diff --git a/site/playground.html b/site/playground.html
index 67cdef02..a7d996cd 100644
--- a/site/playground.html
+++ b/site/playground.html
@@ -20,12 +20,10 @@
functionPlot.withWebWorkers(8)
functionPlot({
target: '#playground',
- width: window.innerWidth,
- height: window.innerHeight,
+ // width: window.innerWidth,
+ // height: window.innerHeight,
data: [
- { fn: 'x^2', nSamples: 5000, sampler: 'asyncInterval' },
- { fn: 'sin(x)', nSamples: 5000, sampler: 'asyncInterval' },
- { fn: '1/x', nSamples: 5000, sampler: 'asyncInterval' },
+ { fn: 'sin(exp(x))', nSamples: 5000, sampler: 'asyncInterval' },
]
})
Logarithmic scales
The type of each axis can be configured to be logarithmic by specifying the type of axis to
log
inside thexAxis
option, note how this -change affects the way the functions are sampled