c# - 如何实现管道?
问题描述
该模块的想法是能够以图形方式表示管道内的数据。
例如,数据可能如下所示:
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
推荐阅读
- javascript - 小时、分钟、秒分隔显示为下划线而不是冒号
- azure - Azure 文件共享的生命周期管理
- mongodb - Azure Cosmos DB MongoDB API 4.0 事务功能不适用于“spring-boot-starter-data-mongodb”
- angular - Angular 12 Schematics 引发有关所需属性的错误
- javascript - ReactJS 使用表单获取外部图像作为输入
- flutter - 向其他类发送数据在颤振飞镖中为空
- python - 使用 Selenium 将鼠标悬停在元素上
- reactjs - 删除由其他用户创建的 Firestore 文档
- python-3.x - Pandas:减去两个不匹配的数据帧
- c# - UWP - NavigationViewItem - 切换页面