x
 
<!DOCTYPE html>
<html>
<script src="/lib/graphics/plotly.js"></script>
<body>
<div id="myPlot" style="width:100%;max-width:700px"></div>
<script>
var exp = "Math.sin(x)";
// 生成值
var xValues = [];
var yValues = [];
for (var x = 0; x <= 10; x += 0.1) {
  xValues.push(x);
  yValues.push(eval(exp));
}
// 使用 Plotly 来显示
var data = [{x:xValues, y:yValues, mode:"lines"}];
var layout = {title: "y = " + exp};
Plotly.newPlot("myPlot", data, layout);
</script>
</body>
</html>