Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#551 Expose a metric control #1272

Merged
merged 30 commits into from
May 22, 2024

Conversation

namnguyen20999
Copy link
Contributor

@namnguyen20999 namnguyen20999 commented May 7, 2024

551

Introduces the "metric" element to the project, facilitating synthetic data representation with customizable controls. Key properties include:

  • value: Numerical and mandatory (dynamic).
  • type: Static property with "none", "linear", and "circular" as valid values. Default: "circular".
  • min: Static numerical property defaulting to 0.
  • max: Static numerical property defaulting to 100.
  • delta: Dynamic numerical property with default None (no display).
  • threshold: Dynamic numerical property with default None (implying gauge).

This addition enhances data visualization capabilities, providing adaptability and precision.

image

Adding pytest cases for Metric.tsx components
@namnguyen20999 namnguyen20999 added 🖰 GUI Related to GUI ✨New feature 🔒 Staff only Can only be assigned to the Taipy R&D team labels May 7, 2024
@namnguyen20999 namnguyen20999 added this to the Community 3.2 milestone May 7, 2024
@namnguyen20999 namnguyen20999 self-assigned this May 7, 2024
Copy link
Contributor

github-actions bot commented May 7, 2024

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
18311 16047 88% 0% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
taipy/gui/_renderers/factory.py 96% 🟢
TOTAL 96% 🟢

updated for commit: af4dd42 by action🐍

Copy link
Member

@FredLL-Avaiga FredLL-Avaiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A very good first PR
Needs a few changes but everything is there

taipy/gui/_renderers/factory.py Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
@FredLL-Avaiga FredLL-Avaiga added 🟥 Priority: Critical Must be addressed as soon as possible 📝Release Notes Impacts the Release Notes labels May 7, 2024
Copy link
Contributor

github-actions bot commented May 9, 2024

Coverage report for frontend/taipy-gui

Branches coverage not met for global: expected >=80%, but got 62.623951182303585%

St.
Category Percentage Covered / Total
🟢 Statements
81.17% (+0.14% 🔼)
2587/3187
🟡 Branches
62.62% (-0.68% 🔻)
1642/2622
🟡 Functions
74.21% (+0.06% 🔼)
446/601
🟢 Lines
81.74% (+0.12% 🔼)
2413/2952
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / Dialog.tsx
80.43% 60.87% 100% 80.43%
🟡
... / TaipyRendered.tsx
64.58% 14.29% 50% 64.58%
🟡
... / index.ts
75% 26.67% 50% 74.47%
🟢
... / Expandable.tsx
100% 85% 100% 100%
🟢
... / Metric.tsx
100% 68.18% 100% 100%
🟢
... / PageContent.tsx
75% 100% 0% 100%
🟢
... / Pane.tsx
95.12% 73.81% 100% 94.87%
🟢
... / Part.tsx
88% 64.29% 75% 91.3%
🟡
... / Unregistered.tsx
62.5% 0% 0% 60%

Test suite run success

368 tests passing in 39 suites.

Report generated by 🧪jest coverage report action from af4dd42

@FredLL-Avaiga FredLL-Avaiga self-requested a review May 13, 2024 08:31
@jrobinAV
Copy link
Member

jrobinAV commented May 14, 2024

I love the description you provided 😉 .
It helps both the reviewers to accelerate the review and the community to understand what will be in the next release.

Thx!

Copy link
Member

@FredLL-Avaiga FredLL-Avaiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another few comments

frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
taipy/gui/viselements.json Outdated Show resolved Hide resolved
namnguyen20999

This comment was marked as resolved.

Copy link
Member

@FredLL-Avaiga FredLL-Avaiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there

frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
tests/gui/e2e/__init__.py Outdated Show resolved Hide resolved
frontend/taipy-gui/package.json Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.spec.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/index.ts Outdated Show resolved Hide resolved
taipy/gui/_renderers/factory.py Outdated Show resolved Hide resolved
Copy link
Member

@FabienLelaquais FabienLelaquais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor comments.
Well done!

tests/gui/e2e/with_action/test_metric_indicator.py Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
frontend/taipy-gui/src/components/Taipy/Metric.tsx Outdated Show resolved Hide resolved
Copy link
Member

@FredLL-Avaiga FredLL-Avaiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done

Can you create another issue to update the stylekit css?
https://vscode.dev/github/Avaiga/taipy/blob/feature/%231037-date-format/frontend/taipy-gui/public/stylekit/controls/chart.css#L24

And we also need to support hover_text

Copy link
Member

@FabienLelaquais FabienLelaquais left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor readability comments.

type: "indicator",
mode: "gauge" + (showValue ? "+number" : "") + (delta !== undefined ? "+delta" : ""),
delta: {
reference: typeof value === 'number' && typeof delta === 'number' ? value - delta : undefined,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For better readability, I would change that to
(value === undefined || delta === undefined) ? undefined : (value - delta)
that is more efficient and more readable (value and delta ARE numbers - except when they're not).

gauge: {
axis: {
range: [
typeof props.min === 'number' ? props.min : 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here.
The exception is 'undefined' - not (not number).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're never sure of what we receive, I think it is safer this way.

@namnguyen20999 namnguyen20999 merged commit ffb6a26 into develop May 22, 2024
155 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖰 GUI Related to GUI ✨New feature 🟥 Priority: Critical Must be addressed as soon as possible 📝Release Notes Impacts the Release Notes 🔒 Staff only Can only be assigned to the Taipy R&D team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants