2015-09-04 65 views
-3

你好,我有一個問題,用WPF中的Sparrow Toolkit生成一個簡單的圖表。這是我的XAMLWPF Sparrow圖表

<Window x:Class="GeneratorWPF.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:sparrow="http://sparrowtoolkit.codeplex.com/wpf" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="Generator" Height="500" Width="1000" Loaded="button1_Click"> 
<Grid> 
    <TextBox Height="23" HorizontalAlignment="Left" Margin="79,12,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" /> 
    <Label Content="Wariancja" Height="28" HorizontalAlignment="Left" Margin="12,12,0,0" Name="label1" VerticalAlignment="Top" /> 
    <Label Content="Średnia" Height="28" HorizontalAlignment="Left" Margin="12,46,0,0" Name="label2" VerticalAlignment="Top" /> 
    <Label Content="Przedział" Height="28" HorizontalAlignment="Left" Margin="12,80,0,0" Name="label3" VerticalAlignment="Top" /> 
    <TextBox Height="23" HorizontalAlignment="Left" Margin="79,46,0,0" Name="textBox2" VerticalAlignment="Top" Width="120" /> 
    <TextBox Height="23" HorizontalAlignment="Left" Margin="79,85,0,0" Name="textBox3" VerticalAlignment="Top" Width="120" /> 
    <Button Content="Generuj" Height="23" HorizontalAlignment="Left" Margin="380,13,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" /> 
    <sparrow:SparrowChart Theme="Grayscale" OverlayMode="SeriesFirst" Width="800" Height="300" VerticalAlignment="Bottom" Name="chart"> 
     <sparrow:SparrowChart.Legend> 
      <sparrow:Legend Header="Legend" LegendPosition="Outside" HorizontalAlignment="Right" VerticalAlignment="Top" ShowIcon="True"></sparrow:Legend> 
     </sparrow:SparrowChart.Legend> 
     <sparrow:SparrowChart.XAxis> 
      <sparrow:LinearXAxis MinValue="0" MaxValue="10" MajorTicksPosition="Cross"></sparrow:LinearXAxis> 
     </sparrow:SparrowChart.XAxis> 
     <sparrow:SparrowChart.YAxis> 
      <sparrow:LinearYAxis MinValue="0" MaxValue="10" MajorTicksPosition="Cross"></sparrow:LinearYAxis> 
     </sparrow:SparrowChart.YAxis> 
    </sparrow:SparrowChart> 
</Grid> 

而且的.cs

private void button1_Click(object sender, RoutedEventArgs e) 
{ 
    //float wariancja = 0; 
    //float srednia = 0; 
    //int przedzial = 0; 
    textBox1.Text = "asdasd"; 
    chart.Series["as"]; 

    var point = new Sparrow.Chart.ChartPoint(); 
    var asss = new Sparrow.Chart.AreaSeries() 
    { 
     Points = new Point() 
     { 
      X = 1, 
      Y = 4 
     }, 
    }; 
    var serie = new SeriesBase(); 
    chart.Series.Add(); 
} 

我試圖創建對象,但沒有任何事情工作。有人能幫我嗎?我可以只用cs來生成圖表嗎?我需要使用綁定?我開始與WPF和真的不知道太多

回答

2
  1. 分配pointasssserie但你永遠不使用它們。
  2. chart.Series["as"];沒有效果。
  3. chart.Series.Add();看起來不對,應該是chart.Series.Add(point);
+1

我說我需要幫助:) – Sidron