如何在 WinRT XAML Toolkit 折线图中设置轴边距? [英] How to set axis margin in WinRT XAML Toolkit line chart?

查看:35
本文介绍了如何在 WinRT XAML Toolkit 折线图中设置轴边距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

回答

最后我用这个解决了我的答案.

Finally I solved my answer with this.

((LineSeries)MyChart.Series[0]).IndependentAxis = new LinearAxis
                                                  {
                                                      Minimum = 1,
                                                      Maximum = 5,
                                                      Orientation = AxisOrientation.X,
                                                      Interval = 1,
                                                      Margin = new Thickness(10, 0, 10, 0)
                                                  };

((LineSeries)MyChart.Series[0]).Clip = null;
((LineSeries)MyChart.Series[0]).Margin = new Thickness(10, 0, 10, 0);

<小时>

我在 WinRT XAML Toolkit 的帮助下绘制折线图.我正在手动设置 X 轴,但是当我设置时,我开始变得奇怪终点.我试图设置边距和填充,但它不起作用.请您建议我该怎么做?


I am drawing line chart with help of WinRT XAML Toolkit. I am setting X axis manually, but when I set I am getting wierd start & end point. I tried to set margin and padding but it's not working. Will you please suggest me how can I do that ?

((LineSeries)MyChart.Series[0]).IndependentAxis = new LinearAxis
                                                  {
                                                      Minimum = 1,
                                                      Maximum = 5,
                                                      Orientation = AxisOrientation.X,
                                                      Interval = 1,
                                                      //Margin = .... Not working
                                                      //Padding = .... Not working
                                                  };

推荐答案

我会使用可视化树调试器从这些数据点向上遍历可视化树,以查看 Clip 属性的设置位置.事实上,我只是在示例项目上做到了这一点,它是在 LineSeries 上设置的.查看它是否设置为其 XAML 模板的一部分,或者是否在 C# 中完成并将其删除.您也可以更改 X 轴上的最小值/最大值以腾出更多空间.我会将清理这一切添加到我的 TODO 列表中.

I'd use a visual tree debugger to walk up the visual tree from these data points to see where the Clip property is set. In fact I just did that on the samples project and it is set on the LineSeries. See if it's set as part of its XAML template or if it is done in C# and remove it there. Also you could change the Minimum/Maximum values on your X axis to make more space. I'll add cleaning this all up to my TODO list.

这篇关于如何在 WinRT XAML Toolkit 折线图中设置轴边距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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