JSFiddle - React, Tailwind, and code Playground
by Vince
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn3.devexpress.com/jslib/23.1.6/js/dx.all.js"></script>
<div class="dx-viewport demo-container">
<div id="chart"></div>
</div>
CSS
#chart {
height: 90vh;
}
.state-tooltip > h4 {
/* margin-bottom: 5px;
line-height: 40px;*/
font-size: 14px;
}
.state-tooltip {
}
.state-tooltip > img {
height: 175px;
width: 316px;
margin: 0 5px 0 0;
float: left;
border: 1px solid rgba(191, 191, 191, 0.25);
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.state-tooltip .caption {
font-weight: 500;
}
.state-tooltip sup {
font-size: 0.8em;
vertical-align: super;
line-height: 0;
}
JavaScript
$(() => {
$('#chart').dxChart({
dataSource,
commonSeriesSettings: {
argumentField: 'Series',
type: 'bar',
cornerRadius: 5
},
palette: commitmentSummaryPalette,
series: [
{ valueField: 'Committed', name: 'Unfunded',barOverlapGroup: 'Series', label: {visible: true, position: 'outside', backgroundColor: '#002152', customizeText: function(e) { return USDollar.format(e.point.data.Committed); } } },
{ valueField: 'Called', name: 'Cumulative Called',barOverlapGroup: 'Series' },
{ valueField: 'Distributed', name: 'Cumulative Distributions',barOverlapGroup: 'Series',barPadding: 0.3, },
{ valueField: 'Committed', name: 'Commitment', showInLegend: true, visible: false }
],
legend: {
horizontalAlignment: 'center',
verticalAlignment: 'top',
position: 'outside',
itemTextPosition: 'right',
border: { visible: true, cornerRadius: 5 },
margin: {bottom: 30 }
},
rotated: true,
tooltip: {
enabled: true,
contentTemplate(info, container) {
const contentItems = [`<div class='state-tooltip'><img src='//web.cdn.crystalfunds.com/public-web/pages/list-of-hedge-funds/images/firm-by-id/logo-${info.point.data.ShopId}-card.png' />`,
"<h4 class='exposure cs-card-ui__title'></h4>",
"<div class='commitment'><span class='caption'>Commitment</span>: </div>",
"<div class='called'><span class='caption'>Cumulative Called</span>: </div>",
`<div class='unfunded'><span class='caption'>Unfunded</span>: </div>`,
`<div class='distributed'><span class='caption'>Cumulative Distributions</span>: </div>`,
`${info.point.data.HasRecallable ? '<br/>* - Recallable Distributions are included in the Unfunded amount' : ''}`,
'</div>'];
let unfundedValue = USDollar.format(info.point.data.Unfunded)
if(info.point.data.HasRecallable)
unfundedValue+=...