Hide or show data labels on the chart
Options
by Flexmonster Pivot Table
HTML
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>
<button onclick="toggleDataLabels(false)">Hide data labels</button>
<button onclick="toggleDataLabels(true)">Show data labels</button>
<div id="pivot-container">The component will appear here</div>
CSS
@import url(https://cdn.flexmonster.com/assets/jsfiddle-styles.css);
JavaScript
let pivot = new Flexmonster({
container: "pivot-container",
componentFolder: "https://cdn.flexmonster.com/",
toolbar: true,
report: {
dataSource: {
filename: "data/data.csv"
},
slice: {
rows: [{
uniqueName: "Color"
}],
columns: [{
uniqueName: "[Measures]"
}],
measures: [{
uniqueName: "Price",
format: "33gcyh6i"
}]
},
options: {
viewType: "charts",
chart: {
type: "bar_h",
showDataLabels: true
}
},
formats: [{
name: "33gcyh6i",
currencySymbol: "$"
}]
}
});
function toggleDataLabels(state) {
pivot.setOptions({
chart: {
showDataLabels: state
}
});
pivot.refresh();
}