This is a migrated thread and some comments may be shown as answers.

Horizontal X Axis, reversed values

5 Answers 132 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 27 May 2011, 08:49 AM
Hi

I have a chart with horizonal x-axis, with the y axis displayed on top like so (see the attached image)

how can i reverse the xaxis values so it displays 1, 2, 3... 10 starting from top to bottom rather than bottom up?

Here is my code:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="RadChartMinMaxValue._Default" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
 
    </form>
        <telerik:RadChart ID="RadChart1" runat="server"
                Height="100px"
                Width="250px"
                ChartTitle-Visible="false"     
                Legend-Visible="false"
                SeriesOrientation="Horizontal" BorderWidth="0px" >
        </telerik:RadChart>
</body>
</html>

Imports System.Drawing
Imports Telerik.Charting
 
Partial Public Class _Default
    Inherits System.Web.UI.Page
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
        Dim lstGammaDetails As New List(Of GammaDetail)
 
        lstGammaDetails = GetGammaDetails()
 
        RadChart1.Series.Clear()
 
        'Chart appearance
        RadChart1.Height = Unit.Pixel(300)
        RadChart1.PlotArea.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid
        RadChart1.PlotArea.Appearance.FillStyle.MainColor = Color.White
        RadChart1.PlotArea.Appearance.Dimensions.Margins.Top = New Telerik.Charting.Styles.Unit(28)
        RadChart1.PlotArea.Appearance.Dimensions.Margins.Left = New Telerik.Charting.Styles.Unit(40)
        RadChart1.PlotArea.Appearance.Dimensions.Margins.Right = New Telerik.Charting.Styles.Unit(8)
        RadChart1.PlotArea.Appearance.Dimensions.Margins.Bottom = New Telerik.Charting.Styles.Unit(10)
        RadChart1.IntelligentLabelsEnabled = False
        RadChart1.PlotArea.XAxis.Visible = Styles.ChartAxisVisibility.True
 
        'X Axis
        'RadChart1.PlotArea.XAxis.DataLabelsColumn = "Depth"
        RadChart1.PlotArea.XAxis.AutoScale = False
        RadChart1.PlotArea.XAxis.LayoutMode = Styles.ChartAxisLayoutMode.Normal
 
        'Min and Max values
        RadChart1.PlotArea.XAxis.MinValue = 1
        RadChart1.PlotArea.XAxis.MaxValue = 10
        RadChart1.PlotArea.XAxis.Step = 1
 
        'RadChart1.PlotArea.XAxis.AddRange(1, 120, 1)
 
        'Y Axis2
        RadChart1.PlotArea.YAxis2.Appearance.MajorGridLines.Visible = True
        RadChart1.PlotArea.YAxis2.Appearance.MajorGridLines.Color = Color.Gray
        RadChart1.PlotArea.YAxis2.AxisLabel.TextBlock.Appearance.TextProperties.Color = Color.Black
        RadChart1.PlotArea.YAxis2.Appearance.TextAppearance.TextProperties.Color = Color.Black
 
        'Line series
        Dim chartSeries As New ChartSeries
        chartSeries.Appearance.LabelAppearance.Visible = False
        chartSeries.Name = "GAMMA"
        chartSeries.Type = ChartSeriesType.Line
        chartSeries.Appearance.LineSeriesAppearance.Color = System.Drawing.Color.LightBlue
        chartSeries.DataYColumn = "Value"
        chartSeries.YAxisType = ChartYAxisType.Secondary
 
        RadChart1.Series.Add(chartSeries)
        RadChart1.DataSource = lstGammaDetails
        RadChart1.DataBind()
 
    End Sub
 
    Private Function GetGammaDetails()
 
        Dim lstGD As New List(Of GammaDetail)
 
        Dim gd1 = New GammaDetail()
        gd1.Depth = 1
        gd1.Value = 100
        lstGD.Add(gd1)
 
        Dim gd2 = New GammaDetail()
        gd2.Depth = 2
        gd2.Value = 200
        lstGD.Add(gd2)
 
        Dim gd3 = New GammaDetail()
        gd3.Depth = 3
        gd3.Value = 200
        lstGD.Add(gd3)
 
        Dim gd4 = New GammaDetail()
        gd4.Depth = 4
        gd4.Value = 250
        lstGD.Add(gd4)
 
        Dim gd5 = New GammaDetail()
        gd5.Depth = 5
        gd5.Value = 50
        lstGD.Add(gd5)
 
        Dim gd6 = New GammaDetail()
        gd6.Depth = 6
        gd6.Value = 50
        lstGD.Add(gd6)
 
        Return lstGD
 
    End Function
 
 
End Class
 
 
Public Class GammaDetail
 
    Private _depth As Decimal
    Public Property Depth() As Decimal
        Get
            Return _depth
        End Get
        Set(ByVal value As Decimal)
            _depth = value
        End Set
    End Property
 
    Private _value As Decimal
    Public Property Value() As Decimal
        Get
            Return _value
        End Get
        Set(ByVal value As Decimal)
            _value = value
        End Set
    End Property
 
End Class


Cheers

Richard.

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 27 May 2011, 10:49 AM
Hello Richard,

I have found this forum which discussed the same.
Reverse x-axis (hight to low).

Thanks,
Princy.
0
Richard
Top achievements
Rank 1
answered on 28 May 2011, 04:43 AM
Hi,

yer ive read that post too, but unfortunately is didnt help much
0
Richard
Top achievements
Rank 1
answered on 30 May 2011, 01:53 AM
Does anyone have any suggestions or know of a way to do this? Its actually quite urgent for me to complete this asap.

Cheers in advanced.

Richard
0
Richard
Top achievements
Rank 1
answered on 07 Jun 2011, 01:57 AM
Anyone?...
0
Evgenia
Telerik team
answered on 09 Jun 2011, 09:40 AM
Hi Richard,

Take a look at this forum post where the Reverse YAxis was discussed.

Best wishes,
Evgenia
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Chart (Obsolete)
Asked by
Richard
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Richard
Top achievements
Rank 1
Evgenia
Telerik team
Share this question
or