Platform
Resources
Pricing
Sign in
Get started
lochiwei
One advantage of talking to yourself is that you know at least somebody’s listening.
Workspace
Fork
Published unlisted
By
lochiwei
Edited
May 10, 2021
Fork of
Math Plot
Insert cell
Insert cell
// my custom text input
viewof
expr
=
MyText
(
{
labelWidth
:
"50px"
,
submit
:
true
,
label
:
tex
`f(x)=`
,
value
:
"x*sin(x^2)"
}
)
Insert cell
Insert cell
Insert cell
// ⭐️ add a "labelWidth" option
MyText
=
(
{
labelWidth
=
"100px"
,
...
options
}
=
{
}
)
=>
{
let
input
=
Text
(
options
)
;
$
(
"label"
,
input
)
.
style
.
width
=
labelWidth
;
return
input
;
}
Insert cell
// ⭐️ function expression (text) -> funplot
plot
=
(
text
)
=>
{
let
f
=
math
.
compile
(
text
)
;
return
funplot
(
(
x
)
=>
f
.
evaluate
(
{
x
:
x
}
)
)
;
}
Insert cell
function
$
(
selector
,
parent
=
document
)
{
return
parent
.
querySelector
(
selector
)
;
}
Insert cell
// $all ⭐️
function
$all
(
selector
,
parent
=
document
)
{
return
parent
.
querySelectorAll
(
selector
)
;
}
Insert cell
Insert cell
Insert cell
Insert cell
// ⭐️ import math.js
math
=
require
(
"mathjs@9"
)
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
expr
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
MyText
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
plot
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
$
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
$all
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
math
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML