Using ChartJS is it possible to force the chart to display X Axis labels for each dataset? Below my attempt at reproducing waterfall chart using chart js library. As you can see there are no labels for each of the bars on the datasets. Is it possible to turn them on?
var ctx = document.getElementById("myChart").getContext('2d');
const dat = {
datasets: [
{
label: 'Purchase Price',
data: [750],
backgroundColor: '#d29baf',
stack: 'stack 1',
},
{
data: [200],
waterfall: {
dummyStack: true,
},
stack: 'stack 2',
},
{
label: 'Opening Loan Balance',
data: [550],
backgroundColor: '#bb6987',
stack: 'stack 2',
},
{
label: 'Initial Cash Investment',
data: [200],
backgroundColor: '#a53860',
stack: 'stack 3',
},
],
};
var chart = new Chart(ctx, {
type:'bar',
plugins: [chartjsPluginWaterfall],
data: dat
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.11/lodash.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/chartjs-plugin-waterfall.min.js"></script>
<div>
<canvas id="myChart"></canvas>
</div>