Click here to Skip to main content
16,023,224 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
anyone have idea of bar chart,


XML
<asp:Chart ID="Chart1" runat="server" ImageLocation="~/document/Images_Chart/ChartPic_#SEQ(300,3)" ImageStorageMode="UseImageLocation" Width="800px"  BackGradientStyle="LeftRight">
       <Series>
           <asp:Series Name="Series1" ChartType="Column" ChartArea="ChartArea1"  >


     </asp:Series>


       </Series>
       <ChartAreas>
           <asp:ChartArea Name="ChartArea1" Area3DStyle-IsClustered="true">


           </asp:ChartArea>
       </ChartAreas>
       <BorderSkin SkinStyle="Emboss" />    </asp:Chart>



C#
private void loadChart()
   {
       DataBase12 obj = new DataBase12();

       DataSet ds_chart = new DataSet();
       IFormatProvider cult = new CultureInfo("en-us");

       ds_chart = obj.GetFeedBackChartReport(DateTime.ParseExact(txtFromdt.Text.ToString(), "dd/MM/yyyy", cult), DateTime.ParseExact(txtTodt.Text.ToString(), "dd/MM/yyyy", cult));
       if (ds_chart.Tables[0].Rows.Count == 0)
       {
           pnl_Chart.Visible = false;
           LblErrorMessage.Text = "No records found !";
       }
       else
       {

           Chart1.DataSource = ds_chart;
           Chart1.DataBind();
           pnl_Chart.Visible = true;
           LblErrorMessage.Text = "";
       }
   }

in database i hv 2 question with q1,q2 if yes q1=1 if no q1=2 ,same for q2
i use this sp

SQL
Create PROC  [dbo].[usp_GetFeedbackReport] 
@FromDate Datetime,
@ToDate datetime	
AS
BEGIN
	
	SET NOCOUNT ON;
declare @q1yes int
declare @q1no int
declare @q2yes int
declare @q2no int
  
   select @q1yes=count(q1)  from tbl_feedbackDetails where q1=1 
  and Createdon >= @FromDate AND Createdon <= @ToDate
GROUP BY convert(varchar,Createdon,103)
ORDER BY convert(varchar,Createdon,103) 

  select @q1no=count(q1)  from tbl_feedbackDetails where q1=2 
  and Createdon >= @FromDate AND Createdon <= @ToDate
GROUP BY convert(varchar,Createdon,103)
ORDER BY convert(varchar,Createdon,103) 

 
    select @q2yes=count(q2)  from tbl_feedbackDetails where q2=1 
  and Createdon >= @FromDate AND Createdon <= @ToDate
GROUP BY convert(varchar,Createdon,103)
ORDER BY convert(varchar,Createdon,103) 

  select @q2no=count(q2)  from tbl_feedbackDetails where q2=2 
  and Createdon >= @FromDate AND Createdon <= @ToDate
GROUP BY convert(varchar,Createdon,103)
ORDER BY convert(varchar,Createdon,103) 

END


my bar chart is not displaying where i m doing wrong in x-axis i want show q1,q2
Posted
Updated 24-Aug-12 0:10am
v2

Main thing is you have not set value field of chart
XValueMember & YValueMember

C#
<asp:series name="Series1" charttype="Column" chartarea="ChartArea1" xmlns:asp="#unknown">
XValueMember="XField" YValueMember="YField" 
 ></asp:series>


Your sp is resulting four resultset.
You cant like this
Chart1.DataSource = ds_chart;
YOu have to give some table to datasourcr. You should first try some basic example for bar chart. With simple select statement. Then analyze what you have to do. Create correct sp & then implement it in chart. Take data in single table while creating sp.
 
Share this answer
 
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900