我正在使用highcharts库在javascript中渲染和绘制我的图表。我之前工作得很好,但在重命名我的页面并重新定位我的页面之后它现在无法正常工作。我没有触及加载highcharts脚本并且没有触及页面上脚本的母版页。任何帮助将不胜感激!
<script>
$(document).ready(DrawMyChart1);
function DrawMyChart1 () {
chart = new Highcharts.Chart({
chart: {
renderTo: 'newcustomerproc',
defaultSeriesType: 'column',
backgroundColor: '#2a2a2a'
},
title: {
text: 'New Customer Process',
style: { color: '#FFFFFF' }
},
xAxis: {
categories: ['New Customer Process']
},
yAxis: {
title: {
text: 'Stage in Process',
style: { color: '#FFFFFF' }
}
},
legend: {
itemStyle: { color: '#FFFFFF' }
},
tooltip: {
pointFormat: '<span style="color:{series.color}">{series.name}</span>: <b>{point.y}</b> ({point.percentage:.0f}%)<br/>',
shared: true
},
plotOptions: {
column: { stacking: 'percent' }
},
series: [<%=Series1 %>],
colors:[<%=Colors1 %>]
});
}
</script>
我也在firebug中调试了这个,并且由于某种原因$(document).ready()方法没有触发。
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
<div class="widgetarea">
<asp:Panel ID="TrainerDashboardPNL" runat="server" >
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Account/Achievements/AchievementList.aspx">
<div class="widget_1x1 round">
<div class="widget_header">
<h3>Achievements</h3>
</div>
<div class="widget_canvas">
<div id="achievementratiodiv" runat="server"></div>
<hr />
<div id="achievementtotaldiv" runat="server"></div>
<div id="achievementgoaldiv" runat="server"></div>
</div>
</div>
</asp:HyperLink>
<div class="widget_1x2 round">
<div class="widget_header">
<h3>Performance Stats</h3>
</div>
<div class="widget_canvas">
<div class="widget_inner_canvas">
<div id="newcustomerproc" style="min-width: 50px; height: 270px; overflow:hidden;"></div>
</div>
<div class="widget_inner_canvas">
<div id="twoweekrankdiv" runat="server"></div>
<div id="twoweekscorediv" runat="server"></div>
<div id="todayscallsdiv" runat="server"></div>
<div id="todayscalltimediv" runat="server"></div>
</div>
</div>
</div>
<div class="widget_1x1 round">
<div class="widget_header">
<h3>Training Level</h3>
</div>
<div class="widget_canvas">
<asp:Image ID="TrainingLevelIMG" runat="server" Height="250px" Width="250px" CssClass="center" />
</div>
</div>
<div class="widget_1x1 round">
<div class="widget_header">
<h3>Opportunities</h3>
</div>
<div class="widget_canvas">
<span class="widget_third_stat">Coming Soon</span>
</div>
</div>
<div class="widget_1x1 round">
<div class="widget_header">
<h3>Opportunity Payout</h3>
</div>
<div class="widget_canvas">
<span class="widget_third_stat">Coming Soon</span>
</div>
</div>
<div>
<div class="widget_1x1 round">
<div class="widget_header">
<h3>Training Potential</h3>
</div>
<div class="widget_canvas">
<div id="potentialearningsdiv" runat="server"></div>
<hr />
<div id="assignedhoursdiv" runat="server"></div>
<div id="payratediv" runat="server"></div>
</div>
</div>
</div>
<div class="widget_1x1 round">
<div class="widget_header">
<h3>Training Hours</h3>
</div>
<div class="widget_canvas">
<div id="careerhoursdiv" runat="server"></div>
<div id="yearlytotaldiv" runat="server"></div>
<div id="nextleveldiv" runat="server"></div>
</div>
</div>
<div class="clear" />
</asp:Panel>
</div>
答案 0 :(得分:1)
在过去几天拔出头发后,我终于弄明白为什么它不能正常工作。事实证明我的脚本没有在母版页中正确加载,因为我的页面位于子文件夹中。这就是帮我解决问题的原因。 jQuery not loading on Master Page when the Content Page is in a child folder
答案 1 :(得分:0)
重命名文件时,是否更新了.aspx页面声明中对codebehind的引用?