MSChart 注释大小

发布于 2024-11-02 19:51:23 字数 206 浏览 4 评论 0原文

我有一个带注释的 MSChart,图表区域很大,因此使用老式 800x600 的人可以看到图表。

问题是,当我在如此低的分辨率下查看图表时,其中的注释会随着图表一起缩小,并开始剪掉最后几个字母。

例如,在正常分辨率下带有“Hello world”的注释在 800x600 下变为“Hello W”。

有人知道我如何设置注释属性,这样它们就不会缩小吗?

I have an MSChart with annotations, the charting area is sizable so that people using the old school 800x600 can see the chart.

Problem is, when I view my chart under this low resolution, the annotations within it shrink with the chart and begins to cut off the last couple of letters.

For example an annotation with "Hello world" in normal resoultion becomes "Hello W" under the 800x600.

Anyone know how I could set the annotaiton properties so they dont shrink?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

只是在用心讲痛 2024-11-09 19:51:23

我遇到了同样的问题,而且我一直无法找到使注释固定大小的方法。我确实发现注释尺寸设置为图表的百分比(即调整大小的原因是 Width = 25 实际上意味着图表宽度的 25%),所以我写了一些 hack每当图表大小调整时调整注释大小:

var annotation = new RectangleAnnotation() { ... }

chart.Annotations.Add(annotation);

chart.Resize += (sndr, ev) => {
    // Shoot for 60 pixels tall and 130 wide
    // Annotation dimensions are set as a percentage of the chart area
    annotation.Width =  (130d / chart.Width) * 100;
    annotation.Height = (60d / chart.Height) * 100;
};

这有点难看,但它对我有用。

I had the same problem, and I haven't been able to find a way to make the annotation fixed size. I did figure out that the annotation dimensions are set as a percentage of the chart (i.e. the reason it's resizing is that Width = 25 actually means 25% of the chart width), so I wrote a little hack to resize the annotation whenever the chart resizes:

var annotation = new RectangleAnnotation() { ... }

chart.Annotations.Add(annotation);

chart.Resize += (sndr, ev) => {
    // Shoot for 60 pixels tall and 130 wide
    // Annotation dimensions are set as a percentage of the chart area
    annotation.Width =  (130d / chart.Width) * 100;
    annotation.Height = (60d / chart.Height) * 100;
};

This is kind of ugly, but it works for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文