react-jsx-highcharts
Version:
Highcharts charts built using React components
22 lines • 476 B
JavaScript
import { memo } from 'react';
import useChartUpdate from '../UseChartUpdate';
const Legend = /*#__PURE__*/memo(({
children = null,
enabled = true,
...restProps
}) => {
useChartUpdate({
enabled,
...restProps
}, updateLegend, chart => updateLegend(chart, {
enabled: false
}), false);
return children;
});
const updateLegend = (chart, config) => {
chart.update({
legend: config
}, false);
};
Legend.displayName = 'Legend';
export default Legend;