XY Chart Display Issue due to Huge number of x-Axis Points with varyied database input

Thread is closed for posting
2 posts, 1 answers
  1. Satish
    Satish avatar
    10 posts
    Member since:
    Apr 2012

    Posted 18 May 2012 Link to this post

    First of all, I would like to appreciate Telerik Team for supporting our critical requirement development.

      OK Coming to point.

    I have to display some XY axis radchart to the user.
    X-Axis values varies between -400 and +400 Or -1 and +1 (depends on data coming this X-axis value might varies)
    Y-Axis values varies between 1 and +1000 (depends on data coming this X-axis value might varies)

    Once user click on btnGetChartResult then I would like to show overview of the chart as attached (chart view issue due to number of x-axis scale points.png), In this chart let assume I have X-axis points from -400 to +400 (critical scenario)

    If the User wants to see each and every X-axis point with their Y-axis aligned data, Then I would like to give a Zoom in option to see, Then the screen should looks like as attached(chart view issue due to number of x-axis scale points1.png).

    Issue we are having with below code, If the user click on btnGetChartResult then the results are as attached(Chart display for on one 1Xaxis point.png).

    Issue 1.If the chart has only 1 x-axis for whole chart, its showing zoomed view with scroll option.
    Issue 2.Even If the chart has the points between -400 and +400, firstly I would like to show the chart without zoom, if the user wants, he can zoom-in the chart.
    Issue 3.Even If am working with below code, sometimes it is showing various behavior in showing the data on chart, to get perfect results some times we are refreshing the chart by clicking on btnGetChartResult,

    Please let me know, Where am making mistakes.
    Your Help is greatly appreciated!

    Thank You Very Much Telerik Team.


    <telerik:RadPageView ID="rpvCapacityTimeliness" runat="server">
                                <div style="padding: 5px; text-align: left;">
                                    <asp:UpdatePanel ID="updCapacityTimeliness" runat="server" RenderMode="Inline" UpdateMode="Conditional">
                                                <telerik:RadChart AutoLayout="True" Height="450px" ID="CapacityRadChart" runat="server" Skin="WebBlue" Width="935px">
                                                    <ClientSettings EnableZoom="True" ScrollMode="Both" XScale="10" />
                                                        <FillStyle MainColor="249, 250, 251">
                                                        <Border Color="160, 170, 182" />
                                                    <Legend Visible="False">
                                                        <Appearance Dimensions-Margins="17.6%, 3%, 1px, 1px" Dimensions-Paddings="2px, 8px, 6px, 3px"
                                                            Position-AlignedPosition="TopRight" Visible="False">
                                                            <ItemTextAppearance TextProperties-Color="102, 102, 102">
                                                            <FillStyle MainColor="216, 222, 227">
                                                            <Border Color="160, 170, 182" />
                                                        <YAxis AutoScale="True" AxisMode="Extended">
                                                            <Appearance Color="160, 160, 160">
                                                                <MajorGridLines Color="227, 227, 227" />
                                                                <MinorGridLines Color="227, 227, 227" />
                                                                <TextAppearance AutoTextWrap="False" />
                                                                    <Appearance TextProperties-Color="140, 140, 140">
                                                        <EmptySeriesMessage Visible="True">
                                                            <Appearance Visible="True">
                                                        <XAxis AutoScale="True" >
                                                            <Appearance Color="160, 160, 160">
                                                                <MajorGridLines Color="227, 227, 227" Width="0" />
                                                                <TextAppearance AutoTextWrap="True" TextProperties-Color="140, 140, 140" />
                                                                    <Appearance TextProperties-Color="140, 140, 140">
                                                        <Appearance Dimensions-Margins="18%, 24%, 12%, 10%">
                                                            <FillStyle FillType="Solid" MainColor="">
                                                            <FillStyle MainColor="">
                                                        <TextBlock Text="Capacity Timeliness">
                                                            <Appearance TextProperties-Color="102, 102, 102" TextProperties-Font="Arial, 14pt">


    Private Sub ChartLoad(ByRef ds As DataSet, 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 dt As DataTable = New DataTable()
                dt = ds.Tables.Item(0)

        If Not ds.Tables(0).Rows.Count > 0 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


                dt = ds.Tables.Item(0)

                Dim list As New List(Of StressClass)

                For Each dr As DataRow In dt.Rows
                    Dim sc As New StressClass()
                    sc.Count = Convert.ToInt32(dr(dataYColumnName))
                    sc.CapacityTimeliness = Convert.ToInt32(dr(dataXColumnName))

                Dim series As New ChartSeries()
                series.Type = ChartSeriesType.Bar
                series.DataXColumn = dataXColumnName
                series.DataYColumn = dataYColumnName


                radchartcontrole.DataSource = list

                radchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Text = xaxislableName
                radchartcontrole.PlotArea.XAxis.AxisLabel.Visible = True
                radchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red
                radchartcontrole.PlotArea.XAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True

                radchartcontrole.PlotArea.YAxis.AxisLabel.Visible = True
                radchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Text = yaxislableName
                radchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Red
                radchartcontrole.PlotArea.YAxis.AxisLabel.TextBlock.Appearance.Position.Auto = True

                radchartcontrole.Series(0).Appearance.BarWidthPercent = CType("10", Decimal)
                Dim metricsAvg As String
                metricsAvg = CType(ds.Tables(avgTableValue).Rows(0).Item(avgDataColumn), String)
                radchartcontrole.ChartTitle.TextBlock.Visible = False
                radchartcontrole.Legend.Visible = false

                'Metrics Avg label display
                lblAvgDisplay.Text = timeLinesAvgLabel + metricsAvg + "days"
                lblAvgDisplay.Visible = true
                lblAvgDisplay.Font.Bold = True
                lblAvgDisplay.ForeColor = System.Drawing.Color.Red

                'Binding the monthly chart data
                monthlyradchartcontrole.DataSource = ds.Tables.Item(monthlytableValue)
                monthlyradchartcontrole.Series(0).DataXColumn = monthlyYaxisDataColumn
                monthlyradchartcontrole.Series(0).DataYColumn = monthlyXaxisDataColumn

                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

                monthlyradchartcontrole.Legend.Visible = false

        End If

        End Sub

    Public Class StressClass
            Private _count As Integer
            Public Property Count() As Integer
                    Return _count
                End Get

                Set(ByVal value As Integer)
                    _count = value
                End Set
            End Property

            Private _capacityTimeliness As Integer
            Public Property CapacityTimeliness() As Integer
                    Return _capacityTimeliness
                End Get
                Set(ByVal value As Integer)
                    _capacityTimeliness = value
                End Set
            End Property
        End Class
  2. Answer
    Ves avatar
    2914 posts

    Posted 22 May 2012 Link to this post

    Hi Staish,

    Onto your questions:
    1) - RadChart supports only a single X axis, so I am not sure about this condition in the question. Still, looking at the code I can see RadChart.ClientSettings.XScale = 10 -- this defines the chart as being 10x zoomed along X axis and it would be expected to display scrollbars for controlling this.
    2) - Same as above -- you can remove the XScale setting, so the chart will appear initially with no zoom.
    3) - I am not sure I followed this one. Your code does not include the button in question, so I am not aware of the action taken and what data is sent to RadChart. Can you provide more details about the various behaviors you see, as well as the specific configuration and the expected result. Thank you.

    Best regards,
    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.
Back to Top