2015-09-04 107 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