Skip to content

Commit

Permalink
Merge branch 'develop' into thinkh/unified-warning-message
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkh authored Oct 24, 2024
2 parents 8cf1a6d + ae6670f commit 3071866
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion playwright/boxPlot/04_subcategory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('subcategory selected', async ({ page }) => {

await expect(page.locator('g[class="subplot xy"]').locator('g[class="trace boxes"]').nth(1).locator('path[class="box"]')).toHaveCSS(
'fill',
'rgb(236, 104, 54)',
'rgb(247, 90, 30)',
);

await expect(page.locator('g[class="subplot xy"]').locator('g[class="trace boxes"]').nth(2).locator('path[class="box"]')).toHaveCSS(
Expand Down
3 changes: 2 additions & 1 deletion src/vis/scatter/ScatterVis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { useLayout } from './useLayout';
import { useData } from './useData';
import { categoricalColors, getCssValue } from '../../utils';

Check failure on line 23 in src/vis/scatter/ScatterVis.tsx

View workflow job for this annotation

GitHub Actions / build / Node

Duplicate identifier 'getCssValue'.
import { WarningMessage } from '../general/WarningMessage';
import { categoricalColors10, getCssValue } from '../../utils';

Check failure on line 25 in src/vis/scatter/ScatterVis.tsx

View workflow job for this annotation

GitHub Actions / build / Node

Duplicate identifier 'getCssValue'.

function Legend({ categories, colorMap, onClick }: { categories: string[]; colorMap: (v: number | string) => string; onClick: (string) => void }) {
return (
Expand Down Expand Up @@ -348,7 +349,7 @@ export function ScatterVis({
} else {
// Create d3 color scale
valuesWithoutUnknown.forEach((v, i) => {
mapping[v] = categoricalColors[i % categoricalColors.length]!;
mapping[v] = categoricalColors10[i % categoricalColors10.length]!;
});
mapping.Unknown = VIS_NEUTRAL_COLOR;
}
Expand Down
8 changes: 4 additions & 4 deletions src/vis/violin/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { cloneDeep, groupBy, mean, merge, orderBy, sumBy } from 'lodash';
import { i18n } from '../../i18n';
import { categoricalColors } from '../../utils';
import { categoricalColors10 } from '../../utils';
import { IBoxplotConfig } from '../boxplot';
import { ESortStates } from '../general/SortIcon';
import { NAN_REPLACEMENT, SELECT_COLOR, VIS_NEUTRAL_COLOR, VIS_UNSELECTED_OPACITY } from '../general/constants';
Expand Down Expand Up @@ -154,7 +154,7 @@ export async function createViolinTraces(

if (!subCatMap[subCatVal]) {
subCatMap[subCatVal] = {
color: subCatVal === NAN_REPLACEMENT ? VIS_NEUTRAL_COLOR : categoricalColors[Object.keys(subCatMap).length % categoricalColors.length],
color: subCatVal === NAN_REPLACEMENT ? VIS_NEUTRAL_COLOR : categoricalColors10[Object.keys(subCatMap).length % categoricalColors10.length],
idx: Object.keys(subCatMap).length,
};
}
Expand Down Expand Up @@ -186,7 +186,7 @@ export async function createViolinTraces(

if (!subCatMap[subCatVal]) {
subCatMap[subCatVal] = {
color: subCatVal === NAN_REPLACEMENT ? VIS_NEUTRAL_COLOR : categoricalColors[Object.keys(subCatMap).length % categoricalColors.length],
color: subCatVal === NAN_REPLACEMENT ? VIS_NEUTRAL_COLOR : categoricalColors10[Object.keys(subCatMap).length % categoricalColors10.length],
idx: Object.keys(subCatMap).length,
};
}
Expand Down Expand Up @@ -229,7 +229,7 @@ export async function createViolinTraces(

// Create subcategory map for coloring and legend
[...subCatOrder].forEach((v, i) => {
subCatMap[v] = { color: v === NAN_REPLACEMENT ? VIS_NEUTRAL_COLOR : categoricalColors[i % categoricalColors.length], idx: i };
subCatMap[v] = { color: v === NAN_REPLACEMENT ? VIS_NEUTRAL_COLOR : categoricalColors10[i % categoricalColors10.length], idx: i };
});

// Only allow split mode if there are exactly two subcategories and the plot type is violin
Expand Down

0 comments on commit 3071866

Please sign in to comment.