Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
c“带Highchart的WPF Webbrowser,来自外部源的Javascript不工作”;此页上的脚本中出现错误";_Javascript_C#_Wpf_Highcharts_Webbrowser Control - Fatal编程技术网

c“带Highchart的WPF Webbrowser,来自外部源的Javascript不工作”;此页上的脚本中出现错误";

c“带Highchart的WPF Webbrowser,来自外部源的Javascript不工作”;此页上的脚本中出现错误";,javascript,c#,wpf,highcharts,webbrowser-control,Javascript,C#,Wpf,Highcharts,Webbrowser Control,我试图找出为什么我的图表没有出现在我的WPF网络浏览器中。 加载html文件时,出现以下错误: 我认为IE可能会阻止WPF WebBrowser中的Highchart(来自外部源的Javascript),因为当我尝试使用IE加载它时,我的页面受到限制,无法运行脚本或ActiveX控件: 我知道允许IE运行脚本或ActiveX控件,但我不知道如何在我的WPF WebBrowser中允许它 我试过使用a,但我不确定是否正确使用了它 <!-- saved from url=(0016)htt

我试图找出为什么我的图表没有出现在我的WPF网络浏览器中。 加载html文件时,出现以下错误:

我认为IE可能会阻止WPF WebBrowser中的Highchart(来自外部源的Javascript),因为当我尝试使用IE加载它时,我的页面受到限制,无法运行脚本或ActiveX控件:

我知道允许IE运行脚本或ActiveX控件,但我不知道如何在我的WPF WebBrowser中允许它

我试过使用a,但我不确定是否正确使用了它

<!-- saved from url=(0016)http://localhost -->

我还尝试了一些绝望的方法,比如将我的程序添加到:

HKEY\U当前\U用户\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE\U浏览器\U仿真\MyProgram.exe和MyProgram.vshost.exe,值0x00002af9

我真的很感谢你的帮助

我的html文件:


海图示例
Highcharts.chart('容器'{
图表:{
类型:“样条线”,
倒过来:是的
},
标题:{
文字:“按海拔高度划分的大气温度”
},
副标题:{
文字:“根据标准大气模型”
},
xAxis:{
相反:错,
标题:{
启用:对,
文字:“高度”
},
标签:{
格式化程序:函数(){
返回此值+公里数;
}
},
最大填充:0.05,
showLastLabel:true
},
亚克斯:{
标题:{
文字:“温度”
},
标签:{
格式化程序:函数(){
返回此值+“°”;
}
},
线宽:2
},
图例:{
已启用:false
},
工具提示:{
headerFormat:“{series.name}
”, 点格式:“{point.x}km:{point.y}°C” }, 打印选项:{ 样条曲线:{ 标记:{ 启用:false } } }, 系列:[{ 名称:“温度”, 数据:[[0,15],[10,-50],[20,-56.5],[30,-46.5],[40,-22.1], [50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]] }] });
好的,这对我来说很好

我添加了
。我还在VisualStudio中本地加载了HTML文件,将其添加到项目中,并将其设置为
copy always
。我也没有在我的机器上做任何注册表调整

C#文件

HTML文件

        <!DOCTYPE HTML>
        <!-- saved from url=(0016)http://localhost -->
        <html>
        <head>
            <meta http-equiv="x-ua-compatible" content="IE=11">
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <title>Highcharts Example</title>
            <style type="text/css">
            </style>
        </head>
        <body>
            <script src="https://code.highcharts.com/highcharts.src.js"></script>
            <script src="https://code.highcharts.com/modules/exporting.js"></script>
            <div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>

            <script type="text/javascript">
                Highcharts.chart("container", {
                    chart: {
                        type: "spline",
                        inverted: true
                    },
                    title: {
                        text: "Atmosphere Temperature by Altitude"
                    },
                    subtitle: {
                        text: "According to the Standard Atmosphere Model"
                    },
                    xAxis: {
                        reversed: false,
                        title: {
                            enabled: true,
                            text: "Altitude"
                        },
                        labels: {
                            formatter: function () {
                                return this.value + "km";
                            }
                        },
                        maxPadding: 0.05,
                        showLastLabel: true
                    },
                    yAxis: {
                        title: {
                            text: "Temperature"
                        },
                        labels: {
                            formatter: function () {
                                return this.value + "°";
                            }
                        },
                        lineWidth: 2
                    },
                    legend: {
                        enabled: false
                    },
                    tooltip: {
                        headerFormat: "<b>{series.name}</b><br/>",
                        pointFormat: "{point.x} km: {point.y}°C"
                    },
                    plotOptions: {
                        spline: {
                            marker: {
                                enable: false
                            }
                        }
                    },
                    series: [{
                        name: "Temperature",
                        data: [[0, 15], [10, -50], [20, -56.5], [30, -46.5], [40, -22.1],
                            [50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]]
                    }]
                });
            </script>
        </body>
        </html>

海图示例
图表(“容器”{
图表:{
类型:“样条曲线”,
倒过来:是的
},
标题:{
正文:“按高度划分的大气温度”
},
副标题:{
正文:“根据标准大气模式”
},
xAxis:{
相反:错,
标题:{
启用:对,
文字:“高度”
},
标签:{
格式化程序:函数(){
返回此值+公里数;
}
},
最大填充:0.05,
showLastLabel:true
},
亚克斯:{
标题:{
正文:“温度”
},
标签:{
格式化程序:函数(){
返回此参数。值+“°”;
}
},
线宽:2
},
图例:{
已启用:false
},
工具提示:{
headerFormat:“{series.name}
”, pointFormat:“{point.x}km:{point.y}°C” }, 打印选项:{ 样条曲线:{ 标记:{ 启用:false } } }, 系列:[{ 名称:“温度”, 数据:[[0,15],[10,-50],[20,-56.5],[30,-46.5],[40,-22.1], [50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]] }] });
它也给出了一个很好的结果。


如果此代码无法解决您的问题。我怀疑您的本地Intranet安全区域设置需要更改。

当您执行
alert(navigator.userAgent)时,它会说什么?highchart js是否使用websockets?它会像Gecko一样显示“Mozilla/5.0(Windows NT 6.1;WOW64;Trident/7.0;rv:11.0)”。您是否尝试过本地机器锁定注册表设置?不,我还没有尝试,我应该在其中添加MyProgram.exe和MyProgram.vshost.exe吗
        <!DOCTYPE HTML>
        <!-- saved from url=(0016)http://localhost -->
        <html>
        <head>
            <meta http-equiv="x-ua-compatible" content="IE=11">
            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <title>Highcharts Example</title>
            <style type="text/css">
            </style>
        </head>
        <body>
            <script src="https://code.highcharts.com/highcharts.src.js"></script>
            <script src="https://code.highcharts.com/modules/exporting.js"></script>
            <div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div>

            <script type="text/javascript">
                Highcharts.chart("container", {
                    chart: {
                        type: "spline",
                        inverted: true
                    },
                    title: {
                        text: "Atmosphere Temperature by Altitude"
                    },
                    subtitle: {
                        text: "According to the Standard Atmosphere Model"
                    },
                    xAxis: {
                        reversed: false,
                        title: {
                            enabled: true,
                            text: "Altitude"
                        },
                        labels: {
                            formatter: function () {
                                return this.value + "km";
                            }
                        },
                        maxPadding: 0.05,
                        showLastLabel: true
                    },
                    yAxis: {
                        title: {
                            text: "Temperature"
                        },
                        labels: {
                            formatter: function () {
                                return this.value + "°";
                            }
                        },
                        lineWidth: 2
                    },
                    legend: {
                        enabled: false
                    },
                    tooltip: {
                        headerFormat: "<b>{series.name}</b><br/>",
                        pointFormat: "{point.x} km: {point.y}°C"
                    },
                    plotOptions: {
                        spline: {
                            marker: {
                                enable: false
                            }
                        }
                    },
                    series: [{
                        name: "Temperature",
                        data: [[0, 15], [10, -50], [20, -56.5], [30, -46.5], [40, -22.1],
                            [50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]]
                    }]
                });
            </script>
        </body>
        </html>