我实现了一个小部件专业版(在Jaspersoft Studio Professional 6.1中),特别是一个甘特图,它基本上列出了公司中运行的所有项目。数据是正确的,图表按预期工作,但我似乎无法找到一种方法来动态调整图表对象的大小,根据"项目",例如,现在我有5个项目和甘特图看起来很好w = 802px h = 183px。但是,如果我有10个项目,该组件不会调整大小,这意味着它不会"增长"在适合新项目的高度中,女巫会导致无法理解的图表。
是否可以根据我将显示的项目数自动调整组件大小,可能会增长到报告的另一页?
我需要实施哪些步骤,类等才能使其正常工作?此组件没有自定义程序类选项。
这有可能吗?
感谢您的帮助:)
答案 0 :(得分:4)
@Synamoon!我从你的问题陈述中了解到,当有大量数据时,你的甘特图变得笨拙。图表大小是固定的,并且不会根据其数据内容自行调整大小,但是,可以使用API更改图表大小 -
yourChartObj.resizeTo(width, height);
但在你的情况下,我建议你使用FusionCharts甘特图的滚动功能来解决你的问题。
以下是具有滚动功能的甘特图的示例 -
FusionCharts.ready(function () {
var smoPlan = new FusionCharts({
type: 'gantt',
renderAt: 'chart-container',
width: '650',
height: '300',
dataFormat: 'json',
dataSource: {
"chart": {
"dateformat": "mm/dd/yyyy",
"caption": "Project Gantt",
"subcaption": "From 1st Feb 2007 - 31st Aug 2007",
"ganttpaneduration": "3",
"ganttpanedurationunit": "m",
"showborder": "0"
},
"categories": [
{
"category": [
{
"start": "02/01/2007",
"end": "04/01/2007",
"label": "Q1"
},
{
"start": "04/01/2007",
"end": "07/01/2007",
"label": "Q2"
},
{
"start": "07/01/2007",
"end": "09/01/2007",
"label": "Q3"
}
]
},
{
"category": [
{
"start": "02/01/2007",
"end": "03/01/2007",
"label": "Feb"
},
{
"start": "03/01/2007",
"end": "04/01/2007",
"label": "Mar"
},
{
"start": "04/01/2007",
"end": "05/01/2007",
"label": "Apr"
},
{
"start": "05/01/2007",
"end": "06/01/2007",
"label": "May"
},
{
"start": "06/01/2007",
"end": "07/01/2007",
"label": "Jun"
},
{
"start": "07/01/2007",
"end": "08/01/2007",
"label": "Jul"
},
{
"start": "08/01/2007",
"end": "09/01/2007",
"label": "Aug"
}
]
}
],
"processes": {
"fontsize": "12",
"isbold": "1",
"align": "right",
"headertext": "What to do?",
"headerfontsize": "18",
"headervalign": "bottom",
"headeralign": "right",
"process": [
{
"label": "Identify Customers"
},
{
"label": "Survey 50 Customers"
},
{
"label": "Interpret Requirements"
},
{
"label": "Study Competition"
},
{
"label": "Documentation of features"
},
{
"label": "Brainstorm concepts"
},
{
"label": "Design & Code"
},
{
"label": "Testing / QA"
},
{
"label": "Documentation of product"
},
{
"label": "Global Release"
}
]
},
"datatable": {
"headervalign": "bottom",
"datacolumn": [
{
"headertext": "Who does?",
"headerfontsize": "18",
"headervalign": "bottom",
"headeralign": "right",
"align": "left",
"fontsize": "12",
"text": [
{
"label": "John"
},
{
"label": "David"
},
{
"label": "Mary"
},
{
"label": "Andrew"
},
{
"label": "Tiger"
},
{
"label": "Sharon"
},
{
"label": "Neil"
},
{
"label": "Harry"
},
{
"label": "Chris"
},
{
"label": "Richard"
}
]
}
]
},
"tasks": {
"task": [
{
"start": "02/04/2007",
"end": "02/10/2007"
},
{
"start": "02/08/2007",
"end": "02/19/2007"
},
{
"start": "02/19/2007",
"end": "03/02/2007"
},
{
"start": "02/24/2007",
"end": "03/02/2007"
},
{
"start": "03/02/2007",
"end": "03/21/2007"
},
{
"start": "03/21/2007",
"end": "04/06/2007"
},
{
"start": "04/06/2007",
"end": "07/21/2007"
},
{
"start": "07/21/2007",
"end": "08/19/2007"
},
{
"start": "07/28/2007",
"end": "08/24/2007"
},
{
"start": "08/24/2007",
"end": "08/27/2007"
}
]
}
}
}).render();
});

<script src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<div id="chart-container">FusionCharts will render here</div>
&#13;
您可以详细了解here中的甘特图属性和设置,以及here中的各种甘特图实施。
如果您有任何其他问题,请与我们联系。
谢谢!