Silverlight 和 C# 中的日期时间数据问题
我正在 Silverlight 和 C# 中使用 VISI Fire 来生成一些数据图表。一种样式的图表允许将堆叠数据显示在列中,我正在使用的 xaml 代码如下所示:
我试图构建的图表是基于以visi火图为例。如果您访问 http://www.visifire.com/silverlight_wpf_charts_gauges_gallery.php 并查看他们在这里堆积的例子http://www.visifire.com/silverlight_stacked_charts_gallery.php 你可以看到我正在尝试的xaml示例效仿。
但我的图表结果有所不同。我的有这个奇怪的重叠日期功能
现在,我已经仔细地执行了代码,据我所知,每个数据集对都有相同的日期。
我已逐步执行此代码,并确保对于 i 的每个值,每个数据对的年份和月份都完全相同。那么为什么我的图表如此混乱?
我使用 DateTime 类的方式有问题吗?
new DateTime((Int32) Year_Id,(Int32) SMonth_Id, (Int32)1);
I am using VISI Fire in Silverlight and C# to produce some data charts. One style of chart allows stacked data to be displayed in colums the xaml code I am using looks like this:
The chart i am trying to build is based on a visi fire chart example. if you go to http://www.visifire.com/silverlight_wpf_charts_gauges_gallery.php and look at their stacked examples here http://www.visifire.com/silverlight_stacked_charts_gallery.php you can see the xaml example I am trying to emulate.
But my chart comes out differently. mine has this odd overlaping date feature
Now, I have carefully stepped through the code and as far as I can tell, I have the same date for each data set pair.
I have stepped through this code and I have made sure that with each value for i, the years and the months for each data pair are exactly the same. So why is my graph so messed up?
Is there something wrong with they way I am using the DateTime class?
new DateTime((Int32) Year_Id,(Int32) SMonth_Id, (Int32)1);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
第一个解决方案:
将两个 DataSeries 中的 AxisXLabel 属性而不是 XValue 设置为字符串。不要在 DataSeries 或 x 轴中设置 XValueType。也不要在 x 轴上设置 Interval 属性。
示例:
第二个解决方案:
无需对当前代码进行任何更改。继续按当前设置设置 XValue。您只需在 XAML 中的 x 轴中设置两个属性 IntervalType="Month" 和 Interval="1" 即可。
1st Solution:
Set AxisXLabel property instead of XValue in both DataSeries as String. Do not set XValueType in DataSeries or in x-axis. Also do not set Interval property in x-axis.
Example:
2nd Solution:
No need to do any changes in your current code. Continue setting XValue as you are setting currently. You just need to set two properties IntervalType="Month" and Interval="1" in x-axis in XAML.
Somnath 的第二个解决方案有效。
我不确定第一个。我记得我曾经尝试过,但没有取得好的结果。对于堆叠图表来说,它有问题。
我终于让它工作了。我必须向 xaml 添加一些规范。
这是修复方法:
2nd solution from Somnath works.
I am not sure about the 1st. I remember it was tried and I did not have good results. For a stacked chart, it had issues.
I got it working finally. I had to add some specification to the xaml.
Here is the fix: