我正在使用向下钻取功能,我可以点击条形图,它将打开包含新子图表的新页面。但我不想要的是打开一个新窗口,我想要的就是使用带有子图表的弹出窗口。我在Fusion-chart网站上看到了一些例子,但他们使用的是xml格式,我不能按照他们的例子。这是我的整个代码工作正常,但我唯一需要改变而不是打开一个新页面;我只需要使用弹出窗口。我怎样才能做到这一点?请帮忙,谢谢你的时间.. 这是我的主页代码:
//aspx code
<asp:Literal ID="chart_from_db" runat="server">
</asp:Literal>
//code behind
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);
StringBuilder xmlStr = new StringBuilder();
xmlStr.Append("<chart caption='Total Revenue' palette='3' showValues='0' numberPrefix='$' useRoundEdges='1'>");
{
string sqlStatement = "SELECT Category, AvgNumbers FROM Table1";
SqlCommand cmd = new SqlCommand(sqlStatement, con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
xmlStr.AppendFormat("<set label='{0}' value='{1}' link='{2}'/>", reader["Category"].ToString(), reader["AvgNumbers"].ToString(), Server.UrlEncode("DrillDown1.aspx?AvgDays=" + reader["Category"].ToString()));
}
xmlStr.Append("</chart>");
reader.Close();
con.Close();
FusionCharts.SetRenderer("javascript");
chart_from_db.Text = FusionCharts.RenderChart(
"FusionChartsXT/Column3D.swf", // Path to chart's SWF
"", // Page which returns chart data. Leave blank when using Data String.
xmlStr.ToString(), // String containing the chart data. Leave blank when using Data URL.
"annual_revenue", // Unique chart ID
"640", "340", // Width & Height of chart
false, // Disable Debug Mode
true); // Register with JavaScript object
}
这是在点击图表时打开的子页面。
// ASPX code
<div>
<asp:Literal ID="MyChart" runat="server">
</asp:Literal>
//code benind
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);
String AvgDays = Request.QueryString["AvgDays"];
StringBuilder xmlStr = new StringBuilder();
xmlStr.Append("<chart caption='Total Revenue' palette='3' showValues='0' numberPrefix='$' useRoundEdges='1'>");
{
string sqlStatement = "select MonthYear, AvgNumbers from Table2 where AvgDays= '" + AvgDays.ToString() + "'";
SqlCommand cmd = new SqlCommand(sqlStatement, con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
// Construct the chart data in XML format
xmlStr.AppendFormat("<set label='{0}' value='{1}' link='{1}'/>", reader["MonthYear"].ToString(), reader["AvgNumbers"].ToString());
}
// End the XML string
xmlStr.Append("</chart>");
// Close the result set Reader object and the Connection object
reader.Close();
con.Close();
// Set the rendering mode to JavaScript, from the default Flash.
FusionCharts.SetRenderer("javascript");
// Call the RenderChart method, pass the correct parameters, and write the return value to the Literal tag
MyChart.Text = FusionCharts.RenderChart(
"FusionChartsXT/Column3D.swf", // Path to chart's SWF
"", // Page which returns chart data. Leave blank when using Data String.
xmlStr.ToString(), // String containing the chart data. Leave blank when using Data URL.
"crab", // Unique chart ID
"640", "340", // Width & Height of chart
false, // Disable Debug Mode
true); // Register with JavaScript object
}
答案 0 :(得分:0)
请参阅以下链接。 http://docs.fusioncharts.com/charts/contents/JavaScript/JS_LinkedCharts.html
ExtJS窗口中的-LinkedCharts - 在jQuery PrettyPhoto中打开LinkedCharts - 在jQuery对话框中打开LinkedCharts
我希望......这可能对你有帮助!