我看到在LightningChart中有3个WPF API可用。可绑定/半绑定和不可绑定。他们到底有什么区别?
如何将数据点的集合绑定成线状图?
发布于 2016-07-07 18:56:04
- **Semi-bindable chart API**: DependencyProperties, ObservableCollections in lists. Data input is array-based and must be done in code-behind. So you can bind UI settings and chart objects, but just feed the data in code. Very good performance.
- **Non-bindable chart API**: No DependencyProperties, no ObservableCollections in any lists or data inputs. Regular properties and usage in code-behind. Best performance and multithreading features. Over billion points can be monitored in real-time monitoring as our [demo application](http://arction.com/billion_data_points_visualization) shows.
使用Bindable图表API,您可以配置图表并像这样绑定
<Window x:Class="BindingExamplePointLineSeries.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lcub="http://schemas.arction.com/bindablecharting/ultimate/"
x:Name="thisTest"
Title="MainWindow" Height="350" Width="525">
<Grid>
<lcub:LightningChartUltimate>
<lcub:LightningChartUltimate.ViewXY>
<lcub:ViewXY>
<lcub:ViewXY.YAxes>
<lcub:AxisY/>
</lcub:ViewXY.YAxes>
<lcub:ViewXY.XAxes>
<lcub:AxisX/>
</lcub:ViewXY.XAxes>
<lcub:ViewXY.PointLineSeries>
<lcub:PointLineSeries Points="{Binding ElementName=thisTest, Path = Points}" PointsVisible="True"/>
</lcub:ViewXY.PointLineSeries>
</lcub:ViewXY>
</lcub:LightningChartUltimate.ViewXY>
</lcub:LightningChartUltimate>
</Grid>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
Random rand = new Random();
SeriesPointCollection points0 = new SeriesPointCollection();
for (int i = 0; i < 10; i++)
{
SeriesPoint p = new SeriesPoint();
p.X = i;
p.Y = rand.NextDouble() * 10.0;
points0.Add(p);
}
Points = points0;
}
public static readonly DependencyProperty PointsProperty =
DependencyProperty.Register(
"Points",
typeof(SeriesPointCollection),
typeof(MainWindow)
);
public SeriesPointCollection Points
{
get { return GetValue(PointsProperty) as SeriesPointCollection; }
set { SetValue(PointsProperty, value as Object); }
}
}然后得到数据绑定的图表:

https://stackoverflow.com/questions/38217015
复制相似问题