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

[PieVis] Lens adaptation. #122420

Merged

Conversation

Kuznietsov
Copy link
Contributor

@Kuznietsov Kuznietsov commented Jan 6, 2022

Summary

Completes part of #121725, #95902 and #101377.

Performed changes

  • Renamed chart_expressions/expression_pie to chart_expressions/expression_partition_vis.
  • Renamed pieVis expression renderer to partitionVis.
  • Fixed wrong mistaken picking the metric column if the metric argument is provided and buckets are specified.
  • Add support of pie/donut/mosaic/treemap/waffle configuration from Lens and VisEditors by partitionVis renderer.
  • Added new expression functions for supporting mosaic.
  • Added new expression functions for supporting treemap.
  • Rendered pie/donut/mosaic/treemap via partitionVis renderer.
  • Fix bugs, produced by merging business logic of two components from Lens and VisEditors.
  • Add storybook stories and docs for edge cases.
  • Add unit tests.

Kuznietsov and others added 30 commits December 17, 2021 18:11
# Conflicts:
#	src/plugins/chart_expressions/expression_pie/common/expression_functions/pie_vis_function.test.ts
…ptation

# Conflicts:
#	src/plugins/chart_expressions/expression_pie/common/expression_functions/pie_labels_function.ts
@Kuznietsov
Copy link
Contributor Author

@elastic/kibana-vis-editors @elastic/kibana-vis-editors-external, could you, please, review the current PR?) Thanks)

# Conflicts:
#	src/plugins/visualizations/server/embeddable/make_visualize_embeddable_factory.ts
#	src/plugins/visualizations/server/migrations/visualization_saved_object_migrations.ts
@Kuznietsov Kuznietsov added v8.2.0 impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. and removed v8.1.0 impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. labels Feb 2, 2022
@stratoula
Copy link
Contributor

@elasticmachine merge upstream

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

Hey Yaroslav, I found the following bugs in visualize pie

Show top level only doesn't seem to work

image

In v8
image
(as a result I can't test the Truncate setting)

I have a donut but I see a pie instead :D
image
As a result I can't test the inner size area settings

@stratoula
Copy link
Contributor

@Kunzetsov ignore my above comment. My kibana wanted the nuclear command to work properly 😓

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

This looks good to me.
I tested the visualize pie and I cant find any regression. I also tested the canvas expressions. I haven't covered all scenarios on the latter but it seems to work fine.

@flash1293 when you have some time, do you want to also have a look? Just to be sure that I haven't missed anything :)

# Conflicts:
#	src/plugins/chart_expressions/expression_partition_vis/public/components/partition_vis_component.tsx
#	src/plugins/chart_expressions/expression_partition_vis/public/utils/get_color_picker.tsx
#	src/plugins/chart_expressions/expression_partition_vis/public/utils/index.ts
@Kuznietsov
Copy link
Contributor Author

@flash1293, could you, please, review the current PR? Thanks a lot) Your review is the only, which is required for now)

@flash1293
Copy link
Contributor

@Kunzetsov On it, this is my main task for today!

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Not a big thing, but I noticed the pie vis doesn't prevent you from using both row and column split which won't work right:

In this example with a table with two split dimensions I'm mapping them to row and column split but only the column split is shown.
Screenshot 2022-02-04 at 13 13 11

There are no blockers for me except for the migration question which I would like to resolve (also cc @stratoula ). But I don't have a super strong opinion about it


const sortPredicateSaveSourceOrder: SortPredicatePureFn =
() =>
([, node1], [, node2]) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't test, but is Predicate.DataIndex from the elastic-charts plugin doing this as well? Used hereL

truncate: number | null;
};
}
legendDisplay: LegendDisplay;
Copy link
Contributor

Choose a reason for hiding this comment

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

While testing this I realized you can't turn the legend on in vislib pie - the button in the bottom left is missing. This is also happening in 8.0. Just a note, I don't think we have to solve on this PR

if (visState && visState.type === 'pie') {
const { addLegend, labels, ...restParams } = visState.params;
// eslint-disable-next-line @typescript-eslint/naming-convention
const { last_level, ...restLabels } = labels ?? {};
Copy link
Contributor

Choose a reason for hiding this comment

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

As last_level is deprecated anyway, does it make sense to run a migration for it right now? It seems like we can easily map it to lastLevel on the expression here:

lastLevel: params.lastLevel,

That way we wouldn't have to touch the saved object. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I second that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@flash1293, @stratoula, addressed this issue at the current commit: 5f7ceaf

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@flash1293, we couldn't do that, because to_ast logic is related to the actual shape of the expression arguments. If we would override it, we'd lose the connection between vis_types and the expression. I've tried and come to the idea, it is better to leave it as it has been before.

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Tested again, changes LGTM

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
expressionPartitionVis - 49 +49
expressionPie 37 - -37
total +12

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
expressionPartitionVis - 70 +70
expressionPie 43 - -43
total +27

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
expressionPartitionVis - 42.4KB +42.4KB
expressionPie 39.5KB - -39.5KB
visTypePie 8.4KB 8.7KB +266.0B
visTypeVislib 354.7KB 354.9KB +232.0B
total +3.4KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
expressionPartitionVis - 2 +2
expressionPie 2 - -2
total -0

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
expressionPartitionVis - 18.8KB +18.8KB
expressionPie 11.3KB - -11.3KB
visTypePie 7.9KB 8.1KB +156.0B
visTypeVislib 18.7KB 19.5KB +809.0B
total +8.5KB
Unknown metric groups

API count

id before after diff
expressionPartitionVis - 70 +70
expressionPie 43 - -43
total +27

async chunk count

id before after diff
expressionPartitionVis - 1 +1
expressionPie 1 - -1
total -0

ESLint disabled line counts

id before after diff
expressionPartitionVis - 3 +3
expressionPie 3 - -3
total -0

References to deprecated APIs

id before after diff
expressionPartitionVis - 6 +6
expressionPie 6 - -6
visTypePie 0 4 +4
total +4

Total ESLint disabled count

id before after diff
expressionPartitionVis - 3 +3
expressionPie 3 - -3
total -0

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @Kunzetsov

@Kuznietsov Kuznietsov merged commit d9aa72c into elastic:main Feb 4, 2022
stratoula added a commit that referenced this pull request Jun 20, 2023
## Summary

Closes #159942

If the height of a partition chart exceeds 1000px paddings are added,
reducing the chart size.
This is caused due to this piece of code
#122420

This was added for the aggbased editor to reduce a bit the pie size
(otherwise it was taking the full container size and the pie was huge)

Although we want this, we don't want this to be applied in dashboards or
lens editor. This PR is fixing this by adding the paddings only on the
agg based editor level

In agg based editor
<img width="651" alt="image"
src="https://github.com/elastic/kibana/assets/17003240/48ac6fdd-43e3-46f5-8818-d40334678fce">

Dashboard with very tall treemap, no paddings
<img width="933" alt="image"
src="https://github.com/elastic/kibana/assets/17003240/8787d6ab-887c-4c8d-8419-2c2d5659f2c1">



### Checklist
- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Vis Editor Visualization editor issues Feature:Visualizations Generic visualization features (in case no more specific feature label is available) impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:x-large Extra Large Level of Effort release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants