Skip to content

Commit b73ea05

Browse files
committed
Merge branch 'individual-facetedplot-components' into faceting-#259
2 parents 131e7d1 + 22f52fd commit b73ea05

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@veupathdb/components",
3-
"version": "0.11.1",
3+
"version": "0.11.2",
44
"license": "Apache-2.0",
55
"description": "React Components for VEuPathDB Websites",
66
"repository": {

src/plots/FacetedPlot.tsx

+10
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,18 @@ import React, {
1111
import { memoize } from 'lodash';
1212

1313
import { FacetedData, FacetedPlotRef, PlotRef } from '../types/plots';
14+
import FacetedBarplot from './facetedPlots/FacetedBarplot';
15+
import Barplot from './Barplot';
1416
import { PlotProps } from './PlotlyPlot';
1517

18+
const mapStringToPlotComponent = (str: string) =>
19+
({
20+
Barplot: {
21+
faceted: FacetedBarplot,
22+
unfaceted: Barplot,
23+
},
24+
}[str]);
25+
1626
type ComponentWithPlotRef<P> = ComponentType<
1727
PropsWithoutRef<P> & RefAttributes<PlotRef>
1828
>;
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import Barplot, { BarplotProps } from '../Barplot';
2+
3+
const facetedPlotContainerStyles = {
4+
height: 300,
5+
width: 375,
6+
marginLeft: '0.75rem',
7+
border: '1px solid #dedede',
8+
boxShadow: '1px 1px 4px #00000066',
9+
};
10+
11+
const facetedPlotSpacingOptions = {
12+
marginRight: 10,
13+
marginLeft: 10,
14+
marginBotton: 10,
15+
marginTop: 50,
16+
};
17+
18+
const FacetedBarplot = ({
19+
containerStyles = facetedPlotContainerStyles,
20+
spacingOptions = facetedPlotSpacingOptions,
21+
...restProps
22+
}: BarplotProps) => (
23+
<Barplot
24+
containerStyles={containerStyles}
25+
spacingOptions={spacingOptions}
26+
{...restProps}
27+
/>
28+
);
29+
30+
export default FacetedBarplot;

src/types/plots/xyplot.ts

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ export type XYPlotDataSeries = {
3333
fill?: 'tozerox' | 'tozeroy' | 'toself';
3434
/** filling plots: color */
3535
fillcolor?: string;
36+
/** R-square value for Best fit option */
37+
r2?: number;
3638
};
3739

3840
export type XYPlotData = {

0 commit comments

Comments
 (0)