app/react/Charts/components/ExtendedTooltip.js
import React from 'react';
import PropTypes from 'prop-types';
const ExtendedTooltip = props => {
if (props.active) {
const dataSetA = props.payload[0];
const dataSetB = props.payload[1];
return (
<div style={{ backgroundColor: '#fff', border: '1px solid #ccc' }}>
<div style={{ backgroundColor: '#eee', borderBottom: '1px dashed #ccc', padding: '5px' }}>
{dataSetA.payload.name}:
<b style={{ color: '#600' }}>{dataSetA.value + dataSetB.value}</b>
</div>
<div style={{ padding: '5px' }}>
{dataSetA.payload.setALabel}: <b style={{ color: '#600' }}>{dataSetA.value}</b>
<br />
{dataSetB.payload.setBLabel}: <b style={{ color: '#600' }}>{dataSetB.value}</b>
</div>
</div>
);
}
return null;
};
ExtendedTooltip.defaultProps = {
payload: [],
active: false,
};
ExtendedTooltip.propTypes = {
payload: PropTypes.arrayOf(PropTypes.object),
active: PropTypes.bool,
};
export default ExtendedTooltip;