I have a collection of objects that contain everything that I need to create a series and I want to use a DataTemplate to create series for however many objects are in the collection. Unfortunately, it seems that there are no DataTemplate examples in any of your explanations and I don't know if this is even possible.
Is it possible to create a number of series at runtime using DataTempates?
Hello Ed,
The link you provided is a step by step guidance for WindowsForms UltraChart. I have used a similar approach with DataTabel bound to WPF’s XamDataChart to create a sample project for you with the same functionality.
Hope this helps you.
Is there a way to bind a Series of the XamDataChart to a Column in a DataTable like you did in this how to article ? This would work well for my needs, but it seems like you have used a different kind of chart for this example.
I can't modify my data in this way because it is dynamically generated and I have no idea of what data will arrive. I will continue to look at alternative solutions.
I have been looking into your Data model and I can say that our DataChart is not designed to work with that kind if data. Both X and Y values should be Proeprties of one class. If you modifiy your data that way it will be easy to display it using our chart.
Thank you for the working link. Unfortunately, there aren't any examples of how I can use the SeriesCollection to bind my data to a Chart.
Let me describe my data structure to you and see if you can help me graph the data within it. I have a collection of objects that have collections with the data to be visualized. The object is called CustomData as shown below.
public CodeBehind : INotifyPropertChanged
{
private ObservableCollection<CustomData> masterData = new ObservableCollection<CustomData>();
public CodeBehind()
CustomData dat1 = new CustomData();
dat1.Header = "Thermo1";
dat1.Data.Add(11.053);
dat1.Data.Add(12.41);
dat1.Data.Add(14.38);
dat1.Data.Add(15.89);
CustomData dat2 = new CustomData();
dat2.Header = "Thermo2";
dat2.Data.Add(17.09);
dat2.Data.Add(12.41);
dat2.Data.Add(13.038);
dat2.Data.Add(19.879);
MasterData.Add(dat1);
MasterData.Add(dat2);
}
public ObservableCollection<CustomData> MasterData
get
{ return masterData;}
public class CustomData
private string header; private List<double> data = new List<double>();
public string Header
{ get
{return header;}
public List<double> Data
{return data;}
Now my XAML, reduced for brevity:
<ig:XamDataChart Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Name="Chart" DataContext="{Binding MasterData}"> <ig:XamDataChart.Axes> <ig:NumericXAxis Name="xAxis" Visibility="Visible" > <ig:NumericXAxis.LabelSettings > <ig:AxisLabelSettings Location="OutsideBottom" Extent="20" /> </ig:NumericXAxis.LabelSettings> </ig:NumericXAxis> <ig:NumericYAxis Name="y1Axis" Visibility="Visible"> <ig:NumericYAxis.LabelSettings > <ig:AxisLabelSettings Location="OutsideLeft" Extent="20" /> </ig:NumericYAxis.LabelSettings> </ig:NumericYAxis> <ig:NumericYAxis Name="y2Axis" Visibility="Visible"> <ig:NumericYAxis.LabelSettings > <ig:AxisLabelSettings Location="OutsideRight" Extent="20" /> </ig:NumericYAxis.LabelSettings> </ig:NumericYAxis> </ig:XamDataChart.Axes> <ig:XamDataChart.Series> <ig:ScatterLineSeries Thickness="5" ItemsSource="{Binding}" XAxis="{Binding ElementName=xAxis}" YAxis="{Binding ElementName=y1Axis}" XMemberPath="MasterCollection[0].Data" YMemberPath="MasterCollection[1].Data"/> </ig:XamDataChart.Series> </ig:XamDataChart>
I was using a tool from another vendor which had no trouble working out the path for the IEnumerable element in the collection to graph the data. However, I really would like to standardize on just using Infragistic's tools as I am already using your XamDataGrid tool. Is it possible you can help?