Set constant number of y axisvalues on resize
Created using FusionCharts Suite XT - www.fusioncharts.com
by Nabajeet Sonowal
HTML
<script src="http://static.fusioncharts.com/code/latest/fusioncharts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/fusioncharts.charts.js"></script>
<script src="http://static.fusioncharts.com/code/latest/themes/fusioncharts.theme.fint.js"></script>
<!--Changing the chart size dynamically through FusionCharts API (resizeTo method) -->
<div id="chart-container">FusionCharts will render here</div>
<div id='controllers'>
<input id='change' class='resizebtn' type='Button' value='Min' />
<input id='changeL' class='resizebtn' type='Button' value='Max' />
</div>
CSS
input[type=text] {
max-width: 50px;
font-family: Verdana, sans;
font-size: 13px;
font-style: normal;
font-weight: normal;
}
#controllers {
position: inherit;
left: 10px;
font-family: Verdana, sans;
font-size: 13px;
font-style: normal;
font-weight: bold;
}
.resizebtn {
font-family: Verdana, sans;
font-size: 14px;
font-style: normal;
}
JavaScript
FusionCharts.ready(function () {
var iniWidth = 200,
iniHeight = 150,
changeBtn = document.getElementById('change'),
changeBtnL = document.getElementById('changeL'),
setDimensionOnClick = function () {
revenueChart.resizeTo(200, 150);
},
setDimensionOnClickL = function () {
revenueChart.resizeTo(500, 300);
},
revenueChart = new FusionCharts({
type: 'column2d',
renderAt: 'chart-container',
width: iniWidth,
height: iniHeight,
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Monthly revenue",
"subCaption": "Last year",
"xAxisName": "Month",
"yAxisName": "Amount ($)",
"numberPrefix": "$",
"theme": "fint",
"numDivLines":"2"
},
"data": [
{
"label": "Jan",
"value": "420000"
},
{
"label": "Feb",
"value": "810000"
},
{
"label": "Mar",
"value": "720000"
},
{
"label": "Apr",
"value": "550000"
},
{
"label": "May",
"value": "910000"
},
{
"label": "Jun",
"value": "510000"
},
{
"label": "Jul",
"value": "680000"
},
{
"label": "Aug",
...