Not able to pull the –ve values on to X-Axis

Thread is closed for posting
3 posts, 1 answers
  1. Pawar
    Pawar avatar
    15 posts
    Member since:
    Apr 2012

    Posted 12 Apr 2012 Link to this post

    Not able to pull the –ve values on to X-Axis: MY RESULTS ARE LIKE AS in image Not able to pull the –ve values on to X-Axis. PLEASE OBSERVE CAPACITY DELAY RESULTS HAS –VE VALUES ALSO, WHICH ARE GOING TO X-AXIS.

    WHEN AM TRYING TO DISPLAY THEM BY USING THE BELOW CODE,

    radchartcontrole.Series.Clear()

    radchartcontrole.DataSource = ds.Tables.Item(charttableValue)

    radchartcontrole.DataBind()

    radchartcontrole.Series(0).DataXColumn = “CapacityDelay

    radchartcontrole.Series(0).DataYColumn = “Count_InvestigationId

     

    Result is as in image Not able to pull the –ve values on to X-Axis1

     

    After zoom in, the results in Image  Not able to pull the –ve values on to X-Axis2

     

    PLEASE FIND THE BELOW CODE BEHIND METHOD, WHICH IS PLAYING MAIN ROLE FOR THIS DEVELOPMENT

    Private Sub ChartLoad(ByRef radchartcontrole As RadChart, ByRef monthlyradchartcontrole As RadChart, ByRef dataXColumnName As String, ByRef dataYColumnName As String, ByRef xaxislableName As String, ByRef yaxislableName As String, ByRef monthlyXaxislableName As String, ByRef monthlyYaxislableName As String, ByRef monthlyYaxisDataColumn As String, ByRef monthlyXaxisDataColumn As String, ByRef avgDataColumn As String, ByRef charttableValue As Int32, ByRef monthlytableValue As Int32, ByRef avgTableValue As Int32, ByRef chartTitle As String, ByRef updatePaneltoHide As UpdatePanel, ByRef timeLinesAvgLabel As String)

     

    Dim strErrorMessage As String = String.Empty

    Dim ds As New DataSet

    ds = CType(ViewState("ChartsDataset"), DataSet)

     

    'Checking if there is no data in dataset then dispalying the message as not data found otherwise loading the chart with data set results.

            If ds Is Nothing Then

                updatePaneltoHide.Visible = False

                lblAvgDisplay.Text = "No Data Found for the " + chartTitle

                lblAvgDisplay.ForeColor = System.Drawing.Color.Red

                lblAvgDisplay.Font.Bold = True

                lblAvgDisplay.Width = 300

     

            Else

     

               

                'Binding the Metrics delay chart data for the selected metrics

                radchartcontrole.Series.Clear()

                radchartcontrole.DataSource = ds.Tables.Item(charttableValue)

                radchartcontrole.DataBind()

                radchartcontrole.Series(0).DataXColumn = dataXColumnName

                radchartcontrole.Series(0).DataYColumn = dataYColumnName

     

                radchartcontrole.Series(0).Appearance.BarWidthPercent = CType("10", Decimal)

                'radchartcontrole.Series(0).Name = "Capacity Delay"

     

     

                'By default, If there any additional serieses adding to the chart, we are removing them

                If radchartcontrole.Series.Count > 0 Then

                    For i = 1 To radchartcontrole.Series.Count - 1

                        radchartcontrole.RemoveSeriesAt(i)

                    Next

                End If

     

                radchartcontrole.PlotArea.XAxis.AutoScale = True

                radchartcontrole.PlotArea.XAxis.AutoShrink = True

     

                radchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Text = xaxislableName

                radchartcontrole.PlotArea.XAxis.AxisLabel.Visible = True

                radchartcontrole.PlotArea.XAxis.AxisLabel.Appearance.Position.Auto = True

                radchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red

    radchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True

                'radchartcontrole.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = CType("45", Single)

     

    radchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Text = yaxislableName

    radchartcontrole.PlotArea.YAxis.AxisLabel.Visible = True

                radchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red

    radchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True

     

    Dim metricsAvg As String

    metricsAvg = CType(ds.Tables(avgTableValue).Rows(0).Item(avgDataColumn), String)

                radchartcontrole.ChartTitle.TextBlock.Visible = False

     

                'Metrics Avg label display

                lblAvgDisplay.Text = timeLinesAvgLabel + metricsAvg + "days"

                lblAvgDisplay.Font.Bold = True

                lblAvgDisplay.ForeColor = System.Drawing.Color.Red

     

                'Metrics titile and legend display based on the tab selected

                radchartcontrole.ChartTitle.TextBlock.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.TopRight

                radchartcontrole.ChartTitle.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red

                radchartcontrole.Legend.Appearance.Position.AlignedPosition = Telerik.Charting.Styles.AlignedPositions.Bottom

                radchartcontrole.PlotArea.Appearance.Dimensions.AutoSize = True

     

                'Binding the monthly chart data

                monthlyradchartcontrole.Clear()

                monthlyradchartcontrole.DataSource = ds.Tables.Item(monthlytableValue)

                monthlyradchartcontrole.DataBind()

                monthlyradchartcontrole.Series(0).DataXColumn = monthlyXaxisDataColumn

                monthlyradchartcontrole.Series(0).DataYColumn = monthlyYaxisDataColumn

     

                monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Text = monthlyXaxislableName

                monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.Visible = True

                monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red

                monthlyradchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True

     

                monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.Visible = True

                monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Text = monthlyYaxislableName

                monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red

                monthlyradchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True

     

    End If

     

     

     

     

     

     

    <telerik:RadChart AutoLayout="True" Height="450px" ID="CapacityRadChart"

                                                    runat="server" Skin="WebBlue" Width="950px">

                                                    <ClientSettings EnableZoom="True" ScrollMode="Both"/>

                                                    <Appearance>

                                                        <FillStyle MainColor="249, 250, 251">

                                                        </FillStyle>

                                                        <Border Color="160, 170, 182" />

                                                    </Appearance>

                                                    <Legend>

                                                        <Appearance Dimensions-Margins="1%, 1%, 1px, 1px"

                                                            Dimensions-Paddings="1px, 1px, 1px, 1px"

                                                            Position-AlignedPosition="Top">

                                                            <ItemTextAppearance TextProperties-Color="102, 102, 102">

                                                            </ItemTextAppearance>

                                                            <FillStyle MainColor="216, 222, 227">

                                                            </FillStyle>

                                                            <Border Color="160, 170, 182" />

                                                        </Appearance>

                                                    </Legend>

                                                    <PlotArea>

                                                            <YAxis AutoScale="True" AxisMode="Extended">

                                                                <Appearance>

                                                                    <MajorGridLines Color="227, 227, 227" />

                                                                    <MinorGridLines Color="227, 227, 227" />

                                                                    <TextAppearance AutoTextWrap="False"/>                        

                                                                </Appearance>                    

                                                                <AxisLabel>

                                                                    <TextBlock>

                                                                        <Appearance TextProperties-Color="140, 140, 140" Position-AlignedPosition="TopLeft">

                                                                        </Appearance>

                                                                    </TextBlock>

                                                                </AxisLabel>

                                                            </YAxis>    

                                                            <XAxis AutoScale="True" DataLabelsColumn="RIID's" MaxValue="0" Step="0">

                                                                <Appearance>

                                                                    <MajorGridLines Color="227, 227, 227" Width="0" />

                                                                    <TextAppearance AutoTextWrap="True" />

                                                                </Appearance>

                                                                <AxisLabel>

                                                                    <TextBlock>

                                                                        <Appearance TextProperties-Color="140, 140, 140" Position-AlignedPosition="BottomRight">

                                                                        </Appearance>

                                                                    </TextBlock>

                                                                </AxisLabel>

                                                            </XAxis>

                                                            <Appearance>

                                                                <FillStyle FillType="Solid" MainColor="">

                                                                </FillStyle>

                                                            </Appearance>

                                                    </PlotArea>                 

                                                    <ChartTitle>

                                                        <Appearance>

                                                            <FillStyle MainColor = "">

                                                            </FillStyle>

                                                        </Appearance>

                                                        <TextBlock Text="Capacity Timeliness" >

                                                            <Appearance TextProperties-Color="102, 102, 102"

                                                                TextProperties-Font="Arial, 7pt" Position-AlignedPosition="Bottom">

                                                            </Appearance>

                                                        </TextBlock>

                                                     </ChartTitle>

                                                </telerik:RadChart>

     



     

  2. Answer
    Ves
    Admin
    Ves avatar
    2879 posts

    Posted 17 Apr 2012 Link to this post

    Hi Pawar,

    You should configure the ChartSeries.DataXColumn and DataYColumn properties before databinding the chart as shown in this help topic

    Best regards,
    Ves
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pawar
    Pawar avatar
    15 posts
    Member since:
    Apr 2012

    Posted 17 Apr 2012 Link to this post

    Thank You for giving some relaxation from this issue.
     
    Mistake in my code is: 

    radchartcontrole.Series(0).DataXColumn = “Count_InvestigationId
    Changed to (It took 1month to find out this small change a line)

     

    radchartcontrole.PlotArea.XAxis.DataLabelsColumn = dataXColumnName

Back to Top