如何在aspx页面图表中的highcharts中设置dataurl不会显示 [英] how to set dataurl in highcharts in aspx page chart is not displayed
本文介绍了如何在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"><asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript">
// Specify the ID of the chart that you want to configure
FusionCharts("shwetha").configureLink({
swfUrl: "FusionCharts/FCF_Pie2D.swf" // Specify the chart type
},
0); // The first drill-down level is 0 (zero)
</script>
<script type="text/javascript" language="JavaScript" src="FusionCharts/FusionCharts.js"></script>
<table style="width: 50%; z-index: 1; left: 54px; top: 383px; position: absolute; height: 50%">
<tr>
<td style="width: 390px">
<asp:Literal ID="FCLiteral3" runat="server"></asp:Literal></td>
<td>
&nbsp;</td>
</tr>
<tr>
<td style="width: 390px">
<asp:Image ID="Image1" runat="server"
style=" left: 6px; top: 322px; position: absolute; width: 112px; height: 18px;"
ImageUrl="~/cooltext1167143619.png" />
</td>
<td>
&nbsp;</td>
</tr>
</table>
<asp:Panel ID="Panel7" runat="server" Height="35px"
Style=" left: 712px; position: absolute; top: 246px; " Width="100px" >
<asp:Label ID="Label1" runat="server"
Font-Bold="True" Style="font-size: small; left: -121px;
color:black; font-family: 'Tahoma'; position: absolute;top: 0px"
Text="Call Type" Width="72px" ></asp:Label>
<uc2:WebUserControl1 ID="WebUserControl1" runat="server" />
</asp:Panel>
<asp:Panel ID="Panel1" runat="server" Height="35px"
Style=" left: 712px; position: absolute; top: 196px; width: 100px;">
<asp:Label ID="Label17" runat="server" Font-Bold="True" Font-Size="Small" Style="left: -121px;color: black; font-family: Tahoma; position: absolute; top: 0px;" Text="Provider"
Width="72px" ></asp:Label>
<uc3:WebUserControl2 ID="WebUserControl2" runat="server" />
</asp:Panel>
<asp:Panel ID="Panel5" runat="server" Height="35px" Font-Bold="True"
Style=" left: 712px; position: absolute; top: 148px; " Width="100px">
<asp:Label ID="Label18" runat="server" Font-Bold="True" Style="font-size: small; left:-121px;
color: black; font-family: 'Tahoma'; position: absolute;top: 0px;" Text="Sites"
Width="72px"></asp:Label>
<uc1:WebUserControl ID="WebUserControl" runat="server" />
</asp:Panel>
<asp:Label ID="Label12" runat="server" Font-Bold="False" Style="font-size: small;
left: 984px; color: white; font-family: 'Arial'; position: absolute; top: 35px"
Text="You are Logged in as : Admin" Width="260px"></asp:Label>
<asp:Label ID="Label10" runat="server" Font-Bold="True"
Style="left: 54px; color: #138dda;
position: absolute; top: 125px; font-size: small; font-family:Arial; width: 175px;"
Text="Call Summary" ForeColor="Red"></asp:Label>
<asp:Label ID="Label11" runat="server" Style="font-size: small; left: 14px; color: #005A5A;
font-family: 'Arial'; position: absolute; top: 114px" Text="Label" Width="278px" Font-Bold="False" Visible="False"></asp:Label>
<asp:ImageButton ID="ImageButton6" runat="server" ImageUrl="~/Go.png"
onmouseover="this.src='GoMouseOver.png'" onmouseout="this.src='Go.png'"
Style=" position: absolute; top: 137px; left: 912px;"
ToolTip="Click here get the details" onclick="ImageButton6_Click" />
</asp:Content></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屋!
查看全文