How to set axis margin in WinRT XAML Toolkit line chart?

与世无争的帅哥 提交于 2020-01-11 14:26:08

问题


Answer

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);

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
                                                  };


回答1:


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.



来源:https://stackoverflow.com/questions/17566488/how-to-set-axis-margin-in-winrt-xaml-toolkit-line-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!