0

I want to visualize some data in my Windows Phone app. So I'm using the charting control from this namespace: System.Windows.Controls.DataVisualization.Toolkit. And everything is working fine, but I want to display another value on the x axis then numbers.

This is the XAML code for the charting control:

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

And this is in the code behind file (GlucoseItem is an item in an database, which allows to save date, time, value and a simple note):

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;

But now I want to show the date on the x axis and not a number. How can I fix the problem. And I have another problem with this charting control: it shows a blue line arount the charting control, but I cannot hide it.

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 に答える