FusionCharts API-Methods: resizeTo
Created using FusionCharts Suite XT - www.fusioncharts.com
by FusionCharts
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: 'scrollline2d',
dataFormat: 'json',
renderAt: 'chart-container',
width: '450',
height: '250',
dataSource: {
"chart": {
"caption": "Sales Trends",
"subCaption": "(FY 2012 to FY 2013)",
"xAxisName": "Month",
"yAxisName": "Revenue",
"numberPrefix": "$",
"theme": "fint",
"showValues": "0",
"captionFontSize": "13",
"subCaptionFontSize": "12",
"subCaptionFontBold": "0"
},
"categories": [{
"category": [{
"label": "Jan 2012"
}, {
"label": "Feb 2012"
}, {
"label": "Mar 2012"
}, {
"label": "Apr 2012"
}, {
"label": "May 2012"
}, {
"label": "Jun 2012"
}, {
"label": "Jul 2012"
}, {
"label": "Aug 2012"
}, {
"label": "Sep 2012"
}, {
"label": "Oct 2012"
}, {
"label": "Nov 2012"
}, {
"label": "Dec 2012"
}, {
"label": "Jan 2013"
}, {
"label": "Feb 2013"
}, {
"label": "Mar 2013"
}, {
"label": "Apr 2013"
}, {
"label": "May 2013"
}, {
"label": "Jun 2013"
}, {
"label": "Jul 2013"
}, {
"label": "Aug 2013"
},...