Enable or disable the auto-range feature in charts
Options
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick='enableAR()'>Enable autoRange</button>
<button onclick='disableAR()'>Disable autoRange</button>
<div id="pivotContainer"></div>
CSS
@import url(https://cdn.flexmonster.com/assets/jsfiddle-styles.css);
JavaScript
var pivot = new Flexmonster({
container: "pivotContainer",
componentFolder: "https://cdn.flexmonster.com/",
width: "100%",
height: 700,
toolbar: true,
report: {
dataSource: {
data: [{
"Category": "Shirts",
"Amount": 150
},
{
"Category": "Hats",
"Amount": 134,
},
{
"Category": "Coats",
"Amount": 201
},
]
},
options: {
viewType: 'charts',
chart: {
autoRange: false
}
}
},
});
function enableAR() {
let newOptions = pivot.getOptions();
newOptions.chart.autoRange = true;
pivot.setOptions(newOptions);
pivot.refresh();
}
function disableAR() {
let newOptions = pivot.getOptions();
newOptions.chart.autoRange = false;
pivot.setOptions(newOptions);
pivot.refresh();
}