-
Notifications
You must be signed in to change notification settings - Fork 77
Fix D3 format for some viz types #171
base: master
Are you sure you want to change the base?
Conversation
modified: packages/superset-ui-legacy-preset-chart-big-number/src/BigNumber/transformProps.js modified: packages/superset-ui-legacy-preset-chart-nvd3/src/transformProps.js JIRA: SUP-146
There were the following issues with this Pull Request
You may need to change the commit messages to comply with the repository contributing guidelines. 🤖 This comment was generated by commitlint[bot]. Please report issues here. Happy coding! |
@@ -82,7 +82,18 @@ export default function transformProps(chartProps) { | |||
className = 'negative'; | |||
} | |||
|
|||
const formatValue = getNumberFormatter(yAxisFormat); | |||
// SUP-146 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove comment
// SUP-146 | ||
let metricFormat = yAxisFormat; | ||
if (!yAxisFormat) { | ||
for (let x = 0; x < chartProps.datasource.metrics.length; x++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to check if datasource
exists and metrics
exist
if (!yAxisFormat) { | ||
for (let x = 0; x < chartProps.datasource.metrics.length; x++) { | ||
if (chartProps.datasource.metrics[x].metric_name == metric) { | ||
metricFormat = chartProps.datasource.metrics[x].d3format; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d3format may be not set
let d3YAxis2Format; | ||
if (chartProps.formData.vizType == "pie") { | ||
for (let x = 0; x < chartProps.datasource.metrics.length; x++) { | ||
if (chartProps.datasource.metrics[x].metric_name == chartProps.formData.metric) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the logic here can be extracted into a function?
Picked up the ball on this over here: |
…rset#171) * feat: add parseLength function * feat: export * fix: address Kim's comment
Some viz types don't honor the predefined D3 formats users enter for metrics. This change fixes this for a handful of viz types.