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

[VisBuilder-Next] Pie Chart Integration for VisBuilder #7752

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

ananzh
Copy link
Member

@ananzh ananzh commented Aug 19, 2024

Description

This PR integrates pie charts into VisBuilder using Vega rendering.

Issues Resolved

#7607

Screenshot

  • pie integration
2024-08-20_09-22-11.mp4
  • split chart after split series
2024-08-20_09-54-03.mp4

Changelog

  • feat: [VisBuilder-Next] Pie Chart Integration for VisBuilder

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Copy link
Contributor

❌ Empty Changelog Section

The Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section.

@ananzh ananzh added v2.17.0 visbuilder-next visbuilder with vega integration vega labels Aug 19, 2024
@github-actions github-actions bot added Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry and removed failed changeset labels Aug 19, 2024
Copy link

codecov bot commented Aug 19, 2024

Codecov Report

Attention: Patch coverage is 72.54902% with 28 lines in your changes missing coverage. Please review.

Project coverage is 60.95%. Comparing base (2ffb11f) to head (59d1126).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...izations/vislib/pie/components/pie_vis_options.tsx 0.00% 8 Missing ⚠️
...uilder/public/visualizations/vega/utils/helpers.ts 74.07% 3 Missing and 4 partials ⚠️
...er/public/visualizations/vega/vega_spec_factory.ts 25.00% 6 Missing ⚠️
...r/public/application/components/data_tab/index.tsx 0.00% 5 Missing ⚠️
...plugins/vis_builder/public/visualizations/index.ts 50.00% 0 Missing and 1 partial ⚠️
...ic/visualizations/vega/vega_spec_slices_builder.ts 92.30% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7752      +/-   ##
==========================================
+ Coverage   60.93%   60.95%   +0.01%     
==========================================
  Files        3771     3776       +5     
  Lines       89545    89638      +93     
  Branches    14017    14045      +28     
==========================================
+ Hits        54566    54637      +71     
- Misses      31569    31588      +19     
- Partials     3410     3413       +3     
Flag Coverage Δ
Linux_1 29.08% <72.54%> (+0.06%) ⬆️
Linux_2 56.27% <ø> (ø)
Linux_3 37.75% <ø> (-0.01%) ⬇️
Linux_4 29.92% <ø> (ø)
Windows_1 29.09% <72.54%> (+0.06%) ⬆️
Windows_2 56.23% <ø> (ø)
Windows_3 37.75% <ø> (-0.01%) ⬇️
Windows_4 29.92% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ananzh ananzh force-pushed the vega-slices branch 2 times, most recently from c15a84d to 4a1f149 Compare August 20, 2024 16:28
ananzh added a commit to ananzh/OpenSearch-Dashboards that referenced this pull request Aug 20, 2024
This PR integrates pie charts into VisBuilder using Vega rendering.

Issue Resolve:
opensearch-project#7752

Signed-off-by: Anan Zhuang <[email protected]>
ananzh added a commit to ananzh/OpenSearch-Dashboards that referenced this pull request Aug 20, 2024
This PR integrates pie charts into VisBuilder using Vega rendering.

Issue Resolve:
opensearch-project#7752

Signed-off-by: Anan Zhuang <[email protected]>
ananzh added a commit to ananzh/OpenSearch-Dashboards that referenced this pull request Aug 20, 2024
This PR integrates pie charts into VisBuilder using Vega rendering.

Issue Resolve:
opensearch-project#7752

Signed-off-by: Anan Zhuang <[email protected]>
opensearch-changeset-bot bot added a commit to ananzh/OpenSearch-Dashboards that referenced this pull request Aug 20, 2024
@github-actions github-actions bot removed the Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry label Aug 20, 2024
@ananzh ananzh marked this pull request as ready for review August 20, 2024 17:30
opensearch-changeset-bot bot added a commit to ananzh/OpenSearch-Dashboards that referenced this pull request Aug 20, 2024
@ananzh ananzh force-pushed the vega-slices branch 2 times, most recently from 1309ec9 to 5e59033 Compare August 20, 2024 18:25
opensearch-changeset-bot bot added a commit to ananzh/OpenSearch-Dashboards that referenced this pull request Aug 20, 2024
opensearch-changeset-bot bot added a commit to ananzh/OpenSearch-Dashboards that referenced this pull request Aug 20, 2024
const currentLabels = { ...parentLabels, [`level${level}`]: child.name };
levelSet.add(`level${level}`);

if (child.children && child.children.length > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (child.children && child.children.length > 0) {
if (Array.isArray(child.children) && child.children.length > 0) {

Copy link
Member Author

Choose a reason for hiding this comment

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

k. will modify.


if (child.children && child.children.length > 0) {
flattenSlices(child, split, level + 1, currentLabels);
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this else safe to happen when child.children = []?

Copy link
Member Author

Choose a reason for hiding this comment

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

This part of the code is generally safe to execute. Every leaf node, nodes without children, has a size property. However, we could make it safer. I have updated in the code.

@sejli sejli removed the v2.17.0 label Sep 3, 2024
This PR integrates pie charts into VisBuilder using Vega rendering.

Issue Resolve:
opensearch-project#7607

Signed-off-by: Anan Zhuang <[email protected]>
Signed-off-by: Anan Zhuang <[email protected]>
@@ -77,6 +79,17 @@ export const DataTab = () => {
}

const panelGroups = Array.from(schemas.all.map((schema) => schema.name));
// Check schema order
if (destinationSchemaName === 'split') {
const validationResult = validateAggregations(aggProps.aggs, schemas.all);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: We are only using split schema during validation we can only pass that schema instead of passing in all the schemas

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah currently this is an special schema check for pie. It is not appliable for other schemas.

Copy link
Collaborator

@LDrago27 LDrago27 left a comment

Choose a reason for hiding this comment

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

Looks good.

@ananzh ananzh merged commit 615d7d4 into opensearch-project:main Oct 10, 2024
72 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 10, 2024
* [VisBuilder-Next] Pie Chart Integration for VisBuilder
This PR integrates pie charts into VisBuilder using Vega rendering.

Issue Resolve:
#7607

---------

Signed-off-by: Anan Zhuang <[email protected]>
(cherry picked from commit 615d7d4)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ananzh pushed a commit that referenced this pull request Oct 23, 2024
* [VisBuilder-Next] Pie Chart Integration for VisBuilder
This PR integrates pie charts into VisBuilder using Vega rendering.

Issue Resolve:
#7607

---------


(cherry picked from commit 615d7d4)

Signed-off-by: Anan Zhuang <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Qxisylolo pushed a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 30, 2024
…oject#7752)

* [VisBuilder-Next] Pie Chart Integration for VisBuilder
This PR integrates pie charts into VisBuilder using Vega rendering.

Issue Resolve:
opensearch-project#7607

---------

Signed-off-by: Anan Zhuang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants