You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/08/01 14:09:18 UTC
[GitHub] [incubator-superset] villebro commented on a change in pull request
#7951: [feat] Add d3 legend formatting for Arc,
Polygon and Scatter deck.gl maps
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org