FusionCharts API-Methods: resizeTo

Created using FusionCharts Suite XT - www.fusioncharts.com

by Aniruddha Galgali

HTML

<script src="https://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="https://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js"></script>
<!-- This sample shows the usage of the resizeTo() method -->
<div id="indicatorDiv">Method Name: <strong>resizeTo()</strong>
    <p>Resizes the chart to the specified width and height.To read more about this method, click <a href="http://www.fusioncharts.com/dev/api/fusioncharts/fusioncharts-methods.html#resizeTo" target="_blank">here</a>.</p>
    <p>For the scroll line 2D chart shown below, enter the required width and height in their respective textboxes. When the <strong>Resize Chart</strong> button is clicked, the chart is resized according to the specified dimensions.</p>
    <p><strong>Note</strong>: For this implementation, you will have to specify <strong>both</strong>, the height and the width, to resize the chart.</p>


    <div class="text-center">
    	<div id="data">
    	<div id="msg"></div>
    	    <strong>Specify Dimensions To Resize</strong>    
    	    
    	    <label id="label">Height:
    	        <input type="text" id="height" />
    	    </label>
    	    <label id="label">Width:
    	        <input type="text" id="width" />
    	    </label>        
    	    
    	    <button id="resize" class="mb-20">Resize The Chart</button>
    	</div>
    	
    	<div id="chart-container">FusionCharts will render here</div>
    	<div id="data2"></div>
    </div>
</div>

CSS

body {
    padding: 5px;
    margin: 0 auto;
}
strong{
  font-weight: bold;
}

.text-center {
  text-align: center;
}

p {
  margin: 10px auto;
}

.mb-20 {
  margin-bottom: 20px;
}
#indicatorDiv {
    width: 500px;
    font-family:'Arial', 'Helvetica';
    font-size: 13px;
}
.err {
    color:red;
}
#data {
    font-family:'Arial', 'Helvetica';
    font-size: 12px;
}
#label {
    font-family:'Arial', 'Helvetica';
    font-size: 12px;
    display: block;
    margin: 10px;
}
#resize {
    font-family:'Arial', 'Helvetica';
    font-size: 12px;
    padding: 10px;
}

JavaScript

FusionCharts.ready(function () {
    var salesChart = new FusionCharts({
        type: 'gantt',
        dataFormat: 'json',
        renderAt: 'chart-container',
        width: '1100',
        height: '500',
        dataSource: {
    chart: {
      theme: "fusion",
      dateformat: "mm/dd/yyyy",
      caption: "Timeline",
      subcaption: "Project Plan",
      chartbottomMargin: "90",
      showLabel: "0",
      milestoneFontBold: "1",
      tooltipPosition: "bottom",
      toolTipBorderColor: "000000",
      plottooltext: "$processName{br} $label starting date $start{br}$label ending date $end",
      animation: 1,
      forceRowHeight: 1
    },
    categories: [
      {
        category: [
          {
            start: "06/01/2022",
            end: "06/30/2022",
            label: "Jun 2022"
          },
          {
            start: "07/01/2022",
            end: "07/31/2022",
            label: "Jul 2022"
          },
          {
            start: "08/01/2022",
            end: "08/31/2022",
            label: "Aug 2022"
          },
          {
            start: "09/01/2022",
            end: "09/30/2022",
            label: "Sep 2022"
          },
          {
            start: "10/01/2022",
            end: "10/31/2022",
            label: "Oct 2022"
          },
          {
            start: "11/01/2022",
            end: "11/30/2022",
            label: "Nov 2022"
          },
          {
            start: "12/01/2022",
            end: "12/31/2022",
            label: "Dec 2022"
          },
          {
            start: "01/01/2023",
            end: "01/31/2023",
            label: "Jan 2023"
          },
          {
            start: "02/01/2023",
            end: "02/28/2023",
            label: "Feb 2023"
          },
          {
            start: "03/01/2023",
            end: "03/31/2023",
            label: "Mar 2023"
          }
          
        ]
      }
    ],
    processes: {
      fontsize: "12",
      isbold: "1",
      align:...