Skip to content

Commit

Permalink
fix: filter out empty string ids in the legend data
Browse files Browse the repository at this point in the history
  • Loading branch information
interstellarmt committed Feb 20, 2025
1 parent a17fa6e commit c45bb32
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
- name: Update coverall
if: ${{ success() }}
uses: coverallsapp/github-action@master
continue-on-error: true # 暂时改动
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

Expand Down
10 changes: 9 additions & 1 deletion src/component/legendCategory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ function inferLegendShape(
return { width, height };
}

function filterEmptyIds(legendStyle) {
return {
...legendStyle,
data: legendStyle?.data.filter((item) => item.id !== ''),
};
}

/**
* Guide Component for ordinal color scale.
*/
Expand Down Expand Up @@ -211,8 +218,9 @@ export const LegendCategory: GCC<LegendCategoryOptions> = (options) => {

const { legendCategory: legendTheme = {} } = theme;

// Filter out the data items with empty string IDs in the wordCloud's data before generating the legend.
const categoryStyle = adaptor(
Object.assign({}, legendTheme, legendStyle, style),
Object.assign({}, legendTheme, filterEmptyIds(legendStyle), style),
);

const layoutWrapper = new LegendCategoryLayout({
Expand Down

0 comments on commit c45bb32

Please sign in to comment.