amaannawab923 commented on PR #33559:
URL: https://github.com/apache/superset/pull/33559#issuecomment-2902281488
> This is awesome, @amaannawab923, but I'm a bit confused by a couple things.
>
> First, for the current behavior you say that "all metric values using a
common 0-to-max scale". But we can see from the results tab that **we only have
a single value for each metric**. There is no max nor min, so how do we
determine where in the radial axis we should place the metric?
>
> Second, to me the original behavior you describe is what I'd call
"normalized". Since these are different metrics, if we're showing them relative
to some computed value so that two different metrics with widely different
ranges appear to have similar values, then they're are normalized. On the other
hand, if we want to make sure that a metric with a high range is shown as
bigger value than one that has a small range (like the new behavior), I'd call
that "denormalized".
1.Hey @betodealmeida , great question — here’s how the Radar Chart handles
max values in the non-normalized mode when no explicit max is provided:
const maxValueInControl = columnConfig?.[metricLabel]?.radarMetricMaxValue;
const minValueInControl = columnConfig?.[metricLabel]?.radarMetricMinValue;
// Ensure that 0 is at the center of the polar coordinates
const metricValueAsMax =
metricLabelAndMaxValueMap.get(metricLabel) === 0
? Number.MAX_SAFE_INTEGER
: metricLabelAndMaxValueMap.get(metricLabel);
const max =
maxValueInControl === null
? metricValueAsMax
: maxValueInControl;
💡 What’s happening here:
If the user does not manually configure a max (radarMetricMaxValue is null
or undefined), we fallback to the actual metric value returned from the query.
That value is treated as the max for that metric.
This means the data point will appear at the outer edge of the radial axis
(since it lies at its own max).
If the value is 0, we use Number.MAX_SAFE_INTEGER to avoid dividing by zero
and ensure the chart renders safely.
This is the old function where we are calculating the min & max but usually
the max defaults to the value of metric itself hence metric goes onto stretch
to the end of the Chart
2. Thanks for the thoughtful feedback! Just to clarify, by "normalized" we
mean rescaling each series’ values to a [0, 1] range, based on the max in that
series. This ensures fair visual comparison between metrics with very different
scales.
The original behavior plotted raw values, which can mislead when metrics
vary significantly in magnitude (e.g., 208k vs. 2.5k).
This is common term in data science that normalizing meaning scaling back to
0 to 1 ... Since the values on screen will still refer to the original values
in Tooltip & labels , i thought it would be intuitive to the end clients who
can be usually data engineers or data analyst to communicate easily , that hey
this control will rescale your values back to scale of 0 to 1
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]