Ilm*_*nen 5 javascript jasper-reports highcharts
我正在使用自定义可视化组件和Highcharts 在Jaspersoft Studio 6.4中开发报告.
简而言之,在执行气泡图或面积图时,plotOptions.fillColor -attribute无法正常工作,但将气泡留在内部或堆积区域图表的内部为黑色.黑色通常表示未找到颜色,但区域图中的气泡/线条的线条可以正常工作.
以下是面积图的Highcharts脚本:
define(['jquery_hc','hchart'], function ($, Highcharts) {
return function (instanceData) {
// Creating the chart
var config = {
chart: {
type: 'area',
plotBorderWidth: 1,
renderTo: instanceData.id,
width: instanceData.width,
height: instanceData.height,
marginBottom: 15,
marginLeft: 40,
marginRight: 5,
marginTop: 5
},
title: {
text: ""
},
colors: ['#927453', '#9b672c', '#b0771e', '#e66726', '#474747', '#949494', '#feb40b', '#bd9c31', '#e0b33a'],
xAxis: {
allowDecimals: false,
title: {enabled: false},
labels: {enabled: false},
visible: false
},
legend: {
itemStyle: {"fontSize": 6},
symbolPadding: 4,
symbolHeight: 4,
symbolWidth: 4,
y: 20
},
credits: {enabled: false},
yAxis: {
title: {enabled: false},
labels: {
style: {"fontSize": 6},
formatter: function () {
return this.value;
},
},
tickInterval: 2
},
plotOptions: {
area: {
stacking: 'percent',
animation: false,
marker: {
enabled: false
},
lineWidth: 1
}
},
series: [{
name: 'that',
data: [502, 635, 809, 947, 1402, 3634, 5268]
}, {
name: 'it',
data: [106, 107, 111, 133, 221, 767, 1766]
}, {
name: 'with',
data: [163, 203, 276, 408, 547, 729, 628]
}, {
name: 'who',
data: [18, 31, 54, 156, 339, 818, 1201]
}, {
name: 'how',
data: [2, 2, 2, 6, 13, 30, 46]
}, {
name: 'this',
data: [82, 72, 62, 46, 113, 320, 443]
}, {
name: 'that',
data: [11, 12, 14, 16, 13, 55, 113]
}, {
name: 'those',
data: [7, 1, 3, 11, 15, 37, 49]
}, {
name: 'these',
data: [108, 301, 504, 1056, 3039, 8018, 10201]
}, {
name: 'this too',
data: [10, 30, 50, 105, 303, 801, 1020]
}]
}
new Highcharts.Chart(config);
}
});
Run Code Online (Sandbox Code Playgroud)
而build.js:
({
baseUrl: '',
paths: {
jquery_hc: "../jquery-3.2.1",
hchart: "../highcharts",
'areaChart': 'areaChart'
},
shim: {
'hchart' : {
deps: ["jquery_hc"],
exports: 'Highcharts'
}
},
name: 'areaChart',
out: "areaChart.min.js"
})
Run Code Online (Sandbox Code Playgroud)
高图使用最新的highchart.js和jquery-3.2.1.js.
我尝试添加颜色的几件事情:
并且可能很少有其他基于Highcharts的API参考.
另一方面,有一件事是工作,如果我把plotOptions.fillColor:'#fffffff',所有更改的颜色,这意味着问题主要是每个数据集匹配一种颜色.
一个巨大的问题是,这在JSFiddle(JSFiddle)中是不可重现的.
因此,贾斯珀报告可能是罪魁祸首,但我开始缺乏想法.我发现了一个问题,可能与此有关:(https://
community.jaspersoft.com/jaspersoft-studio/issues/8641),但我无法通过此设置做很多事情.我的Web应用程序使用jasper引擎生成报告,问题也出现在那里.
StackOverflow的员工,Highcharts的员工和Jaspersoft的员工,结合您的知识并帮助我解决这个问题!
最后,生成报告的Jasper Report工作室图片:
在查看代码后,我发现当我们以HTML格式看到报告时,报告正常工作,但pdf格式无法正常工作.由于我们知道CVC组件利用phantmjs下载报告然后我试图搜索与phantomjs和highcharts相关的问题,但无法找到任何东西.
然后我尝试查看plotOption属性并将以下plotOption添加到您的代码中.
plotOptions: {
series: {
animation: false,
stacking: 'percent',
lineWidth: 1,
fillColor: null,
fillOpacity: 1, // this is default to 0.75
marker: {
enabled: false
}
}
},
Run Code Online (Sandbox Code Playgroud)
然后它也开始以PDF格式显示结果.所以主要的罪魁祸首是fillOpacity如果你把它设置为1那么你的问题就会得到解决.
注意:如果使用fillOpacity而不是1,那么它不会显示结果.
您还可以指定颜色,填充颜色和不透明度,如下所示.
series: [{
name: 'that',
data: [502, 635, 809, 947, 1402, 3634, 5268],
fillColor:'red', // use this color light as compared to color
fillOpacity: 1,
color: 'white' // use this color dark as compared to fillcolor
},
...
...
...
,{
name: 'this too',
data: [10, 30, 50, 105, 303, 801, 1020],
fillColor:'#00ff00',
fillOpacity: 1,
color: 'orange'
}]
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
234 次 |
最近记录: |