Skip to content

Commit 716531c

Browse files
authored
Merge pull request #1898 from silx-kit/hide-errors-toggle
Hide "Errors" toggle in Line toolbar instead of disabling it
2 parents 2d3dda9 + 2049881 commit 716531c

File tree

6 files changed

+13
-21
lines changed

6 files changed

+13
-21
lines changed

.github/workflows/lint-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
uses: actions/cache@v4
8484
with:
8585
path: ~/.local
86-
key: poetry-4 # increment to reset cache
86+
key: poetry-5 # increment to reset cache
8787

8888
- name: Install Poetry 📜
8989
if: steps.poetry.outputs.cache-hit != 'true'
@@ -96,7 +96,7 @@ jobs:
9696
uses: actions/cache@v4
9797
with:
9898
path: ~/.cache/pypoetry/virtualenvs
99-
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-7 # increment to reset cache
99+
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}-8 # increment to reset cache
100100

101101
- name: Create Poetry environments 📜
102102
if: steps.poetry-venvs.outputs.cache-hit != 'true'

apps/storybook/src/DataCurve.stories.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const meta = {
3030
args: {
3131
abscissas: range(oneD.size),
3232
ordinates: oneD.data,
33-
errors: oneD.data.map(() => 10),
3433
curveType: CurveType.LineOnly,
3534
color: 'blue',
3635
materialProps: {},
@@ -53,13 +52,13 @@ type Story = StoryObj<typeof meta>;
5352

5453
export const Default = {
5554
render: (args) => {
56-
const { abscissas, ordinates, errors, showErrors, ignoreValue } = args;
55+
const { abscissas, ordinates, errors, ignoreValue } = args;
5756

5857
const abscissaDomain = useDomain(abscissas);
5958
const ordinateDomain = useDomain(
6059
ordinates,
6160
ScaleType.Linear,
62-
showErrors ? errors : undefined,
61+
errors,
6362
ignoreValue,
6463
);
6564

@@ -117,7 +116,7 @@ export const Glyphs = {
117116
export const WithErrors = {
118117
...Default,
119118
args: {
120-
showErrors: true,
119+
errors: oneD.data.map(() => 10),
121120
},
122121
} satisfies Story;
123122

packages/app/src/vis-packs/core/line/LineToolbar.tsx

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,14 @@ interface Props {
2727
dataDomain: Domain;
2828
isSlice?: boolean;
2929
isComplex?: boolean;
30-
disableErrors?: boolean;
30+
withErrors?: boolean;
3131
config: LineConfig;
3232
exportEntries?: ExportEntry[];
3333
}
3434

3535
function LineToolbar(props: Props) {
36-
const {
37-
dataDomain,
38-
isSlice,
39-
isComplex,
40-
disableErrors,
41-
config,
42-
exportEntries,
43-
} = props;
36+
const { dataDomain, isSlice, isComplex, withErrors, config, exportEntries } =
37+
props;
4438

4539
const {
4640
customDomain,
@@ -97,13 +91,12 @@ function LineToolbar(props: Props) {
9791

9892
<Separator />
9993

100-
{!isComplex && (
94+
{withErrors && (
10195
<ToggleBtn
10296
label="Errors"
10397
Icon={ErrorsIcon}
104-
value={!disableErrors && showErrors}
98+
value={showErrors}
10599
onToggle={toggleErrors}
106-
disabled={disableErrors}
107100
/>
108101
)}
109102

packages/app/src/vis-packs/core/line/MappedLineVis.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ function MappedLineVis(props: Props) {
154154
<LineToolbar
155155
dataDomain={combinedDomain}
156156
isSlice={selection !== undefined}
157-
disableErrors={!errors}
157+
withErrors={!!errors}
158158
config={config}
159159
exportEntries={exportEntries}
160160
/>,

packages/lib/src/vis/line/DataCurve.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function DataCurve(props: Props) {
3535
abscissas,
3636
ordinates,
3737
errors,
38-
showErrors,
38+
showErrors = true,
3939
color,
4040
width,
4141
interpolation,

packages/lib/src/vis/line/LineVis.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function LineVis(props: Props) {
6262
title,
6363
dtype,
6464
errorsArray,
65-
showErrors = false,
65+
showErrors = true,
6666
auxiliaries = [],
6767
renderTooltip,
6868
children,

0 commit comments

Comments
 (0)