Skip to content

Commit

Permalink
working lengend for plot
Browse files Browse the repository at this point in the history
  • Loading branch information
tizayi committed Sep 7, 2023
1 parent 723b1e6 commit c636a07
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 43 deletions.
50 changes: 27 additions & 23 deletions src/plot/centrePlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,29 +134,33 @@ export default function CentrePlot(): JSX.Element {
detectorUpper: Vector3,
) => (
<SvgElement>
<SvgCircle
coords={[cameraTubeCentre, cameraTubePerimeter]}
fill="rgba(0, 255, 0, 0.5)"
id="camera tube"
/>
<SvgCircle
coords={[beamstopCentre, clearance]}
fill="rgba(0, 0, 255, 0.5)"
id="clearance"
/>
<SvgCircle
coords={[beamstopCentre, beamstopPerimeter]}
fill="black"
id="beamstop"
/>
<SvgRect
coords={[detectorLower, detectorUpper]}
fill="rgba(255, 0, 0, 0.5)"
id="detector"
stroke="black"
strokePosition="outside"
strokeWidth={0}
/>
{plotConfig.cameraTube &&
<SvgCircle
coords={[cameraTubeCentre, cameraTubePerimeter]}
fill="rgba(0, 255, 0, 0.2)"
id="camera tube"
/>}
{plotConfig.clearnace &&
<SvgCircle
coords={[beamstopCentre, clearance]}
fill="rgba(0, 0, 255, 0.2)"
id="clearance"
/>}
{plotConfig.beamstop &&
<SvgCircle
coords={[beamstopCentre, beamstopPerimeter]}
fill="black"
id="beamstop"
/>}
{plotConfig.detector &&
<SvgRect
coords={[detectorLower, detectorUpper]}
fill="rgba(255, 0, 0, 0.2)"
id="detector"
stroke="black"
strokePosition="outside"
strokeWidth={0}
/>}
</SvgElement>
)}
</DataToHtml>
Expand Down
12 changes: 6 additions & 6 deletions src/plot/legendBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,27 @@ export default function LegendBar(): JSX.Element {
<Typography>Add something to do with colors here</Typography>
<FormGroup>
<FormControlLabel
control={<Checkbox checked={plotConfig.detector.inPlot} />}
control={<Checkbox checked={plotConfig.detector} onChange={(_, checked) => plotConfig.edit({ detector: checked })} />}
label="Detector"
/>
<FormControlLabel
control={<Checkbox checked={plotConfig.beamstop.inPlot} />}
control={<Checkbox checked={plotConfig.beamstop} onChange={(_, checked) => plotConfig.edit({ beamstop: checked })} />}
label="Beamstop"
/>
<FormControlLabel
control={<Checkbox checked={plotConfig.cameraTube.inPlot} />}
control={<Checkbox checked={plotConfig.cameraTube} onChange={(_, checked) => plotConfig.edit({ cameraTube: checked })} />}
label="Camera tube"
/>
<FormControlLabel
control={<Checkbox checked={plotConfig.qrange} />}
control={<Checkbox checked={plotConfig.qrange} onChange={(_, checked) => plotConfig.edit({ qrange: checked })} />}
label="Q range"
/>
<FormControlLabel
control={<Checkbox checked={plotConfig.mask} />}
control={<Checkbox checked={plotConfig.mask} onChange={(_, checked) => plotConfig.edit({ mask: checked })} />}
label="Mask"
/>
<FormControlLabel
control={<Checkbox checked={plotConfig.calibrantInPlot} />}
control={<Checkbox checked={plotConfig.calibrantInPlot} onChange={(_, checked) => plotConfig.edit({ calibrantInPlot: checked })} />}
label="Calibrant"
/>
</FormGroup>
Expand Down
21 changes: 8 additions & 13 deletions src/plot/plotStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@ export enum PlotAxes {
reciprocal = "reciprocal",
}

interface PlotItem {
inPlot: boolean;
colour: string;
}

export interface PlotConfig {
detector: PlotItem;
beamstop: PlotItem;
cameraTube: PlotItem;
clearnace: PlotItem;
detector: boolean;
beamstop: boolean;
cameraTube: boolean;
clearnace: boolean;
qrange: boolean;
mask: boolean;
calibrantInPlot: boolean;
Expand All @@ -25,10 +20,10 @@ export interface PlotConfig {
}

export const usePlotStore = create<PlotConfig>((set) => ({
detector: { inPlot: false, colour: "red" },
beamstop: { inPlot: true, colour: "blue" },
cameraTube: { inPlot: true, colour: "green" },
clearnace: { inPlot: true, colour: "pink" },
detector: true,
beamstop: true,
cameraTube: true,
clearnace: true,
qrange: true,
mask: false,
calibrantInPlot: false,
Expand Down
9 changes: 8 additions & 1 deletion src/presets/detectors.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@
},
"pixelSize": 0.172
},
"long boy": {
"resolution": {
"width": 1475,
"height": 679
},
"pixelSize": 0.172
},
"test": {
"resolution": {
"width": 1,
"height": 1
},
"pixelSize": 1
}
}
}

0 comments on commit c636a07

Please sign in to comment.