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

Chart XY alignment issue

1 Answer 70 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Satish
Top achievements
Rank 1
Satish asked on 14 May 2012, 02:23 PM
Hello Telerik,

Am having some pretty intresting issues in radchart development.            
Please find my below code. below code is pulling the results on to the chart. but those are not aligning at the appropriate position.

Please find the attached dataset and resulted screen.


Code which is pulling the radchart details:

Private

 

 

Sub ChartLoad1(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 r As New Random()

 

 

 

Dim rowcount As Int32= 0

 

 

 

Dim dt As DataTable = 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("COUNT"))

 

sc.CapacityDelay =

 

Convert.ToInt32(dr("CapacityDelay"))

 

list.Add(sc)

 

 

Next

 

 

 

Dim series As New ChartSeries()

 

series.Type =

 

ChartSeriesType.Bar

 

series.DataXColumn =

 

"CapacityDelay"

 

series.DataYColumn =

 

"COUNT"

 

 

radchartcontrole.Clear()

radchartcontrole.Series.Add(series)

radchartcontrole.DataSource = list

radchartcontrole.DataBind()

 

radchartcontrole.PlotArea.XAxis.AutoScale =

 

False

 

radchartcontrole.PlotArea.XAxis.IsZeroBased =

 

False

 

radchartcontrole.Series(0).Appearance.BarWidthPercent =

 

CType("10", Decimal)

 

 

radchartcontrole.Series(0).DataYColumn = series.DataXColumn

radchartcontrole.PlotArea.XAxis.DataLabelsColumn = series.DataYColumn

 

 

End Sub

 




Public

 

 

Class StressClass
 

 

 

Private _count As Integer
 

 

 

Public Property Count() As Integer
 

 

 

Get
 

 

 

Return _count
 

 

 

End Get
 

 

 

Set(ByVal value As Integer)
 

_count = value

 

 

End Set
 

 

 

End Property
 

 

 

 

Private _capacityDelay As Integer
 

 

 

Public Property CapacityDelay() As Integer
 

 

 

Get
 

 

 

Return _capacityDelay
 

 

 

End Get
 

 

 

Set(ByVal value As Integer)
 

_capacityDelay = value

 

 

End Set
 

 

 

End Property
 

 

End

 

 

Class
 





ASPX code:


<

 

 

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

 

 

Skin="WebBlue" Width="935px">
 

 

 

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

 

 

<Appearance>
 

 

 

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

 

 

</FillStyle>
 

 

 

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

 

 

</Appearance>
 

 

 

<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">
 

 

 

</ItemTextAppearance>
 

 

 

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

 

 

</FillStyle>
 

 

 

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

 

 

</Appearance>
 

 

 

</Legend>
 

 

 

<PlotArea>
 

 

 

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

 

 

<Appearance Color="160, 160, 160">
 

 

 

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

 

 

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

 

 

<TextAppearance AutoTextWrap="False" />
 

 

 

</Appearance>
 

 

 

<AxisLabel>
 

 

 

<TextBlock>
 

 

 

<Appearance TextProperties-Color="140, 140, 140">
 

 

 

</Appearance>
 

 

 

</TextBlock>
 

 

 

</AxisLabel>
 

 

 

</YAxis>
 

 

 

<EmptySeriesMessage Visible="True">
 

 

 

<Appearance Visible="True">
 

 

 

</Appearance>
 

 

 

</EmptySeriesMessage>
 

 

 

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

 

 

<Appearance Color="160, 160, 160">
 

 

 

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

 

 

<TextAppearance AutoTextWrap="True" TextProperties-Color="140, 140, 140" />
 

 

 

</Appearance>
 

 

 

<AxisLabel>
 

 

 

<TextBlock>
 

 

 

<Appearance TextProperties-Color="140, 140, 140">
 

 

 

</Appearance>
 

 

 

</TextBlock>
 

 

 

</AxisLabel>
 

 

 

</XAxis>
 

 

 

<Appearance Dimensions-Margins="18%, 24%, 12%, 10%">
 

 

 

<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, 14pt">
 

 

 

</Appearance>
 

 

 

</TextBlock>
 

 

 

</ChartTitle>
 

 

 

</telerik:RadChart>




Thank You,

1 Answer, 1 is accepted

Sort by
0
Accepted
Petar Marchev
Telerik team
answered on 15 May 2012, 12:54 PM
Hi Satish,

I have created a project based on the code that you provided. I had to add some code in order to compile and run it. 

After some investigation I have found several errors in your code such as:
series.DataYColumn = "COUNT" 'wrong

You are passing a list of objects to the source of the chart, but these objects do not have a COUNT property, they have a Count property.
 
series.DataYColumn = "Count" 'correct

I have attached a project based on your code, in which I have removed all unnecessary code and the series mappings accordingly. You can examine it and try to adapt  the code to your project. If you need further assistance I will ask that you provide us with a project that we can run, that demonstrates the issues that you have, so that we can test it and look for solutions.

All the best,
Petar Marchev
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.
Tags
Chart (Obsolete)
Asked by
Satish
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Share this question
or