Skip to content

Commit

Permalink
fix: ChartCanvas type is now optional
Browse files Browse the repository at this point in the history
The type defaults to hybrid.
  • Loading branch information
markmcdowell committed Sep 10, 2019
1 parent 700865b commit 22365a2
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 42 deletions.
64 changes: 32 additions & 32 deletions packages/charts/src/ChartCanvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,46 +298,46 @@ function isInteractionEnabled(xScale, xAccessor, data) {
}

interface ChartCanvasProps {
width: number;
height: number;
margin?: {
readonly width: number;
readonly height: number;
readonly margin?: {
bottom: number;
left: number;
right: number;
top: number;
};
ratio: number;
type: "svg" | "hybrid";
pointsPerPxThreshold?: number;
minPointsPerPxThreshold?: number;
data: any[];
xAccessor?: any; // func
xExtents?: any[] | any; // func
zoomAnchor?: any; // func
className?: string;
seriesName: string;
zIndex?: number;
xScale: any; // func
postCalculator?: any; // func
flipXScale?: boolean;
useCrossHairStyleCursor?: boolean;
padding?: number | {
readonly ratio: number;
readonly type?: "svg" | "hybrid";
readonly pointsPerPxThreshold?: number;
readonly minPointsPerPxThreshold?: number;
readonly data: any[];
readonly xAccessor?: any; // func
readonly xExtents?: any[] | any; // func
readonly zoomAnchor?: any; // func
readonly className?: string;
readonly seriesName: string;
readonly zIndex?: number;
readonly xScale: any; // func
readonly postCalculator?: any; // func
readonly flipXScale?: boolean;
readonly useCrossHairStyleCursor?: boolean;
readonly padding?: number | {
bottom: number;
left: number;
right: number;
top: number;
};
defaultFocus?: boolean;
zoomMultiplier?: number;
onLoadMore?: any; // func
displayXAccessor: any; // func
mouseMoveEvent?: boolean;
panEvent?: boolean;
clamp?: string | boolean | any; // func
zoomEvent?: boolean;
onSelect?: any; // func
maintainPointsPerPixelOnResize?: boolean;
disableInteraction?: boolean;
readonly defaultFocus?: boolean;
readonly zoomMultiplier?: number;
readonly onLoadMore?: any; // func
readonly displayXAccessor: any; // func
readonly mouseMoveEvent?: boolean;
readonly panEvent?: boolean;
readonly clamp?: string | boolean | any; // func
readonly zoomEvent?: boolean;
readonly onSelect?: any; // func
readonly maintainPointsPerPixelOnResize?: boolean;
readonly disableInteraction?: boolean;
}

interface ChartCanvasState {
Expand All @@ -352,7 +352,7 @@ interface ChartCanvasState {
export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasState> {

public static defaultProps = {
margin: { top: 20, right: 30, bottom: 30, left: 80 },
margin: { top: 0, right: 40, bottom: 40, left: 0 },
type: "hybrid",
pointsPerPxThreshold: 2,
minPointsPerPxThreshold: 1 / 100,
Expand Down Expand Up @@ -1170,7 +1170,7 @@ export class ChartCanvas extends React.Component<ChartCanvasProps, ChartCanvasSt
public render() {

const {
type,
type = ChartCanvas.defaultProps.type,
height,
width,
margin = ChartCanvas.defaultProps.margin,
Expand Down
1 change: 0 additions & 1 deletion packages/stories/src/series/area/basicAreaSeries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class BasicAreaSeries extends React.Component<BasicAreaSeriesProps> {
ratio={ratio}
width={width}
margin={margin}
type="hybrid"
data={data}
displayXAccessor={displayXAccessor}
seriesName="Data"
Expand Down
1 change: 0 additions & 1 deletion packages/stories/src/series/barSeries/basicBarSeries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class BasicBarSeries extends React.Component<BasicBarSeriesProps> {
ratio={ratio}
width={width}
margin={margin}
type="hybrid"
data={data}
displayXAccessor={displayXAccessor}
seriesName="Data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ class BasicBaselineSeries extends React.Component<BasicBaselineSeriesProps> {
ratio={ratio}
width={width}
margin={margin}
type="hybrid"
data={data}
displayXAccessor={displayXAccessor}
seriesName="Data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class BasicCandlestick extends React.Component<BasicCandlestickProps> {
ratio={ratio}
width={width}
margin={margin}
type="hybrid"
data={data}
displayXAccessor={displayXAccessor}
seriesName="Data"
Expand Down
1 change: 0 additions & 1 deletion packages/stories/src/series/candlestick/stockChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class StockChart extends React.Component<StockChartProps> {
ratio={ratio}
width={width}
margin={margin}
type="hybrid"
data={data}
displayXAccessor={displayXAccessor}
seriesName="Data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class BasicHeikinAshiSeries extends React.Component<BasicHeikinAshiSeriesProps>
ratio={ratio}
width={width}
margin={margin}
type="hybrid"
data={data}
displayXAccessor={displayXAccessor}
seriesName="Data"
Expand Down
1 change: 0 additions & 1 deletion packages/stories/src/series/kagi/basicKagiSeries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class BasicKagiSeries extends React.Component<BasicKagiSeriesProps> {
ratio={ratio}
width={width}
margin={margin}
type="hybrid"
data={data}
displayXAccessor={displayXAccessor}
seriesName="Data"
Expand Down
1 change: 0 additions & 1 deletion packages/stories/src/series/line/basicLineSeries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ class BasicLineSeries extends React.Component<BasicLineSeriesProps> {
ratio={ratio}
width={width}
margin={margin}
type="hybrid"
data={data}
displayXAccessor={displayXAccessor}
seriesName="Data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class BasicPointAndFigureSeries extends React.Component<BasicPointAndFigureSerie
ratio={ratio}
width={width}
margin={margin}
type="hybrid"
data={data}
displayXAccessor={displayXAccessor}
seriesName="Data"
Expand Down
1 change: 0 additions & 1 deletion packages/stories/src/series/renko/basicRenkoSeries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class BasicRenkoSeries extends React.Component<BasicRenkoSeriesProps> {
ratio={ratio}
width={width}
margin={margin}
type="hybrid"
data={data}
displayXAccessor={displayXAccessor}
seriesName="Data"
Expand Down

0 comments on commit 22365a2

Please sign in to comment.