如何在aspx页面图表中的highcharts中设置dataurl不会显示 [英] how to set dataurl in highcharts in aspx page chart is not displayed

查看:42
本文介绍了如何在aspx页面图表中的highcharts中设置dataurl不会显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$(function () {
                             var chart;
                         $(document).ready(function () {

                 // Build the chart
                chart = new Highcharts.Chart(
{
    chart:
{
    renderTo: 'container',
    plotBackgroundColor: null,
    plotBorderWidth: null,
    plotShadow: false
},
   series: [
{
    type: 'column',
    name: 'Strength',
    dataURL: 'Default5.aspx/GetData'//Here i have Set URL but it is not going
    
}
]
});
        });
    });
</script>

推荐答案

function ( ){
var chart;
(function () { var chart;


document ).ready( function (){

// 构建图表
chart = new Highcharts.Chart(
{
chart:
{
renderTo:' container'
plotBackgroundColor: null
plotBorderWidth: null
plotShadow: false
},
系列:[
{
类型:' 列'
名称:' 强度'
dataURL:' Default5.aspx / GetData' // 这里我有设置URL,但它不会

}
]
});
});
});
< / script>
(document).ready(function () { // Build the chart chart = new Highcharts.Chart( { chart: { renderTo: 'container', plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, series: [ { type: 'column', name: 'Strength', dataURL: 'Default5.aspx/GetData'//Here i have Set URL but it is not going } ] }); }); }); </script>


FUSION CHARTS是免费的,比高价更好的选项

ASPX PAGE
< pre lang =xml>& lt; asp:Content ID =& quot; Content1& quot; ContentPlaceHolderID =安培; QUOT; ContentPlaceHolder1&安培; QUOT; Runat =& quot; Server& quot;& gt;



& lt; script type =& quot; text / javascript& quot;& gt ;

//指定要配置的图表的ID

FusionCharts(& quot; shwetha& quot;)。configureLink({

swfUrl:& quot; FusionCharts / FCF_Pie2D.swf& quot; //指定图表类型

},

0); //第一个下钻级别为0(零)

& lt; / script& gt;

& lt; script type =& quot; text / JavaScript的&安培; QUOT;语言=安培; QUOT; JavaScript的&安培; QUOT; src =& quot; FusionCharts / FusionCharts.js& quot;& gt;& lt; / script& gt;

& lt; table style =& quot; width:50% ; z-index:1;左:54px;上:383px;位置:绝对;身高:50%& quot;& gt;

& lt; tr& gt;

& lt; td style =& quot; width:390px& ;& gt;

& lt; asp:Literal ID =& quot; FCLiteral3& quot; runat =& quot; server& quot;& gt;& lt; / asp:Literal& gt;& lt; / td& gt;

& lt; td& gt;

& amp; nbsp;& lt; / td& gt;

& lt; / tr& gt;

& LT; tr& gt;

& lt; td style =& quot; width:390px& quot;& gt;



& lt; asp:Image ID =& quot; Image1& quot; runat =& quot; server& quot;



style =& quot;左:6px;上:322px;位置:绝对;宽度:112px;身高:18px;& quot;

ImageUrl =& quot;〜/ cooltext1167143619.png& quot; /& gt;

& lt; / td& gt;

& lt; td& gt;

& amp; nbsp;& lt; / td& gt;

& lt; / tr& gt;

& lt; / table& gt;





& lt; asp:Panel ID =& quot; Panel7& quot; RUNAT =安培; QUOT;服务器&安培; QUOT;高度=& quot; 35px& quot;

Style =& quot;左:712px;位置:绝对;上:246px; &安培; QUOT;宽度=安培; QUOT; 100像素和安培; QUOT; & gt;



& lt; asp:Label ID =& quot; Label1& quot; runat =& quot; server& quot;

Font-Bold =& quot; True& quot; Style =& quot; font-size:small;左:-121px;

颜色:黑色; font-family:&#39; Tahoma&#39 ;; position:absolute; top:0px& quot;

Text =& quot; Call Type& quot;宽度=安培; QUOT; 72px&安培; QUOT; & gt;& lt; / asp:Label& gt;





& lt; uc2:WebUserControl1 ID =& QUOT; WebUserControl1&安培; QUOT; RUNAT =安培; QUOT;服务器&安培; QUOT; /& gt;

& lt; / asp:Panel& gt;



& lt; asp:Panel ID =& ; QUOT; Panel1的&安培; QUOT; RUNAT =安培; QUOT;服务器&安培; QUOT;高度=& quot; 35px& quot;

Style =& quot;左:712px;位置:绝对;上:196px; width:100px;& quot;& gt;

& lt; asp:Label ID =& quot; Label17& quot; RUNAT =安培; QUOT;服务器&安培; QUOT;字体-粗体=&安培; QUOT;真&安培; QUOT;字体尺寸=安培; QUOT;小&安培; QUOT; Style =& quot; left:-121px; color:black; font-family:Tahoma;位置:绝对;顶部:0px;& quot; Text =& quot; Provider& quot;

Width =& quot; 72px& quot; & gt;& lt; / asp:Label& gt;



& lt; uc3:WebUserControl2 ID =& quot; WebUserControl2& quot; RUNAT =安培; QUOT;服务器&安培; QUOT; /& gt;



& lt; / asp:Panel& gt;



& lt; asp:Panel ID =& quot; Panel5& quot; RUNAT =安培; QUOT;服务器&安培; QUOT;高度=安培; QUOT; 35px&安培; QUOT; Font-Bold =& quot; True& quot;

Style =& quot;左:712px;位置:绝对;上:148px; &安培; QUOT;宽度=& quot; 100px& quot;& gt;

& lt; asp:Label ID =& quot; Label18& quot; RUNAT =安培; QUOT;服务器&安培; QUOT;字体-粗体=&安培; QUOT;真&安培; QUOT; Style =& quot; font-size:small;左:-121px;

颜色:黑色; font-family:&#39; Tahoma&#39 ;; position:absolute; top:0px;& quot; Text =& quot; Sites& quot;

Width =& quot; 72px& quot;& gt;& lt; / asp:Label& gt;



& lt; uc1:WebUserControl ID =& quot; WebUserControl& quot; RUNAT =安培; QUOT;服务器&安培; QUOT; /& gt;



& lt; / asp:Panel& gt;



& lt; asp:Label ID =& quot; Label12& quot; RUNAT =安培; QUOT;服务器&安培; QUOT;字体-粗体=&安培; QUOT假安培; QUOT; Style =& quot; font-size:small;

left:984px;白颜色; font-family:&#39; Arial&#39 ;;位置:绝对;顶部:35px& quot;

Text =& quot;您登录时为:Admin& quot; Width =& quot; 260px& quot;& gt;& lt; / asp:Label& gt;

& lt; asp:Label ID =& quot; Label10& quot; RUNAT =安培; QUOT;服务器&安培; QUOT; Font-Bold =& quot; True& quot;

Style =& quot; left:54px;颜色:#138dda;

position:absolute;上:125px; font-size:small; FONT-FAMILY:宋体;宽度:175px;& quot;

Text =& quot; Call Summary& quot; ForeColor =& quot; Red& quot;& gt;& lt; / asp:Label& gt;

& lt; asp:Label ID =& quot; Label11& quot; RUNAT =安培; QUOT;服务器&安培; QUOT; Style =& quot; font-size:small;左:14px;颜色:#005A5A;

font-family:&#39; Arial&#39 ;;位置:绝对;上:114px& quot;文本=安培; QUOT;标签和安培; QUOT;宽度=安培; QUOT; 278px&安培; QUOT;字体-粗体=&安培; QUOT假安培; QUOT; Visible =& quot; False& quot;& gt;& lt; / asp:Label& gt;

& lt; asp:ImageButton ID =& quot; ImageButton6& quot; RUNAT =安培; QUOT;服务器&安培; QUOT; ImageUrl =& quot;〜/ Go.png& quot;

onmouseover =& quot; this.src =&#39; GoMouseOver.png&#39;& quot; onmouseout =& quot; this.src =&#39; Go.png&#39;& quot;

Style =& quot;位置:绝对;上:137px; left:912px;& quot;

ToolTip =& quot;点击此处获取详细信息& quot;的onclick =安培; QUOT; ImageButton6_Click&安培; QUOT; /& gt;

& lt; / asp:Content& gt;< / pre>





CS CODE

FUSION CHARTS IS FREE AND BETTER OPTION THAN HIGH CHARTS
ASPX PAGE
<pre lang="xml">&lt;asp:Content ID=&quot;Content1&quot; ContentPlaceHolderID=&quot;ContentPlaceHolder1&quot; Runat=&quot;Server&quot;&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
// Specify the ID of the chart that you want to configure
FusionCharts(&quot;shwetha&quot;).configureLink({
swfUrl: &quot;FusionCharts/FCF_Pie2D.swf&quot; // Specify the chart type
},
0); // The first drill-down level is 0 (zero)
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot; src=&quot;FusionCharts/FusionCharts.js&quot;&gt;&lt;/script&gt;
&lt;table style=&quot;width: 50%; z-index: 1; left: 54px; top: 383px; position: absolute; height: 50%&quot;&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 390px&quot;&gt;
&lt;asp:Literal ID=&quot;FCLiteral3&quot; runat=&quot;server&quot;&gt;&lt;/asp:Literal&gt;&lt;/td&gt;
&lt;td&gt;
&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style=&quot;width: 390px&quot;&gt;

&lt;asp:Image ID=&quot;Image1&quot; runat=&quot;server&quot;

style=&quot; left: 6px; top: 322px; position: absolute; width: 112px; height: 18px;&quot;
ImageUrl=&quot;~/cooltext1167143619.png&quot; /&gt;
&lt;/td&gt;
&lt;td&gt;
&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;


&lt;asp:Panel ID=&quot;Panel7&quot; runat=&quot;server&quot; Height=&quot;35px&quot;
Style=&quot; left: 712px; position: absolute; top: 246px; &quot; Width=&quot;100px&quot; &gt;

&lt;asp:Label ID=&quot;Label1&quot; runat=&quot;server&quot;
Font-Bold=&quot;True&quot; Style=&quot;font-size: small; left: -121px;
color:black; font-family: &#39;Tahoma&#39;; position: absolute;top: 0px&quot;
Text=&quot;Call Type&quot; Width=&quot;72px&quot; &gt;&lt;/asp:Label&gt;


&lt;uc2:WebUserControl1 ID=&quot;WebUserControl1&quot; runat=&quot;server&quot; /&gt;
&lt;/asp:Panel&gt;

&lt;asp:Panel ID=&quot;Panel1&quot; runat=&quot;server&quot; Height=&quot;35px&quot;
Style=&quot; left: 712px; position: absolute; top: 196px; width: 100px;&quot;&gt;
&lt;asp:Label ID=&quot;Label17&quot; runat=&quot;server&quot; Font-Bold=&quot;True&quot; Font-Size=&quot;Small&quot; Style=&quot;left: -121px;color: black; font-family: Tahoma; position: absolute; top: 0px;&quot; Text=&quot;Provider&quot;
Width=&quot;72px&quot; &gt;&lt;/asp:Label&gt;

&lt;uc3:WebUserControl2 ID=&quot;WebUserControl2&quot; runat=&quot;server&quot; /&gt;

&lt;/asp:Panel&gt;

&lt;asp:Panel ID=&quot;Panel5&quot; runat=&quot;server&quot; Height=&quot;35px&quot; Font-Bold=&quot;True&quot;
Style=&quot; left: 712px; position: absolute; top: 148px; &quot; Width=&quot;100px&quot;&gt;
&lt;asp:Label ID=&quot;Label18&quot; runat=&quot;server&quot; Font-Bold=&quot;True&quot; Style=&quot;font-size: small; left:-121px;
color: black; font-family: &#39;Tahoma&#39;; position: absolute;top: 0px;&quot; Text=&quot;Sites&quot;
Width=&quot;72px&quot;&gt;&lt;/asp:Label&gt;

&lt;uc1:WebUserControl ID=&quot;WebUserControl&quot; runat=&quot;server&quot; /&gt;

&lt;/asp:Panel&gt;

&lt;asp:Label ID=&quot;Label12&quot; runat=&quot;server&quot; Font-Bold=&quot;False&quot; Style=&quot;font-size: small;
left: 984px; color: white; font-family: &#39;Arial&#39;; position: absolute; top: 35px&quot;
Text=&quot;You are Logged in as : Admin&quot; Width=&quot;260px&quot;&gt;&lt;/asp:Label&gt;
&lt;asp:Label ID=&quot;Label10&quot; runat=&quot;server&quot; Font-Bold=&quot;True&quot;
Style=&quot;left: 54px; color: #138dda;
position: absolute; top: 125px; font-size: small; font-family:Arial; width: 175px;&quot;
Text=&quot;Call Summary&quot; ForeColor=&quot;Red&quot;&gt;&lt;/asp:Label&gt;
&lt;asp:Label ID=&quot;Label11&quot; runat=&quot;server&quot; Style=&quot;font-size: small; left: 14px; color: #005A5A;
font-family: &#39;Arial&#39;; position: absolute; top: 114px&quot; Text=&quot;Label&quot; Width=&quot;278px&quot; Font-Bold=&quot;False&quot; Visible=&quot;False&quot;&gt;&lt;/asp:Label&gt;
&lt;asp:ImageButton ID=&quot;ImageButton6&quot; runat=&quot;server&quot; ImageUrl=&quot;~/Go.png&quot;
onmouseover=&quot;this.src=&#39;GoMouseOver.png&#39;&quot; onmouseout=&quot;this.src=&#39;Go.png&#39;&quot;
Style=&quot; position: absolute; top: 137px; left: 912px;&quot;
ToolTip=&quot;Click here get the details&quot; onclick=&quot;ImageButton6_Click&quot; /&gt;
&lt;/asp:Content&gt;</pre>


CS CODE
GIVE CONNECTION HERE  

  ConfigureColors();
  //WRITE QUERY
   if ((calltype == "") && (serviceprovider != "") && (sites == ""))
                                            {                                               
                                                s = " Select  toc,count(dialnumber) as dialnumber from processeddata_table WHERE  DialDate between '" + bg8 + "' and  '" + bg9 + "' AND (time ='" + sp2[0] + "' or time ='" + sp2[1] + "' or time ='" + sp2[2] + "' or time ='" + sp2[3] + "' or time ='" + sp2[4] + "' or time ='" + sp2[5] + "' or time ='" + sp2[6] + "' or time ='" + sp2[7] + "' or time ='" + sp2[8] + "' or time ='" + sp2[9] + "' or time ='" + sp2[10] + "' or time ='" + sp2[11] + "' or time ='" + sp2[12] + "' or time ='" + sp2[13] + "' or time ='" + sp2[14] + "' or time ='" + sp2[15] + "' or time ='" + sp2[16] + "' or time ='" + sp2[17] + "' or time ='" + sp2[18] + "' or time ='" + sp2[19] + "'  )   AND   WWID !='" + wwid + "' AND WWID !='" + def + "'  AND  BusinessUnit!='" + businessunit + "' group by toc ";
                                               //s = " Select toc,count(dialnumber) as dialnumber from processeddata_table WHERE  DialDate between '" + bg8 + "' and  '" + bg9 + "'   AND   WWID !='" + wwid + "' AND WWID !='" + def + "' and (calltype='ISD' or calltype='STD' or calltype='LOCAL' OR calltype='MOBILE')group by toc ";
                                                cmd.CommandText = s;
                                            }

                                            cmd.ExecuteNonQuery();
                                            cmd.CommandTimeout = 30000;

                                            string ad = s;
                                            da = new MySqlDataAdapter(cmd);
                                            
                                            da.Fill(ds, "processeddata_table");
                                            da.Fill(dt);

                                            // Initialize the string which would contain the chart data in XML format
                                            StringBuilder xmlStr = new StringBuilder();

                                            // Provide the relevant customization attributes to the chart
                                            xmlStr.Append("<chart caption='US Calls Summary Report by Location' palette='3'  showValues='0' numberPrefix='' useRoundEdges='1'  xAxisName='Location' yAxisName='No Of Calls'>");

                                            // Begin iterating through the result set
                                            MySqlDataReader rst = cmd.ExecuteReader();


                                            while (rst.Read())
                                            {
                                                // Construct the chart data in XML format
                                                xmlStr.AppendFormat("<set label='{0}' value='{1}' link='newchart-xmlurl-{2}'/>", rst["toc"].ToString(), rst["dialnumber"].ToString(), Server.UrlEncode("Datarender.aspx?year=" + rst["toc"].ToString()));
                                            }

                                            // End the XML string
                                            xmlStr.Append("</chart>");

                                            // Close the result set Reader object and the Connection object
                                            rst.Close();

                                            // Set the rendering mode to JavaScript, from the default Flash.
                                            FusionCharts.SetRenderer("javascript");

                                            FCLiteral3.Text = FusionCharts.RenderChart(
                                            "FusionCharts/FCF_Pie2D.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.
                                            "shwetha",   // Unique chart ID
                                            "640", "340",       // Width & Height of chart
                                            true,              // Disable Debug Mode
                                            true); 
}
private void ConfigureColors()
    {

        color[6] = "AFD8F8";
        color[5] = "F6BD0F";
        color[2] = "8BBA00";
        color[3] = "FF8E46";
        color[1] = "008E8E";
        color[5] = "D64646";
        color[0] = "8E468E";
        color[7] = "588526";
        color[8] = "B3AA00";
        color[9] = "008ED6";
        color[10] = "9D080D";
        color[11] = "A186BE";
    }


这篇关于如何在aspx页面图表中的highcharts中设置dataurl不会显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆