在我的项目中,我使用带有3D Highchart的Primefaces尝试显示结果。那时我在浏览器中遇到错误是a.graphic.out.add(c)类型未定义Highchart-3d.js.Highchart-2d中的行号750支持,但3d不支持。
在xhtml pagegenerate3DPieChartReport中传递值('piechartID',“maths,50:science,50);
chart.js之
function generate3DPieChartReport(pieChartContainerDivId, chartData, report)
{
pieChartContainerId = pieChartContainerDivId;
pieChartData = chartData;
percentageSymbol = "";
pieChartReport = report;
create3DPieChart();
}
function create3DPieChart()
{
var units = {
title: ''
};
var optionsPie = {
chart: {
renderTo: pieChartContainerId,
defaultSeriesType: 'pie',
backgroundColor:'none',
options3d: {
enabled: true,
alpha: 65
}
},
title: {
text: ''
},
tooltip: {
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.y + ' ' + units.title;
}
},
plotOptions: {
pie: {
innerSize: 55,
depth: 25,
allowPointSelect: true,
cursor: 'pointer',
events: {
click: function(e) {
showDetails(e);
}
},
dataLabels: {
enabled: true,
formatter: function() {
return '<b>' + this.point.name + '</b>: ' + this.y + percentageSymbol;
}
}
}
},
series: []
};
Highcharts.setOptions({
colors: ['#058DC7', '#50B432', '#ED561B', '#DDDF00', '#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4']
});
var seriesPie = {
data: []
};
var seriesPieItem = new Array();
var chartSliceTokens = pieChartData.split(":");
for (var i = 0; i < chartSliceTokens.length; i++)
{
var sliceValue = chartSliceTokens[i];
var sliceIndivdualToken = sliceValue.split(",");
var sliceName = "";
var sliceVal = "";
seriesPieItem = new Array();
for (var j = 0; j < sliceIndivdualToken.length; j++)
{
if (j == 0)
{
sliceName = sliceIndivdualToken[j];
}
if (j == 1)
{
sliceVal = sliceIndivdualToken[j];
}
if (sliceName != "" && sliceVal != "")
{
seriesPieItem.push(sliceName);
seriesPieItem.push(parseFloat(sliceVal));
seriesPie.data.push(seriesPieItem);
}
}
}
optionsPie.series.push(seriesPie);
chart = new Highcharts.Chart(optionsPie);
}