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

Charting - new to me - probably easy

3 Answers 47 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Chase Florell
Top achievements
Rank 1
Chase Florell asked on 11 Nov 2008, 12:50 AM
I am trying to get a very simple chart to show on my page, but since charting is so new to me, I don't know how to accomplish the simple stuff.

Here is my Stored Procedure
 
-- =============================================  
-- Author:              Chase  
-- Create date: 11/10/2008  
-- Update date: 11/10/2008  
-- Description: Get Admin Data  
-- =============================================  
ALTER PROCEDURE dbo.bt_BizBoth_AdminAdChart  
 
AS 
SET NOCOUNT ON 
SET ANSI_NULLS ON 
    /* SET NOCOUNT ON */  
 
 
Select   
 
    (Select Count([ID])   
        As TotalBizForSale   
        From bt_BizForSale   
    ) AS TotalForSale,   
      
      
    (Select Count([ID])   
        As TotalBizWanted   
        From bt_BizWanted   
    ) As TotalWanted  
 

And here is my page load
 
    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
        Dim BizBothDC As New DAL.BizBothDataContext  
        Dim results = BizBothDC.bt_BizBoth_AdminAdChart  
        RadChart1.DataBind()  
    End Sub 

My problem is that I don't know how to wire it up to my Chart... Basically the chart needs to be a PIE CHART with TOTAL BUSINESSES FOR SALE and TOTAL BUSINESSES WANTED

Note I do not want to use a DataSource in my ASPX.. I think they are just UGLY.

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Chase Florell
Top achievements
Rank 1
answered on 11 Nov 2008, 02:47 AM
I have gotten a little further... I have updated the Stored Procedure to display more data
-- =============================================  
-- Author:              Chase Florell  
-- Create date: 11/10/2008  
-- Update date: 11/10/2008  
-- Description: Get Admin Data  
-- =============================================  
ALTER PROCEDURE dbo.bt_BizBoth_AdminAdChart  
 
AS 
SET NOCOUNT ON 
SET ANSI_NULLS ON 
    /* SET NOCOUNT ON */  
 
 
Select   
 
    (Select Count([ID])   
        As TotalBizForSale   
        From bt_BizForSale   
        Where DateExpires > GetDate()  
        And isSold = 0  
    ) AS [Total For Sale],   
      
    (Select Count([ID])  
        As TotalForSaleSold  
        From bt_BizForSale  
        Where isSold = 1  
    ) As [Total Sold],  
 
    (Select Count([ID])  
        As TotalForSaleExpired  
        From bt_BizForSale  
        Where isSold = 0  
        And DateExpires < GetDate()  
    ) As [Total For Sale Expired],  
          
    (Select Count([ID])   
        As TotalBizWanted   
        From bt_BizWanted   
        Where DateExpires > GetDate()  
        And isFound = 0  
    ) As [Total Wanted],  
      
    (Select Count([ID])  
        As TotalWantedFound  
        From bt_BizWanted  
        Where isFound = 1  
    ) As [Total Found],  
 
    (Select Count([ID])  
        As TotalWantedExpired  
        From bt_BizWanted  
        Where isFound = 0  
        And DateExpires < GetDate()  
    ) As [Total Wanted Expired] 

and have a Screen Shot to display the results.
I am binding the Chart as follows

 
        Dim BizBothDC As New DAL.BizBothDataContext  
        Dim results = BizBothDC.bt_BizBoth_AdminAdChart.ToList  
        RadChart1.DataSource = results  
 
        RadChart1.DataBind()  
 

is there any way to get all of the records into a singe pie?
0
Accepted
Ves
Telerik team
answered on 12 Nov 2008, 09:55 AM
Hello Chase Florell,

Please, find the answer in the support thread you have started.

Best regards,
Ves
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Chase Florell
Top achievements
Rank 1
answered on 13 Nov 2008, 10:44 PM
Thank you for the reply.  For those looking for a similar answer... here is my answer from Support
        If Not Page.IsPostBack Then 
 
            Dim ser As New ChartSeries  
            Dim item As New ChartSeriesItem  
 
            ser.Type = ChartSeriesType.Pie  
            ser.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels  
            ser.Appearance.Corners.RoundSize = 5  
 
            Dim BizBothDC As New DAL.BizBothDataContext  
            Dim results = BizBothDC.bt_BizBoth_AdminAdChart.First  
 
 
            item.YValue = results.Total_For_Sale  
            item.Name = "Total For Sale: " & results.Total_For_Sale  
            ser.Items.Add(item)  
 
            item = New ChartSeriesItem  
            item.YValue = results.Total_Sold  
            item.Name = "Total Sold: " & results.Total_Sold  
            ser.Items.Add(item)  
 
            item = New ChartSeriesItem  
            item.YValue = results.Total_For_Sale_Expired  
            item.Name = "Total For Sale Expired: " & results.Total_For_Sale_Expired  
            ser.Items.Add(item)  
 
            item = New ChartSeriesItem  
            item.YValue = results.Total_Wanted  
            item.Name = "Total Wanted: " & results.Total_Wanted  
            ser.Items.Add(item)  
 
            item = New ChartSeriesItem  
            item.YValue = results.Total_Found  
            item.Name = "Total Found: " & results.Total_Found  
            ser.Items.Add(item)  
 
            item = New ChartSeriesItem  
            item.YValue = results.Total_Wanted_Expired  
            item.Name = "Total Wanted Expired: " & results.Total_Wanted_Expired  
            ser.Items.Add(item)  
 
            RadChart1.Appearance.FillStyle.FillType = Styles.FillType.Image  
            RadChart1.Appearance.FillStyle.FillSettings.BackgroundImage = "~/Images/Admin_Icons/Admin_Chart_BG.png" 
            RadChart1.Appearance.Border.Color = Drawing.Color.Transparent  
 
            RadChart1.Series.Add(ser)  
            RadChart1.ChartTitle.TextBlock.Text = "Current Business-Trader Ad Postings" 
            RadChart1.ChartTitle.TextBlock.Appearance.TextProperties.Color = Drawing.ColorTranslator.FromHtml("#5c7f50")  
        End If 
Tags
Chart (Obsolete)
Asked by
Chase Florell
Top achievements
Rank 1
Answers by
Chase Florell
Top achievements
Rank 1
Ves
Telerik team
Share this question
or