如何绘制在WPF中显示x轴和y轴值的图形,该图形应在画布中显示 [英] How to plot a graph which displays x axis and y axis values in WPF which should display with in canvas

查看:374
本文介绍了如何绘制在WPF中显示x轴和y轴值的图形,该图形应在画布中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何绘制以wpf显示x轴和y轴值的图表,该值应在画布中显示





我尝试了什么:



如何绘制图表在wpf中显示x轴和y轴值,它们应该在画布中显示

解决方案

*每个可以添加到XAML的WPF元素,是一个可以在C#中实例化的类,并将其添加到容器中(在您的情况下为Canvas)。因此,您可以使用此链接作为参考形状如何 - 到主题| Microsoft Docs [ ^ ]然后编写C#代码以生成所需的元素并将它们添加到画布。



*画布参考点与大多数其他图形表面一样,(0,0)位于左上角。如果您想在左下角放置参考点,就像许多其他图表一样,您可以在内部进行数学运算,也可以使用WPF转换来进行修正。我可能错了,但我想如果你在Y轴上应用-1比例变换,你可以镜像你的画布。



[我爱基督徒格劳斯的评论BTW! :d]

how to plot a graph which displays x axis and y axis values in wpf which should display with in canvas



What I have tried:

how to plot a graph which displays x axis and y axis values in wpf which should display with in canvas

解决方案

* Every WPF element that you can add to your XAML, is a class that you can instantiate in C# and add it to a container (in your case the Canvas). So, you can use this link as a reference Shapes How-to Topics | Microsoft Docs[^] and then write C# code to generate the elements you want and add them to the canvas.

* Canvas reference point (0,0), like most other graphical surfaces, is at top left. If you want to have your reference point on bottom left, like many other charts, you can either do the math internally or use WPF transformations to do the corrections. I might be wrong, but I guess if you apply a Scale Transform of -1 over Y axis, you can mirror your canvas.

[I love Christian Graus's comment BTW! :D]


这篇关于如何绘制在WPF中显示x轴和y轴值的图形,该图形应在画布中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆