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

RadChart Label as Y axis - SQL Datasource

2 Answers 85 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
William
Top achievements
Rank 1
William asked on 07 Feb 2013, 12:26 PM
Hi there
I am trying to add a Chart using wizard but I could not put the labels and values in the right order.
I want the names as Y axis and the total number of users as Labels written inside the bar
any help appreciated

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
            ConnectionString="<%$ ConnectionStrings:dev.EkonomiConnectionString %>" SelectCommand="SELECT  COUNT(I.Is_Kayit_Id) as Total, (K.Adi + ' ' + K.Soyadi) isim  FROM   Is_Kayitlari I  LEFT JOIN   Kullanicilar K ON    K.Kullanici_Id=I.Create_User  GROUP BY K.Adi, K.Soyadi ORDER BY    Total DESC"></asp:SqlDataSource>
 
        <telerik:RadChart ID="RadChart1" runat="server" DataSourceID="SqlDataSource1"
            SeriesOrientation="Horizontal" Width="800px">
            <Series>
<telerik:ChartSeries Name="Total" DataLabelsColumn="isim" DataYColumn="Total"></telerik:ChartSeries>
</Series>
            <PlotArea>
                <XAxis>
                    <AxisLabel>
                        <Appearance RotationAngle="270">
                        </Appearance>
                    </AxisLabel>
                </XAxis>
                <YAxis>
                    <AxisLabel>
                        <Appearance RotationAngle="0">
                        </Appearance>
                    </AxisLabel>
                </YAxis>
                <YAxis2>
                    <AxisLabel>
                        <Appearance RotationAngle="0">
                        </Appearance>
                    </AxisLabel>
                </YAxis2>
            </PlotArea>
        </telerik:RadChart>

2 Answers, 1 is accepted

Sort by
0
William
Top achievements
Rank 1
answered on 07 Feb 2013, 12:37 PM
I played a little bit more and got this now
But still I need to push the Bar area a bit more to right(align right) so that my names wont fall out of the table
And I want to show the Total numbers inside the bar
<telerik:RadChart ID="RadChart1" runat="server" DataSourceID="SqlDataSource1"
            SeriesOrientation="Horizontal" Width="1000px">
            <Series>
<telerik:ChartSeries Name="Total" DataYColumn="Total"></telerik:ChartSeries>
</Series>
            <PlotArea>
                <DataTable>
                    <Appearance Position-AlignedPosition="Center" RenderType="AutoSize">
                    </Appearance>
                </DataTable>
                <XAxis AutoScale="False" DataLabelsColumn="isim" MaxValue="7" MinValue="1"
                    Step="1">
                    <AxisLabel>
                        <Appearance RotationAngle="270">
                        </Appearance>
                    </AxisLabel>
                    <Items>
                        <telerik:ChartAxisItem Value="1">
                            <TextBlock Text="TuÄŸrul Tiryaki">
                            </TextBlock>
                        </telerik:ChartAxisItem>
                        <telerik:ChartAxisItem Value="2">
                            <TextBlock Text="Canan Çaylı">
                            </TextBlock>
                        </telerik:ChartAxisItem>
                        <telerik:ChartAxisItem Value="3">
                            <TextBlock Text="Seren Güngör">
                            </TextBlock>
                        </telerik:ChartAxisItem>
                        <telerik:ChartAxisItem Value="4">
                            <TextBlock Text="Fulya Åžafak">
                            </TextBlock>
                        </telerik:ChartAxisItem>
                        <telerik:ChartAxisItem Value="5">
                            <TextBlock Text="Duygu Görgülü">
                            </TextBlock>
                        </telerik:ChartAxisItem>
                        <telerik:ChartAxisItem Value="6">
                            <TextBlock Text="Murat Yamuklugil">
                            </TextBlock>
                        </telerik:ChartAxisItem>
                        <telerik:ChartAxisItem Value="7">
                            <TextBlock Text="Ertan Alkan">
                            </TextBlock>
                        </telerik:ChartAxisItem>
                    </Items>
                </XAxis>
                <YAxis>
                    <AxisLabel>
                        <Appearance RotationAngle="0">
                        </Appearance>
                    </AxisLabel>
                </YAxis>
                <YAxis2>
                    <AxisLabel>
                        <Appearance RotationAngle="0">
                        </Appearance>
                    </AxisLabel>
                </YAxis2>
            </PlotArea>
            <ChartTitle>
                <TextBlock Text="Names">
                </TextBlock>
            </ChartTitle>
        </telerik:RadChart>
0
Petar Kirov
Telerik team
answered on 12 Feb 2013, 12:41 PM
Hi William,

You can use the RadChart's AutoLayout feature to make the chart arrange its elements in a better way.

About the binding to SQL Datasource - you do not need to manually fill the XAxis.Items - when using XAxis.DataLabelsColumn the RadChart will do that for you.

I hope this helps.
 
All the best,
Petar Kirov
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
William
Top achievements
Rank 1
Answers by
William
Top achievements
Rank 1
Petar Kirov
Telerik team
Share this question
or