自动间隔精度MS图表 [英] Auto-Interval precision in MS Chart

查看:253
本文介绍了自动间隔精度MS图表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是目前使用.NET中的制图 System.Windows.Forms.DataVisualization.Charting.Chart 。到目前为止似乎很强大,而且伟大工程。然而,在它是如何自动计算时间间隔方面一个巨大的问题。我用了很多像ZedGraph库双击价值观,以及它完美地处理这个。它选择最小/最大/时间就好了。然而,在MS图表,它可能选择206.3334539832作为最低,和一个类似的小数精度的间隔。显然,这看起来相当难看。

I'm currently using the charting within .NET using System.Windows.Forms.DataVisualization.Charting.Chart. Thus far it seems very powerful, and works great. However, there is a huge problem in terms of how it is auto-calculating intervals. I use a lot of double values, and in libraries like ZedGraph, it handles this perfectly. It selects min/max/interval just fine. However, in MS Chart, it may select 206.3334539832 as a minimum, and intervals of a similar decimal precision. Obviously this looks quite ugly.

所以,我想简单地使轴格式 {0.00} 和它的伟大工程当它加载的图表。除非你放大,你需要更高的精度,也许在小数点后4位,而不是2.看来我要么只能和9位小数所有的时间,要不然一个恒定的固定号码,当有人要求更高的精确度,可能会破裂。我宁愿它捡起基于当前应用的缩放级别的精度。像ZedGraph和登打士(我相信MS甚至使用!)图书馆倾向于选择你放大和缩小的变化良好的价值观。

So, I tried simply making the axis format {0.00} and it works great when it loads the chart. Except when you zoom in, you need greater precision, maybe at 4 decimal places instead of 2. It seems I'm either stuck with 9 decimal places all the time, or else a constant fixed number that may break when someone requires greater precision. I'd rather it pick up the precision based on the level of zoom currently applied. Libraries like ZedGraph and Dundas (which I believe MS is even using!) tend to pick good values that change as you zoom in and out.

有什么办法有间隔变化的精度,缩放框的变化?这也可能是一些简单的属性我设置错了,但很难说与数百万这个东西(特别是当有大约14位表示区间的概念)的属性。

Is there any way to have the intervals change precision as the zoom frame changes? It's probably some simple property I have set wrong, but it's hard to tell with the millions of properties this thing has (especially when there's about 14 places that represent the concept of Interval).

推荐答案

我缩放时有完全相同的问题。我添加了代码格式化轴标签,从油漆处理程序中调用它。轴视图对象有一个IsZoomed财产和拥有的功能,以获得当前轴限制(GetViewMinimum /最大)。我设置了轴LabelStyle.Format为N为所有的情况下,除非最大最小范围=小于1,那么我将其中#是基于轴范围计算的格式为F#。

I had the exact same problem when zooming. I added code to format the axis labels and call it from the Paint handler. The Axis View objects have an IsZoomed property and have functions to get the current axis limits (GetViewMinimum/Maximum). I set the Axis LabelStyle.Format to "N" for all cases unless the Max-Min=range is less than 1. Then I set the format to "F#" where # is calculated based on the axis range.

# = Convert.ToInt32(Math.Abs(Math.Log10(range) - .5)) + 1;

这篇关于自动间隔精度MS图表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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