0

我想在我的 Windows Phone 应用程序中可视化一些数据。所以我使用了来自这个命名空间的图表控件:System.Windows.Controls.DataVisualization.Toolkit。一切正常,但我想在 x 轴上显示另一个值,然后是数字。

这是图表控件的 XAML 代码:

<charting:Chart x:Name="gluChart">
  <charting:Chart.LegendStyle>
    <Style TargetType="datavis:Legend">
      <Setter Property="Width" Value="0"/>
      <Setter Property="Height" Value="0"/>
    </Style>
  </charting:Chart.LegendStyle>
  <charting:AreaSeries Name="gluLineChart" ItemsSource="{Binding}" IndependentValuePath="X"  dependentValuePath="Y" BorderThickness="0"/>
</charting:Chart>

这是在文件后面的代码中(GlucoseItem 是数据库中的一个项目,它允许保存日期、时间、值和一个简单的注释):

List<Point> points = new List<Point>();
int i = 1;
foreach (GlucoseItem gi in App.GluViewModel.AllGlucoseItems)
{
  points.Add(new Point(i, Convert.ToDouble(gi.GlucoseValue)));
  i++;
}
this.gluChart.DataContext = points;

但现在我想在 x 轴上显示日期而不是数字。我该如何解决这个问题。这个图表控件还有另一个问题:它在图表控件周围显示了一条蓝线,但我无法隐藏它。

4

1 回答 1

0

这篇博文描述了如何在 DateTimeAxis 上格式化日期。

http://www.diaryofaninja.com/blog/2011/01/10/two-little-tips-for-working-with-silverlight-chart-datetime-axes

于 2012-05-21T15:59:40.160 回答