Plotting numbers against a WPF graph?
I'm trying to plot a series of numbers against a graph.
A really simple use case scenario. Just grab a number plot it, after n seconds, grab the same variable, if it has changed plot it again, and so on and so forth.
I've downloaded the WPF Toolkit from CodePlex but I can't find any documentation for the GraphControl control, or even a method like, AddItem() or something like开发者_运维技巧 that.
Here's my XAML and C# code:
<GroupBox Header="Timechart" Foreground="White" FontFamily="Verdana" Height="211" HorizontalAlignment="Left" Margin="12,88,0,0" Name="groupBox1" VerticalAlignment="Top" Width="479">
<my:GraphControl HorizontalAlignment="Left" Margin="491,299,0,0" x:Name="graphControl1" VerticalAlignment="Top" />
</GroupBox>
private void button1_Click(object sender, RoutedEventArgs e)
{
SharpDream.Api.Concrete.XmlMemberFinder x = new XmlMemberFinder();
var user = x.FindMember(335389);
textBox1.Text = user.Reputation;
graphControl1.
}
Does anyone know to do this basic use case? Thanks for any guidance.
Here's a simple XAML-only chart to get you started:
<Grid>
<Grid.Resources>
<PointCollection x:Key="sampleData">
<Point X="1" Y="6"/>
<Point X="2" Y="4"/>
<Point X="3" Y="8"/>
</PointCollection>
</Grid.Resources>
<chartingToolkit:Chart Title="Chart Title">
<chartingToolkit:ColumnSeries Name="chart1" Title="Column Series" ItemsSource="{StaticResource sampleData}" IndependentValueBinding="{Binding X}" DependentValueBinding="{Binding Y}"/>
</chartingToolkit:Chart>
</Grid>
You can download samples of all the supported WPF chart types from this blog:
- WPF Charting: It's official! June 2009 release of the WPF Toolkit is now available!
Download the DataVisualizationDemos sample.
精彩评论