我有一个要求,开发堆积柱使用FusionCharts XT试用版的图表。我找不到任何使用数据源作为堆叠列的数据库的示例。他们已经展示了使用XML/JSON的例子。如果您有使用FusionCharts这方面的经验,请帮助我。提前致谢。使用sql server数据库堆积柱形图融合图表
下面是我目前的代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using InfoSoftGlobal;
namespace workflowmangement
{
public partial class chart1 : System.Web.UI.Page
{
string conString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
siva.Text = CreateChart();
}
public string CreateChart()
{
SqlConnection con = new SqlConnection(conString);
string sqlStatement = "SELECT Activity_Name,Activity_Id from Activity";
SqlCommand cmd = new SqlCommand(sqlStatement, con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
string strXML;
strXML = "<graph caption='Category Wise Quantity' subCaption='By Quantity' decimalPrecision='0' showNames='1' numberSuffix=' Units' pieSliceDepth='30' formatNumberScale='0'>";
while (reader.Read())
{
strXML += "<set name='" + reader["Activity_Name"].ToString() + "' value='" + reader["Activity_Id"].ToString() + "' />";
}
strXML += "</graph>";
return FusionCharts.RenderChart("/FusionCharts/FCF_Pie3D.swf", "", strXML, "FactorySum", "650", "450", false, false);
}
}
}