-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lens] support
legendStats
along with valuesInLegend
in preparati…
…on for legend statistics (#180917) ## Summary This PR addresses phase one of #181035. Doesn't introduce any user facing changes. It starts supporting a new saved object property `legendStats` while supporting a old `valuesInLegend` property. In this PR, `legendStats: ['values']` and `valuesInLegend:true` are treated as equal. When loading the saved object, `valuesInLegend:true` is transformed to `legendStats:['values']`. After loading the document, the Lens app logic is built around the new `legendStats` property. When user saves the saved object, we do a reverse operation- we save the runtime state `legendStats:['values']` as `valuesInLegend: true` to ensure backwards compatibility. ![image](https://github.com/elastic/kibana/assets/4283304/5e09b062-b4d3-424d-b8a8-79a08f4d6260) Changes for runtime state: - For xyCharts, the `valuesInLegend?: boolean ` property is replaced with a more extensible `legend.legendStats?: LegendStats[]` interface - For partition charts, the `showValuesInLegend?: boolean` property is replaced with `legendStats?: LegendStats[]`. after loading - in initialize function: ```ts export function convertToRuntime( state: XYPersistedState, annotationGroups?: AnnotationGroups, references?: SavedObjectReference[] ) { const outputState = needsInjectReferences(state) ? injectReferences(state, annotationGroups, references) : state; if ('valuesInLegend' in outputState) { return convertToLegendStats(outputState); } return outputState; } ``` before saving : ```ts export function convertToPersistable(state: XYState) { const persistableState: XYPersistedState = convertToValuesInLegend(state); /.../ } ``` In the future the `legendStats` prop would contain also other types of stats -see the [issue](#176583).
- Loading branch information
Showing
54 changed files
with
1,558 additions
and
432 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
..._partition_vis/common/expression_functions/__snapshots__/waffle_vis_function.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,5 +129,4 @@ export const waffleConfig: PartitionVisParams = { | |
}, | ||
], | ||
}, | ||
showValuesInLegend: false, | ||
}; |
5 changes: 5 additions & 0 deletions
5
...ssion_partition_vis/public/components/__snapshots__/partition_vis_component.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.