-
Notifications
You must be signed in to change notification settings - Fork 893
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
solid area color and add interative selection
Signed-off-by: Anan Zhuang <[email protected]>
- Loading branch information
Showing
7 changed files
with
106 additions
and
43 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
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
32 changes: 32 additions & 0 deletions
32
src/plugins/vis_builder/public/visualizations/vega/components/selection.ts
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
// Define types for selection configurations | ||
interface SelectionConfig { | ||
type: 'single' | 'multi'; | ||
fields: string[]; | ||
bind: 'legend' | { [key: string]: any }; | ||
} | ||
|
||
interface VegaLiteSelection { | ||
[key: string]: SelectionConfig; | ||
} | ||
|
||
/** | ||
* Builds a selection configuration for Vega-Lite specifications. | ||
* This function creates a multi-selection bound to the legend, | ||
* allowing for interactive filtering of data based on legend items. | ||
* | ||
* @returns {VegaLiteSelection} The selection configuration object. | ||
*/ | ||
export const buildSelection = (): VegaLiteSelection => { | ||
return { | ||
legend_selection: { | ||
type: 'multi', // Allows multiple items to be selected | ||
fields: ['series'], // The field to be used for selection (typically the series field) | ||
bind: 'legend', // Binds the selection to the chart's legend | ||
}, | ||
}; | ||
}; |
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