2

I'm implementing a widget pro chart (in Jaspersoft Studio Professional 6.1), specifically a gantt chart, that basically lists all the projects that are running in the company. The data is correct and the charts works as expected, but i cant seem to find a way to dynamically resize the chart object according to the number of "projects", for example, now i have 5 projects and the gantt looks fine with w=802px h=183px. But if i have 10 projects the component does not resize, meaning it does not "grow" in its height to fit the new projects witch leads to an unreadable chart.

Is it possible to automatically resize the component according to the number of projects i will display, potentially growing to another page of the report?

What steps, classes, etc do i need to implement to get this to work properly? There is no customizer class option for this component.

Is this possible at all?

Thank you for the help :)

Alex K
  • 22,315
  • 19
  • 108
  • 236
Synamoon
  • 41
  • 7

1 Answers1

4

@Synamoon! What I have understood from your problem statement that your Gantt chart becomes clumsy when there is a large amount of data. The chart size is fixed and it does not resize itself according to it's data content but however, the chart size can be changed using API -

yourChartObj.resizeTo(width, height);

But in your case I would suggest you to use the scroll feature of Gantt chart of FusionCharts which will solve your problem.

Here is an example of Gantt chart having scrolling feature -

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>

You can explore more about Gantt chart attributes and settings from here and various Gantt chart implementations from here.

Please let me know if you have any further concerns.

Thank You!

Arnab003
  • 345
  • 1
  • 11
  • Thank you for your response Arnab003, i'll test this as soon as i have a more stable report. Right now i'm having a bit of trouble in another issue with the gantt chart due to the task grouping feature. – Synamoon Oct 17 '16 at 17:10
  • Sure! Feel free to share your issues... Thank you! :) – Arnab003 Oct 17 '16 at 17:43