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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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 73.00000% with 27 lines in your changes missing coverage. Please review.

Project coverage is 63.84%. Comparing base (ae7cfa6) to head (4c8e90b).
Report is 10 commits behind head on main.

Files Patch % Lines
...izations/vislib/pie/components/pie_vis_options.tsx 0.00% 8 Missing ⚠️
...uilder/public/visualizations/vega/utils/helpers.ts 76.00% 3 Missing and 3 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   63.82%   63.84%   +0.02%     
==========================================
  Files        3650     3660      +10     
  Lines       80966    81216     +250     
  Branches    12894    12948      +54     
==========================================
+ Hits        51673    51856     +183     
- Misses      26126    26181      +55     
- Partials     3167     3179      +12     
Flag Coverage Δ
Linux_1 30.16% <73.00%> (+0.12%) ⬆️
Linux_2 55.87% <ø> (+0.01%) ⬆️
Linux_3 40.42% <ø> (+0.01%) ⬆️
Linux_4 31.29% <ø> (+<0.01%) ⬆️
Windows_1 30.17% <73.00%> (+0.12%) ⬆️
Windows_2 55.82% <ø> (+0.01%) ⬆️
Windows_3 40.42% <ø> (+0.01%) ⬆️
Windows_4 31.29% <ø> (+<0.01%) ⬆️

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
This PR integrates pie charts into VisBuilder using Vega rendering.

Issue Resolve:
opensearch-project#7607

Signed-off-by: Anan Zhuang <[email protected]>
@@ -50,5 +51,18 @@ export const validateAggregations = (aggs: AggConfig[]): ValidationResult => {
};
}

const splitSchema = schemas?.find((s) => s.name === 'split');
if (splitSchema && splitSchema.mustBeFirst) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit:

Suggested change
if (splitSchema && splitSchema.mustBeFirst) {
if (splitSchema?.mustBeFirst) {

Comment on lines +17 to +28
const defaultVisualizationTypes = [
createHistogramConfig,
createLineConfig,
createAreaConfig,
createMetricConfig,
createTableConfig,
];

const visualizationTypes = useVega
? [...defaultVisualizationTypes, createPieConfig]
: defaultVisualizationTypes;

Copy link
Collaborator

Choose a reason for hiding this comment

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

why not just

Suggested change
const defaultVisualizationTypes = [
createHistogramConfig,
createLineConfig,
createAreaConfig,
createMetricConfig,
createTableConfig,
];
const visualizationTypes = useVega
? [...defaultVisualizationTypes, createPieConfig]
: defaultVisualizationTypes;
const visualizationTypes = [
createHistogramConfig,
createLineConfig,
createAreaConfig,
createMetricConfig,
createTableConfig,
];
if (useVega) visualizationTypes.push(createPieConfig);

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) {


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 = []?

});
};

if (group && group.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 (group && group.length !== 0) {
if (Array.isArray(group) && group.length !== 0) {

@sejli sejli removed the v2.17.0 label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants