1

我正在使用 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>

4

2 回答 2

1

在过去几天拔出头发后,我终于弄清楚了为什么它不起作用。事实证明我的脚本没有在母版页中正确加载,因为我的页面位于子文件夹中。这就是帮助我解决问题的原因。当内容页面位于子文件夹中时,jQuery 未在母版页上加载

于 2013-11-14T17:42:14.083 回答
0

重命名文件时,是否更新了 .aspx 页面声明中对代码隐藏的引用?

于 2013-11-13T21:26:13.980 回答