如何实现管道



这个模块的想法是能够以图形方式表示管道内的数据。
例如,数据可能如下所示:

1,4

这将是一个function y=f(x),其中:

4=f(1)

我需要使用这一行

TODO: WritePointToHTML(rawData);

这样做的基本思想是生成HTML文件,其中包含将绘制所需行的代码。

我尝试使用 html 画一条线,但我无法理解如何在管道中表示它

  var canvas = document.getElementById('Canvas');
  var context = canvas.getContext('2d');

我假设原始海报希望绘制线条,而不是使用 c# 管道。

var can;
var ctx;
function init(){
  can=document.getElementById("Canvas");
  ctx=can.getContext("2d");
  ctx.canvas.width  = window.innerWidth;
  ctx.canvas.height = window.innerHeight;
  DrawSlope(1,20);
}
function DrawSlope(x,y)
{
   var firstPoint = [x,0];
   var secondPoint = [1,x+y];
WritePointToHTML(firstPoint[0],firstPoint[1],secondPoint[0],secondPoint[1]);
}
function WritePointToHTML(x,y,xTwo,yTwo)
{
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineTo(xTwo, yTwo);
ctx.stroke();
}
在坡度

公式中增加了"绘制坡度"。https://codepen.io/hollyeplyler/pen/gqYyZx

最新更新