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
345
Axis labels not displaying when adding datapoints in code behind
posted

Hi,

I am adding datapoints manually to a chart series and the data displays fine except there are no labels on the X or Y axis.

What am I doing wrong?

Thanks.

 

 

    'Get the data
        Dim data As Report1BList = Report1BList.GetReport1BList(StartDate)

        'Remove series on chart
        With Me.myChart2D
            .Series.Clear()
        End With

        'For each sector, add the points as a series.
        For i As Integer = 0 To data.Count - 1
            Dim series As New Infragistics.Windows.Chart.Series
            With series
                .DataPoints.Add(data(i).Q1)
                .DataPoints(.DataPoints.Count - 1).Label = data(i).Q1Title

                .DataPoints.Add(data(i).Q2)
                .DataPoints(.DataPoints.Count - 1).Label = data(i).Q2Title

                .DataPoints.Add(data(i).Q3)
                .DataPoints(.DataPoints.Count - 1).Label = data(i).Q3Title

                .DataPoints.Add(data(i).Q4)
                .DataPoints(.DataPoints.Count - 1).Label = data(i).Q4Title

                .DataPoints.Add(data(i).Q5)
                .DataPoints(.DataPoints.Count - 1).Label = data(i).Q5Title

                .DataPoints.Add(data(i).Q6)
                .DataPoints(.DataPoints.Count - 1).Label = data(i).Q6Title

                .DataPoints.Add(data(i).Q7)
                .DataPoints(.DataPoints.Count - 1).Label = data(i).Q7Title

                'Now add this line
                Me.myChart2D.Series.Add(series)

                With Me.myChart2D.Series(myChart2D.Series.Count - 1)
                    .Label = data(i).Sector
                    .ChartType = Infragistics.Windows.Chart.ChartType.Line
                    .StrokeThickness = "4"
                    .Fill = GetNextBrushColour(i)
                End With

            End With
        Next




<!-- Chart control -->
        <igCA:XamChart x:Name="myChart2D" Style="{StaticResource XamChartStyle}">
            <igCA:XamChart.Caption>
                <igCA:Caption Text="Spread of Work at Phase 4 Development">
                </igCA:Caption>
            </igCA:XamChart.Caption>
            <!-- Legend -->
            <igCA:XamChart.Legend>
                <igCA:Legend/>
            </igCA:XamChart.Legend>
            <!-- Scene -->
            <igCA:XamChart.Scene>
                <igCA:Scene BorderBrush="Black">
                    <igCA:Scene.GridArea>
                        <igCA:GridArea Style="{StaticResource GridAreaStyle}"/>
                    </igCA:Scene.GridArea>
                </igCA:Scene>
            </igCA:XamChart.Scene>
           
            <!-- Axes -->
            <igCA:XamChart.Axes>
                <!--
                <igCA:Axis
          AxisType="PrimaryX"
          Animation="{StaticResource AxisAnimation}"
          MajorGridline="{StaticResource AnimationMarkX}"
          Label="{StaticResource AnimationLabelsX}"/>
                -->
                <igCA:Axis AxisType="PrimaryX" Animation="{StaticResource AxisAnimation}" MajorGridline="{StaticResource AnimationMarkX}">
                    <igCA:Axis.Label>
                        <igCA:Label Format="{}{0}" Style="{StaticResource AnimationLabelsStyle}"/>
                    </igCA:Axis.Label>
                </igCA:Axis>
                <igCA:Axis
          AxisType="PrimaryY"
          Animation="{StaticResource AxisAnimation}"
          MajorGridline="{StaticResource AnimationMarkY}"
          Label="{StaticResource AnimationLabelsY}">
                    <igCA:Axis.Stripes>
                        <igCA:Stripe Style="{StaticResource StripeStyle}"/>
                    </igCA:Axis.Stripes>
                </igCA:Axis>
            </igCA:XamChart.Axes>
        </igCA:XamChart>

Parents
No Data
Reply
  • 345
    Suggested Answer
    posted

    Seems to be a problem when I host the chart in one User control which is sitting on a page with another user control in a split / docked window layout. 

    Note: I also get the xamGrid displaying its values incorrectly - bits of the text are missing - this seems to be because the bit of the grid that gets drawn is hidden i.e. in the off screen scrollable part of the grid.

    The answer

    I put the chart onto the one user control hosted in a contentpane with tab item 1 showing the grid data and tab item 2 showing the chart.  The same code displayed the chart correctly and my axis labels appear.

    Not sure why, but I'll work around it for now.

    Richard.

Children
No Data