gpt4 book ai didi

java - Highcharts 未显示在 jEditorPane 中

转载 作者:行者123 更新时间:2023-12-01 12:45:58 25 4
gpt4 key购买 nike

我的 Highchart 在 Chrome 中显示正常,但是当我尝试在 Internet Explorer 中打开它时,仅显示标题和 css 边框。我的主要问题是,当我尝试在 java 应用程序的 jEditorPane 中显示它时,它没有显示;它只显示边框。我可以在 jEditorPane 中显示简单的 HTML 页面,但我猜这与 javascript/jquery 有关?

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Chart Title</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
<link href='http://fonts.googleapis.com/css?family=Oswald:400' rel='stylesheet' type='text/css'>
<script type="text/javascript">
$(function () {
Highcharts.setOptions({
colors: ['#1a1334','#26294a','#01545a','#017351','#03c383','#aad962','#fbbf45','#ef6a32','#ed0345','#a12a5e','#710162','#110141']
});
var chart;
$(document).ready(function () {
$('#container').highcharts({
chart: {
type: 'pie',
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false,
backgroundColor: '#f5f5f5'
},
title: {
text: 'Chart Title',
style: {
fontSize: '35px',
fontWeight: 'bold',
fontFamily: 'Oswald'
}
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<b>{point.y}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black',
fontSize: '15px'
}
},
showInLegend: true
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
y: 75,
backgroundColor: '#e4e4e4',
borderRadius: '5px',
itemStyle: {
fontSize: '15px',
fontWeight: 'light'
}
},
credits: {
enabled: false
},
series: [{
name: 'Chart Title',
innerSize: '40%',
data: [
['Work',11],
['Eat',2],
['Commute',2],
['Watch TV',2],
['Sleep',7],
['Other', 30],
['New', 45],
['Extra', 56], ]
}]
});
});
});
</script>
</head>
<body>
<div id="container" style="width: 945px; height: 525px; border-color: #333; border-style: solid; border-width: 10px 5px 5px 10px;"></div>
</body>
</html>

jEditorPane 代码:

jEditorPane1.setEditable(false);
try {
jEditorPane1.setPage(getClass().getResource("html/pie.html"));
} catch (IOException e) {
System.out.println(e);
}

大多数 Highcharts 不显示的解决方案都涉及脚本的顺序,但我很确定这不是我的问题。

有什么想法吗?

最佳答案

尝试使用 JavaFX 中的 WebView。

http://docs.oracle.com/javafx/2/webview/jfxpub-webview.htm

IIRC 它基于 Webkit,应该能够正确渲染 Highcharts

关于java - Highcharts 未显示在 jEditorPane 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24706947/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com