Jump to content
Software FX Community

sample crosstab, error: FieldUsage.RowHeading is required


co_lcruz@axtel.com.mx

Recommended Posts

Hi everyone, 

I try to do the example "sample crosstab" without success, i get the error "FieldUsage.RowHeading is required", it's my code:

code behind: 

      Dim myArray As New ArrayList

        myArray.Add(New MyCrossTabData(1004, New DateTime(2006, 1, 1), 10))

        myArray.Add(New MyCrossTabData(1004, New DateTime(2006, 1, 2), 20))

        myArray.Add(New MyCrossTabData(1004, New DateTime(2006, 1, 3), 70))

        myArray.Add(New MyCrossTabData(1004, New DateTime(2006, 1, 4), 80))

        myArray.Add(New MyCrossTabData(1005, New DateTime(2006, 1, 1), 30))

        myArray.Add(New MyCrossTabData(1005, New DateTime(2006, 1, 2), 60))

        myArray.Add(New MyCrossTabData(1005, New DateTime(2006, 1, 3), 45))

        myArray.Add(New MyCrossTabData(1005, New DateTime(2006, 1, 4), 75))

        myArray.Add(New MyCrossTabData(1005, New DateTime(2006, 1, 5), 30))

        Dim crossTab As New ChartFX.WebForms.DataProviders.CrosstabDataProvider(New ListProvider(myArray))

        crossTab.RowHeadingSettings = RowHeadingSettings.CompressedXValues

        Chart1.DataSourceSettings.Fields.Add(New FieldMap("Series", FieldUsage.ColumnHeading))

        Chart1.DataSourceSettings.Fields.Add(New FieldMap("Date", FieldUsage.RowHeading))

        Chart1.DataSourceSettings.Fields.Add(New FieldMap("Value", FieldUsage.Value))

        Chart1.DataSource = crossTab // this throw error: "FieldUsage.RowHeading is required"

my class:

    Public Class MyCrossTabData

        Private m_series As Integer

        Private m_date As DateTime

        Private m_value As Double

        Public Sub New(ByVal series As Integer, ByVal fecha As DateTime, ByVal value As Double)

            m_series = series

            m_date = fecha

            m_value = value

        End Sub

        Property Value() As Double

            Get

                Return m_value

            End Get

            Set(ByVal Value As Double)

                m_value = Value

            End Set

        End Property

        Property Series() As Integer

            Get

                Return m_series

            End Get

            Set(ByVal value As Integer)

                m_series = value

            End Set

        End Property

        Property DateTime() As DateTime

            Get

                Return m_date

            End Get

            Set(ByVal value As DateTime)

                m_date = value

            End Set

        End Property

    End Class

 

in the front aspx:

<chartfx7:Chart ID="Chart1" runat="server" Height="350px" Width="430px" 

                        RandomData-Points="0" 

                        RandomData-Series="0" BackColor="#FFFFFF" Palette="Mesa.Mesa" 

                        PlotAreaColor="255, 255, 255" >

                        <SpecialObjects>

                            <chartfxadornments:ImageBorder AssemblyName="ChartFX.WebForms.Adornments" 

                                Color="255, 255, 255" Type="Embed" />

                            <chartfxadornments:SolidBackground AssemblyName="ChartFX.WebForms.Adornments" />

                            <chartfx7galleries:Bar />

                            <chartfx7data:CrosstabDataProvider AssemblyName="ChartFX.WebForms.Data" />                            

                        </SpecialObjects>

                    </chartfx7:Chart> 

 

 Any advice, will be appreciated, tks

peace,  

Link to comment
Share on other sites

The FieldMap has to have the field name as the first parameter. This is what it should look like (you have it as "Date"):

Chart1.DataSourceSettings.Fields.Add(

New FieldMap("DateTime", FieldUsage.RowHeading))

But I would actually discourage you from naming one of the properties of your class as DateTime, since it is the same name as the type. MyDateTime maybe?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...