-
Notifications
You must be signed in to change notification settings - Fork 272
feat(plugin-chart-echarts): [wip] gauge chart enhancements and fixes #1070
feat(plugin-chart-echarts): [wip] gauge chart enhancements and fixes #1070
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/superset/superset-ui/EGkJ6kzbWtJZCpE9UyXfcwZPzH9t |
1c03268
to
6ca7ec0
Compare
6ca7ec0
to
45651de
Compare
7702f8e
to
d8e7ab7
Compare
d8e7ab7
to
cb41051
Compare
cb41051
to
b1feb2c
Compare
Codecov Report
@@ Coverage Diff @@
## master #1070 +/- ##
=======================================
Coverage 28.74% 28.75%
=======================================
Files 455 455
Lines 9135 9144 +9
Branches 1436 1438 +2
=======================================
+ Hits 2626 2629 +3
- Misses 6306 6310 +4
- Partials 203 205 +2
Continue to review full report at Codecov.
|
@krsnik93 many thanks for the PR! is it ready to turn draft to open? |
@@ -127,7 +127,15 @@ export default function transformProps(chartProps: ChartProps) { | |||
fontSize: FONT_SIZE_MULTIPLIERS.detailFontSize * fontSize, | |||
}, | |||
})); | |||
|
|||
const min = minVal || calculateMin(transformedData); |
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.
Should we use ??
to replace ||
?I'm not sure if it needs to be recalculated only when minVal
is null
instead of 0
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.
I was not aware of the ??
operator. Exactly what is needed here. Thanks a lot!
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.
It's ok :). ??
is called Nullish Coalescing which just for the case of null
and undefined
values. Here, if we use the ||
operator, it will also be calculated when the value of minVal is 0
, which is actually unnecessary.So it may be better to use nullish coalescing.
@@ -70,6 +71,12 @@ const setIntervalBoundsAndColors = ( | |||
const calculateAxisLineWidth = (data: DataRecord[], fontSize: number, overlap: boolean): number => | |||
overlap ? fontSize : data.length * fontSize; | |||
|
|||
const calculateMin = (data: GaugeDataItemOption[]) => | |||
2 * Math.min(...data.map(d => d.value as number).concat([0])); |
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.
Why here must be 2
?
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.
It does not have to be, I was looking at how other BI tools do this and came up with 2
. We could have 1.5
, 1.2
or similar. The point is to ensure that the max value fits into the chart, but that there is a bit of additional "space" left on the gauge.
33291ba
to
152cefc
Compare
@krsnik93 thanks for addressing the comments. can we have one line description on each commit please 😇 |
65cebcc
to
465d501
Compare
Add a hover tooltip per pointer on gauge chart showing metric names and values
…rt axis Dynamically determine min and max values on the axis from query result unless params explicitly passed through form data
465d501
to
40284a2
Compare
The codebase on this repo has been moved to the main Apache Superset repo, and consequently the repo is in the process of being archived. See the Superset Improvement Proposal for details: apache/superset#13013 . While all currently open issues and PRs will be closed, we encourage you to reopen this PR on the main repo, which should be as simple as moving over any code changes as follows:
If you need help with the migration, please post a message on the SIP or reach out on the community Slack. |
🏆 Enhancements
This PR addresses feature requests and bugs raised here: apache/superset#14209