Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
docs: update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw committed Aug 13, 2019
1 parent fadbcdb commit 9c06c34
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
9 changes: 9 additions & 0 deletions packages/superset-ui-encodeable/src/types/Axis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

import { DateTime } from './Inherit';

/** Axis orientation */
export type AxisOrient = 'top' | 'bottom' | 'left' | 'right';

/** Strategy for handling label overlap */
export type LabelOverlapStrategy = 'auto' | 'flat' | 'rotate';

export interface CoreAxis {
/** Tick label format */
format?: string;
/** Angle to rotate the tick labels */
labelAngle: number;
/**
* Indicates if the first and last axis labels should be aligned flush with the scale range.
Expand All @@ -18,12 +22,17 @@ export interface CoreAxis {
* and also push them 2 pixels outward from the center of the axis.
* The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks. */
labelFlush?: boolean | number;
/** Strategy for handling label overlap */
labelOverlap: LabelOverlapStrategy;
/** The padding, in pixels, between axis and text labels. */
labelPadding: number;
/** Axis orientation */
orient: AxisOrient;
/** Estimated number of desired ticks */
tickCount: number;
/** Tick length */
tickSize?: number;
/** Axis title */
title?: string | boolean;
/** Explicitly set the visible axis tick values. */
values?: string[] | number[] | boolean[] | DateTime[];
Expand Down
2 changes: 2 additions & 0 deletions packages/superset-ui-encodeable/src/types/Base.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/** Extract generic type from array */
export type Unarray<T> = T extends Array<infer U> ? U : T;

/** T or an array of T */
export type MayBeArray<T> = T | T[];
10 changes: 8 additions & 2 deletions packages/superset-ui-encodeable/src/types/ChannelDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,18 @@ export type MarkPropChannelDef<Output extends Value = Value> =

export type TextChannelDef<Output extends Value = Value> = TextFieldDef | ValueDef<Output>;

export type NonValueDef<Output extends Value = Value> =
export type ChannelDef<Output extends Value = Value> =
| ValueDef<Output>
| XFieldDef<Output>
| YFieldDef<Output>
| MarkPropFieldDef<Output>
| TextFieldDef;

export type ChannelDef<Output extends Value = Value> = NonValueDef<Output> | ValueDef<Output>;
/** Channel definitions that are not constant value */
export type NonValueDef<Output extends Value = Value> = Exclude<
ChannelDef<Output>,
ValueDef<Output>
>;

/** Pattern for extracting output type from channel definition */
export type ExtractChannelOutput<Def> = Def extends ChannelDef<infer Output> ? Output : never;
1 change: 1 addition & 0 deletions packages/superset-ui-encodeable/src/types/Scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface Scale<Output extends Value = Value> {
range?: Output[];
clamp?: boolean;
nice?: boolean;
/** color scheme name */
scheme?: string | SchemeParams;
/** vega-lite does not have this */
namespace?: string;
Expand Down

0 comments on commit 9c06c34

Please sign in to comment.