villebro commented on a change in pull request #7951: [feat] Add d3 legend
formatting for Arc, Polygon and Scatter deck.gl maps
URL:
https://github.com/apache/incubator-superset/pull/7951#discussion_r309716378
##########
File path: superset/assets/src/visualizations/Legend.jsx
##########
@@ -18,24 +18,52 @@
*/
import React from 'react';
import PropTypes from 'prop-types';
+import { format } from 'd3-format';
import './Legend.css';
+const categoryDelimiter = ' - ';
+
const propTypes = {
categories: PropTypes.object,
toggleCategory: PropTypes.func,
showSingleCategory: PropTypes.func,
+ format: PropTypes.string,
position: PropTypes.oneOf([null, 'tl', 'tr', 'bl', 'br']),
};
const defaultProps = {
categories: {},
toggleCategory: () => {},
showSingleCategory: () => {},
+ format: null,
position: 'tr',
};
export default class Legend extends React.PureComponent {
+ format(value) {
+ if (!this.props.format) {
+ return value;
+ }
+
+ const numValue = parseFloat(value);
+ return format(this.props.format)(numValue);
+
+ }
+
+ formatCatregoryLabel(k) {
Review comment:
Typo
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]