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

Radchart Empty Series

4 Answers 205 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
GK
Top achievements
Rank 1
GK asked on 01 Aug 2011, 03:22 PM
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

4 Answers, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 04 Aug 2011, 09:10 AM
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.

0
GK
Top achievements
Rank 1
answered on 04 Aug 2011, 10:43 AM
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
0
Peshito
Telerik team
answered on 09 Aug 2011, 01:22 PM
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.

0
GK
Top achievements
Rank 1
answered on 12 Aug 2011, 11:41 AM
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
Tags
Chart (Obsolete)
Asked by
GK
Top achievements
Rank 1
Answers by
Peshito
Telerik team
GK
Top achievements
Rank 1
Share this question
or