Radchart Empty Series

Thread is closed for posting
5 posts, 0 answers
  1. GK
    GK avatar
    11 posts
    Member since:
    Jun 2010

    Posted 01 Aug 2011 Link to this post

    Hi Telerik Team,

    I am new to RadCharts, I want to set my radchart visible =false, when there are no records in it or when the radchart shows "

    There is no or empty series

    ". 
     
    waiting for your early reply.

    Thanks
    Gopi Krishna

  2. Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 04 Aug 2011 Link to this post

    Hello Gk,

    You could use an if statement like this:
    if (radChart.Series.Count == 0)
    {
        radChart.Visible = false;
    }
    As you are new to RadChart, you could find a lot of useful information in our help topics here or check out our demo examples here, as well.

    Kind regards,
    Peshito
    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. GK
    GK avatar
    11 posts
    Member since:
    Jun 2010

    Posted 04 Aug 2011 Link to this post

    Hi Peshito,

    Thanks for your reply, But I am sorry to say, I have tried this earlier, in page_load, I am getting count=1 even if there are no records in it, I am having a couple of charts in my page, so i want to eliminate the charts if they won't have any records in it. 
    Below is the aspx code which I am using for chart.

    <telerik:RadChart ID="rct_XYZ" DataSourceID="sds_SummaryCard"
                    DefaultType="Bar" Width="500px" AutoLayout="true" runat="server">
                    <ChartTitle Appearance-FillStyle-MainColor="#220000" TextBlock-Text="....XYZ"
                        TextBlock-Appearance-TextProperties-Color="#FFBB22" />
                    <Appearance FillStyle-MainColor="#220000" />
                    <Legend Visible="false" />
                    <Series>
                        <telerik:ChartSeries DataYColumn="Percentage" DefaultLabelValue="#Y%" Appearance-TextAppearance-TextProperties-Color="#FFBB22">
                        </telerik:ChartSeries>
                    </Series>
                    <PlotArea>
                        <YAxis Appearance-CustomFormat="0.00\%" Appearance-TextAppearance-TextProperties-Color="#FFBB22" />
                        <XAxis AxisLabel-Visible="true" AxisLabel-TextBlock-Text="XYZ" DataLabelsColumn="XYZ"
                            AxisLabel-TextBlock-Appearance-TextProperties-Color="#FFBB22" Appearance-TextAppearance-TextProperties-Color="#FFBB22" />
                    </PlotArea>
                </telerik:RadChart>

    waiting for your early reply,

    Many Thanks
    Gopi Krishna
  5. Peshito
    Admin
    Peshito avatar
    497 posts

    Posted 09 Aug 2011 Link to this post

    Hello Gk,

    The reason why your count is equal to 1 is because your series is defined in the markup. This way you will always have a default series included in the RadChart1.Series.Count.

    What you should do is to define the series in code behind and follow the same approach.

    Kind regards,
    Peshito
    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.

  6. GK
    GK avatar
    11 posts
    Member since:
    Jun 2010

    Posted 12 Aug 2011 Link to this post

    Hi Peshito,
     
    Thanks for your reply,
    I could made a workaround for this, but I was expecting something like Gridview.rows.count > 0 logic, same for RadCharts.

    Rather changing my code. I am checking for data in the SQLDataSoure which i am binding to RadChart, and then making visible false if there exists no data. 

    DataView dv4 = (DataView)sds_SummaryCard.Select(DataSourceSelectArguments.Empty);
               if (dv4.Table.Rows.Count == 0)
                   rct_XYZ.Visible = false;
     

    Thanks
    Gopi Krishna
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017