RadChart Label as Y axis - SQL Datasource

Thread is closed for posting
3 posts, 0 answers
  1. William
    William avatar
    9 posts
    Member since:
    Dec 2012

    Posted 07 Feb 2013 Link to this post

    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. William
    William avatar
    9 posts
    Member since:
    Dec 2012

    Posted 07 Feb 2013 Link to this post

    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>
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 12 Feb 2013 Link to this post

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