0

我正在使用向下钻取功能,我可以在其中单击条形图,它将打开带有新子图的新页面。但我不想要的是打开一个新窗口,我想要的只是使用一个带有子图表的弹出窗口。我从 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
            }
4

1 回答 1

0

请参考下面的链接。,。 http://docs.fusioncharts.com/charts/contents/JavaScript/JS_LinkedCharts.html

-ExtJS 窗口中的 LinkedCharts -在 jQuery PrettyPhoto 中打开 LinkedCharts -在 jQuery 对话框中打开 LinkedCharts

我希望...这可以帮助你!

于 2013-06-25T12:18:59.253 回答