I have like to create funnel chart in mvc3 application and my charts vales to be get from the stored procedure.. pls anyone can help me.regards chandru([email protected])
Im a beginner and new to mvc.. so pls explain it by step by step
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
chandru santhoshPosted Aug 17, 2012, 12:28 AM
create a controller name it as Home
public ActionResult Chart()
{
Display();
Display1();
Display2();
var priH = prioitH;
var priC = prioitC;
var pricW = prioitW;
var chart = new Chart(width: 400, height: 250)
.AddSeries(
chartType: "Funnel",
legend: "Rainfall",
yValues: new[] { priH,priC,pricW}).Write("png");
return View();
}
and read a values from the database:
List
SqlDataReader reader= null;
SqlConnection con= null;
SqlCommand cmd=null;
FunnelObj fune = null;
// Int64 prioitH=0;
using (con = new SqlConnection (connectionstring))
{
con.Open();
cmd = con.CreateCommand();
using (cmd = new SqlCommand("sp_funnel1", con))
{
cmd.CommandType = CommandType.StoredProcedure;
reader=cmd.ExecuteReader();
while (reader.Read())
{
//prioit = Convert.ToInt32(reader["Warm"]);
//prioit = Convert.ToInt32(reader["Cold"]);
prioitH = Convert.ToInt32(reader["Hot"]);
}
reader.Close();
// while (reader.Read())
// {
//fune = new FunnelObj();
//fune.PriorityId = Convert.ToInt64(reader["c"]);
// // FunnelValue.Add(fune);
// }
// reader.Close();
}
return prioitH;
and as follows create how many methods u want..
now create your view name is called index.cshtml