平滑 Zedgraph 线图,无“凹凸”;
当您使用 Zedgraph 作为折线图并将 IsSmooth 设置为 true 时,线条会很好地弯曲,而不是具有硬角/角度。
虽然这对于大多数图表来说看起来要好得多 - 以我的拙见 - 但有一个小问题。 平滑算法使线条在向上或向下之前稍微“下潜”或“起伏”。
在大多数情况下,如果数据点本身是平滑的,这不是问题,但如果您的数据点从 0 到 15,“下潜”会使线位于 x 轴下方,这使得看起来好像有一些数据点低于零(事实并非如此)。
我怎样才能解决这个问题(最好很容易;)
When you use Zedgraph for linegraphs and set IsSmooth to true, the lines are nicely curved instead of having hard corners/angles.
While this looks much better for most graphs -in my humble opinion- there is a small catch. The smoothing algorithm makes the line take a little 'dive' or 'bump' before going upwards or downwards.
In most cases, if the datapoint are themselves smooth, this isn't a problem, but if your datapoints go from say 0 to 15, the 'dive' makes the line go under the x-axis, which makes it seems as though there are some datapoints below zero (which is not the case).
How can I fix this (prefably easily ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对此没有简单的答案。 保持张力接近零将是最简单的解决方案。
ZedGraph使用GDI的DrawCurve张力参数来应用平滑度,这可能是Hermite Interpolation。 您可以尝试实现自己的余弦插值,由于其性质,它将保留局部极值。 您可以查看此链接以了解原因:
http://local.wasp.uwa.edu.au/~pbourke /miscellaneous/interpolation/
编辑:网站已关闭。 这是该页面的缓存版本:
http: //web.archive.org/web/20090920093601/http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/
No simple answer for this. Keeping the tension near zero will be your simplest solution.
ZedGraph uses GDI's DrawCurve tension parameter to apply smoothness, which is probably Hermite Interpolation. You can try to implement your own Cosine Interpolation, which will keep local extremes because of its nature. You can look at the this link to see why:
http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/
EDIT: Website is down. Here is a cached version of the page:
http://web.archive.org/web/20090920093601/http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/interpolation/
您可以尝试向上或向下更改 myCurve.Line.SmoothTension 属性,看看是否有帮助。
You could try to alter the myCurve.Line.SmoothTension property up or down and see if that helps.