Hi. Can I get a VB example of using a CategoryDateTimeXAxis using the same x and y axis for multiple line series? Does the value used by the DateTimeMemberPath need to be a date or a string format? I will typically be using this on an hourly interval (if not more granular) and I need it to populate all the values on the x axis even if no value exist so I know that I need this instead of a CategoryXAxis. I seem to be missing something in the binding I'm doing right now. The y axis range seem right but nothing is graphing. Thanks for you help in advance!
John
Here is my code:
<ig:XamDataChart x:Name="fcMainChart" Height="300" Margin="2,50,2,2">
<ig:XamDataChart.Axes>
<ig:CategoryDateTimeXAxis
x:Name="MainXAxis"
ItemsSource="{Binding}"
DateTimeMemberPath="Date1"
Label="{}{Date}">
<ig:CategoryDateTimeXAxis.LabelSettings >
<ig:AxisLabelSettings Location="OutsideBottom" Extent="25" />
</ig:CategoryDateTimeXAxis.LabelSettings>
</ig:CategoryDateTimeXAxis>
<ig:NumericYAxis x:Name="MainYAxis">
<ig:NumericYAxis.LabelSettings>
<ig:AxisLabelSettings Extent="25" />
</ig:NumericYAxis.LabelSettings>
</ig:NumericYAxis>
</ig:XamDataChart.Axes>
<ig:XamDataChart.Series>
<ig:LineSeries
MarkerType="None"
XAxis="{Binding ElementName=MainXAxis}"
YAxis="{Binding ElementName=MainYAxis}"/>
</ig:XamDataChart.Series>
</ig:XamDataChart>
mMainWindow.fcMainChart.Series.Clear()
For Each item As NostDataGraphItems.GraphItem In NostDataGraphItems.GraphItemsList
Dim data = From row In mTemplateData.Rows.OfType(Of DataRow)() Select New DateDataItem() With {.Date1 = CDate(row("DATEFIELD")), .Value1 = CDbl(row(item.MappingField))}
Dim lSeries As New LineSeries
mMainWindow.MainXAxis.DateTimeMemberPath = "Date1"
lSeries.XAxis = mMainWindow.MainXAxis
lSeries.YAxis = mMainWindow.MainYAxis
lSeries.Title = item.MappingField
lSeries.ItemsSource = data 'ds.Tables(0)
lSeries.ValueMemberPath = "Value1"
mMainWindow.fcMainChart.Series.Add(lSeries)
Next
Public Class DateDataItem
Public Property Date1() As Date
Get
Return m_Date1
End Get
Set(value As Date)
m_Date1 = value
End Set
End Property
Private m_Date1 As Date
Public Property Value1() As Double
Return m_Value1
Set(value As Double)
m_Value1 = value
Private m_Value1 As Double
End Class
Thanks,
I resolved this issue on my own. I was missing the databinding to the x-Axis:
mMainWindow.MainXAxis.DataContext = data
This is no longer an issue.
Hello John,
Thank you for your reply. I am very glad that you have managed to solve the issue that you were having. Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support