Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WPF麻雀图_C#_Wpf - Fatal编程技术网

C# WPF麻雀图

C# WPF麻雀图,c#,wpf,C#,Wpf,您好,我在WPF中使用Sparrow工具箱生成简单图表时遇到问题。这是我的XAML <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.micros

您好,我在WPF中使用Sparrow工具箱生成简单图表时遇到问题。这是我的XAML

<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生成图表吗?我需要用bind吗?我是从WPF开始的,对它不太了解

  • 您分配了
    助理
    系列
    ,但从未使用它们
  • chart.Series[“as”]无效
  • chart.Series.Add()看起来不对,应该是
    chart.Series.Add(point)

  • 我说我需要帮助:)
    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();
    }