Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
CategoryDateTimeXAxis with multiple line series
posted

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

  • 235
    posted

    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

                                                                  ItemsSource="{Binding}"

                                                                  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

            Get

                Return m_Value1

            End Get

            Set(value As Double)

                m_Value1 = value

            End Set

        End Property

        Private m_Value1 As Double

    End Class

    Thanks,

    John