/** @format */ /** * External dependencies */ import classNames from 'classnames'; import { Component } from '@wordpress/element'; import PropTypes from 'prop-types'; import { scaleOrdinal as d3ScaleOrdinal } from 'd3-scale'; import { interpolateViridis as d3InterpolateViridis } from 'd3-scale-chromatic'; import { range as d3Range } from 'd3-array'; /** * Internal dependencies */ import './style.scss'; import { formatCurrency } from 'lib/currency'; class Legend extends Component { render() { const { data, handleLegendHover, handleLegendToggle, legendDirection } = this.props; const d3Color = d3ScaleOrdinal().range( d3Range( 0, 1.1, 100 / ( data.length - 1 ) / 100 ) ); return (