Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rename enum types to singular #1064

Merged
merged 1 commit into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions api/charts.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ export interface AngleFromTo {
}

// @public
export type AnnotationDomainType = $Values<typeof AnnotationDomainTypes>;

// @public
export const AnnotationDomainTypes: Readonly<{
export const AnnotationDomainType: Readonly<{
XDomain: "xDomain";
YDomain: "yDomain";
}>;

// @public
export type AnnotationDomainType = $Values<typeof AnnotationDomainType>;

// @public (undocumented)
export type AnnotationId = string;

Expand All @@ -67,18 +67,18 @@ export type AnnotationSpec = LineAnnotationSpec | RectAnnotationSpec;
// @public (undocumented)
export type AnnotationTooltipFormatter = (details?: string) => JSX.Element | null;

// @public (undocumented)
export type AnnotationType = $Values<typeof AnnotationTypes>;

// Warning: (ae-missing-release-tag) "AnnotationTypes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
// Warning: (ae-missing-release-tag) "AnnotationType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const AnnotationTypes: Readonly<{
export const AnnotationType: Readonly<{
Line: "line";
Rectangle: "rectangle";
Text: "text";
}>;

// @public (undocumented)
export type AnnotationType = $Values<typeof AnnotationType>;

// Warning: (ae-missing-release-tag) "ArcSeriesStyle" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Expand Down Expand Up @@ -107,7 +107,7 @@ export const AreaSeries: React_2.FunctionComponent<SpecRequiredProps & SpecOptio

// @public
export type AreaSeriesSpec = BasicSeriesSpec & HistogramConfig & Postfixes & {
seriesType: typeof SeriesTypes.Area;
seriesType: typeof SeriesType.Area;
curve?: CurveType;
areaSeriesStyle?: RecursivePartial<AreaSeriesStyle>;
stackMode?: StackMode;
Expand Down Expand Up @@ -170,7 +170,7 @@ export type AxisId = string;
// @public
export interface AxisSpec extends Spec {
// (undocumented)
chartType: typeof ChartTypes.XYAxis;
chartType: typeof ChartType.XYAxis;
domain?: YDomainRange;
gridLine?: Partial<GridLineStyle>;
groupId: GroupId;
Expand All @@ -185,7 +185,7 @@ export interface AxisSpec extends Spec {
showOverlappingLabels: boolean;
showOverlappingTicks: boolean;
// (undocumented)
specType: typeof SpecTypes.Axis;
specType: typeof SpecType.Axis;
style?: RecursivePartial<Omit<AxisStyle, 'gridLine'>>;
tickFormat?: TickFormatter;
ticks?: number;
Expand Down Expand Up @@ -266,7 +266,7 @@ export const BarSeries: React_2.FunctionComponent<SpecRequiredProps_2 & SpecOpti

// @public
export type BarSeriesSpec = BasicSeriesSpec & Postfixes & {
seriesType: typeof SeriesTypes.Bar;
seriesType: typeof SeriesType.Bar;
enableHistogramMode?: boolean;
barSeriesStyle?: RecursivePartial<BarSeriesStyle>;
stackMode?: StackMode;
Expand Down Expand Up @@ -295,15 +295,15 @@ export type BarStyleOverride = RecursivePartial<BarSeriesStyle> | Color | null;
// Warning: (ae-missing-release-tag) "BaseAnnotationSpec" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export interface BaseAnnotationSpec<T extends typeof AnnotationTypes.Rectangle | typeof AnnotationTypes.Line, D extends RectAnnotationDatum | LineAnnotationDatum, S extends RectAnnotationStyle | LineAnnotationStyle> extends Spec, AnnotationPortalSettings {
export interface BaseAnnotationSpec<T extends typeof AnnotationType.Rectangle | typeof AnnotationType.Line, D extends RectAnnotationDatum | LineAnnotationDatum, S extends RectAnnotationStyle | LineAnnotationStyle> extends Spec, AnnotationPortalSettings {
annotationType: T;
// (undocumented)
chartType: typeof ChartTypes.XYAxis;
chartType: typeof ChartType.XYAxis;
dataValues: D[];
groupId: GroupId;
hideTooltips?: boolean;
// (undocumented)
specType: typeof SpecTypes.Annotation;
specType: typeof SpecType.Annotation;
style?: Partial<S>;
zIndex?: number;
}
Expand Down Expand Up @@ -364,7 +364,7 @@ export const BubbleSeries: React_2.FunctionComponent<SpecRequiredProps_3 & SpecO

// @alpha
export type BubbleSeriesSpec = BasicSeriesSpec & {
seriesType: typeof SeriesTypes.Bubble;
seriesType: typeof SeriesType.Bubble;
bubbleSeriesStyle?: RecursivePartial<BubbleSeriesStyle>;
pointStyleAccessor?: PointStyleAccessor;
};
Expand Down Expand Up @@ -459,10 +459,10 @@ export interface ChartSizeObject {
width?: number | string;
}

// Warning: (ae-missing-release-tag) "ChartTypes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
// Warning: (ae-missing-release-tag) "ChartType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export const ChartTypes: Readonly<{
export const ChartType: Readonly<{
Global: "global";
Goal: "goal";
Partition: "partition";
Expand All @@ -472,7 +472,7 @@ export const ChartTypes: Readonly<{
}>;

// @public (undocumented)
export type ChartTypes = $Values<typeof ChartTypes>;
export type ChartType = $Values<typeof ChartType>;

// Warning: (ae-missing-release-tag) "CHILDREN_KEY" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
Expand Down Expand Up @@ -886,7 +886,7 @@ export interface GoalSpec extends Spec {
// (undocumented)
centralMinor: string | BandFillColorAccessor;
// (undocumented)
chartType: typeof ChartTypes.Goal;
chartType: typeof ChartType.Goal;
// Warning: (ae-forgotten-export) The symbol "Config" needs to be exported by the entry point index.d.ts
//
// (undocumented)
Expand All @@ -896,7 +896,7 @@ export interface GoalSpec extends Spec {
// (undocumented)
labelMinor: string | BandFillColorAccessor;
// (undocumented)
specType: typeof SpecTypes.Series;
specType: typeof SpecType.Series;
// Warning: (ae-forgotten-export) The symbol "GoalSubtype" needs to be exported by the entry point index.d.ts
//
// (undocumented)
Expand Down Expand Up @@ -1094,7 +1094,7 @@ export type HeatmapElementEvent = [Cell, SeriesIdentifier];
// @alpha (undocumented)
export interface HeatmapSpec extends Spec {
// (undocumented)
chartType: typeof ChartTypes.Heatmap;
chartType: typeof ChartType.Heatmap;
// (undocumented)
colors: Color[];
// Warning: (ae-forgotten-export) The symbol "HeatmapScaleType" needs to be exported by the entry point index.d.ts
Expand All @@ -1115,7 +1115,7 @@ export interface HeatmapSpec extends Spec {
// (undocumented)
ranges?: number[] | [number, number];
// (undocumented)
specType: typeof SpecTypes.Series;
specType: typeof SpecType.Series;
// (undocumented)
valueAccessor: Accessor | AccessorFn;
// (undocumented)
Expand Down Expand Up @@ -1346,7 +1346,7 @@ export interface LineAnnotationDatum {
}

// @public (undocumented)
export type LineAnnotationSpec = BaseAnnotationSpec<typeof AnnotationTypes.Line, LineAnnotationDatum, LineAnnotationStyle> & {
export type LineAnnotationSpec = BaseAnnotationSpec<typeof AnnotationType.Line, LineAnnotationDatum, LineAnnotationStyle> & {
domainType: AnnotationDomainType;
marker?: JSX.Element;
markerDimensions?: {
Expand Down Expand Up @@ -1375,7 +1375,7 @@ export const LineSeries: React_2.FunctionComponent<SpecRequiredProps_6 & SpecOpt

// @public
export type LineSeriesSpec = BasicSeriesSpec & HistogramConfig & {
seriesType: typeof SeriesTypes.Line;
seriesType: typeof SeriesType.Line;
curve?: CurveType;
lineSeriesStyle?: RecursivePartial<LineSeriesStyle>;
pointStyleAccessor?: PointStyleAccessor;
Expand Down Expand Up @@ -1764,7 +1764,7 @@ export interface RectAnnotationDatum {
}

// @public (undocumented)
export type RectAnnotationSpec = BaseAnnotationSpec<typeof AnnotationTypes.Rectangle, RectAnnotationDatum, RectAnnotationStyle> & {
export type RectAnnotationSpec = BaseAnnotationSpec<typeof AnnotationType.Rectangle, RectAnnotationDatum, RectAnnotationStyle> & {
renderTooltip?: AnnotationTooltipFormatter;
zIndex?: number;
};
Expand Down Expand Up @@ -1939,7 +1939,7 @@ export interface SeriesScales {
// @public (undocumented)
export interface SeriesSpec extends Spec {
// (undocumented)
chartType: typeof ChartTypes.XYAxis;
chartType: typeof ChartType.XYAxis;
color?: SeriesColorAccessor;
data: Datum[];
// (undocumented)
Expand All @@ -1948,11 +1948,11 @@ export interface SeriesSpec extends Spec {
groupId: string;
hideInLegend?: boolean;
name?: SeriesNameAccessor;
seriesType: SeriesTypes;
seriesType: SeriesType;
// @deprecated
sortIndex?: number;
// (undocumented)
specType: typeof SpecTypes.Series;
specType: typeof SpecType.Series;
tickFormat?: TickFormatter;
useDefaultGroupDomain?: boolean | string;
// Warning: (ae-forgotten-export) The symbol "AccessorFormat" needs to be exported by the entry point index.d.ts
Expand All @@ -1965,18 +1965,18 @@ export interface SeriesSpec extends Spec {
// @public (undocumented)
export type SeriesSpecs<S extends BasicSeriesSpec = BasicSeriesSpec> = Array<S>;

// Warning: (ae-missing-release-tag) "SeriesTypes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
// Warning: (ae-missing-release-tag) "SeriesType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const SeriesTypes: Readonly<{
export const SeriesType: Readonly<{
Area: "area";
Bar: "bar";
Line: "line";
Bubble: "bubble";
}>;

// @public
export type SeriesTypes = $Values<typeof SeriesTypes>;
export type SeriesType = $Values<typeof SeriesType>;

// Warning: (ae-missing-release-tag) "Settings" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
Expand Down Expand Up @@ -2127,18 +2127,18 @@ export interface SortSeriesByConfig {
//
// @public (undocumented)
export interface Spec {
chartType: ChartTypes;
chartType: ChartType;
id: string;
specType: string;
}

// @public (undocumented)
export type SpecId = string;

// Warning: (ae-missing-release-tag) "SpecTypes" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
// Warning: (ae-missing-release-tag) "SpecType" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const SpecTypes: Readonly<{
export const SpecType: Readonly<{
Series: "series";
Axis: "axis";
Annotation: "annotation";
Expand All @@ -2148,7 +2148,7 @@ export const SpecTypes: Readonly<{
}>;

// @public (undocumented)
export type SpecTypes = $Values<typeof SpecTypes>;
export type SpecType = $Values<typeof SpecType>;

// @public
export const StackMode: Readonly<{
Expand Down Expand Up @@ -2411,7 +2411,7 @@ export interface WordcloudSpec extends Spec {
// (undocumented)
angleCount: number;
// (undocumented)
chartType: typeof ChartTypes.Wordcloud;
chartType: typeof ChartType.Wordcloud;
// (undocumented)
config: RecursivePartial<PartitionConfig>;
// Warning: (ae-forgotten-export) The symbol "WordModel" needs to be exported by the entry point index.d.ts
Expand Down Expand Up @@ -2439,7 +2439,7 @@ export interface WordcloudSpec extends Spec {
// (undocumented)
padding: number;
// (undocumented)
specType: typeof SpecTypes.Series;
specType: typeof SpecType.Series;
// (undocumented)
spiral: string;
// (undocumented)
Expand Down
4 changes: 2 additions & 2 deletions docs/0-Intro/1-Overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export interface SeriesSpec {
/** An array of data */
data: Datum[];
/** The type of series you are looking to render */
seriesType: SeriesTypes;
seriesType: SeriesType;
/** Set colors for specific series */
customSeriesColors?: CustomSeriesColors;
/** If the series should appear in the legend
Expand Down Expand Up @@ -201,7 +201,7 @@ A `BarSeriesSpec` for example is the following intersection type:
export type BarSeriesSpec = SeriesSpec &
SeriesAccessors &
SeriesScales & {
seriesType: SeriesTypes.Bar;
seriesType: SeriesType.Bar;
};
```

Expand Down
16 changes: 8 additions & 8 deletions docs/1-Typesofchart/5-AnnotatingBars.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { boolean, color, number, select } from '@storybook/addon-knobs';
import {
AnnotationDomainTypes,
AnnotationDomainType,
AnnotationTooltipFormatter,
Axis,
BarSeries,
Expand Down Expand Up @@ -31,7 +31,7 @@ Here is a basic `line` annotation with `x domain continuous`
<Settings showLegend debug={boolean('debug', false)} rotation={getChartRotationKnob} />
<LineAnnotation
id="anno_1"
domainType={AnnotationDomainTypes.XDomain}
domainType={AnnotationDomainType.XDomain}
dataValues={[{dataValue:2.5, details:'detail-0'}, {dataValue: 7.2, details: 'detail-1'}]}
marker={<Icon type="alert" />}
style = {{line: {
Expand Down Expand Up @@ -64,7 +64,7 @@ Here is a basic `line` annotation with `x domain continuous`
</Chart>

The code sample for the above chart is shown below in the details. What you should especially pay attention to is:
* dataValues within the `<LineAnnotation/>` component
* dataValues within the `<LineAnnotation/>` component
* You can add the style prop within `<LineAnnotation/>` to customize further

<details>
Expand All @@ -74,7 +74,7 @@ The code sample for the above chart is shown below in the details. What you shou
<Settings showLegend debug={boolean('debug', false)} rotation={getChartRotationKnob} />
<LineAnnotation
id="anno_1"
domainType={AnnotationDomainTypes.XDomain}
domainType={AnnotationDomainType.XDomain}
dataValues={[{dataValue:2.5, details:'detail-0'}, {dataValue: 7.2, details: 'detail-1'}]}
marker={<Icon type="alert" />}
style = {{line: {
Expand Down Expand Up @@ -114,7 +114,7 @@ Instead of `continuous` you can use `ordinal` annotations
<Settings debug={boolean('debug', false)} rotation={getChartRotationKnob} />
<LineAnnotation
id="anno_1"
domainType={AnnotationDomainTypes.XDomain}
domainType={AnnotationDomainType.XDomain}
dataValues={[{dataValue: 'a', details: 'detail-0'}, {dataValue: 'c', details:'details-1'}]}
marker={<Icon type="alert" />}
/>
Expand All @@ -136,15 +136,15 @@ Instead of `continuous` you can use `ordinal` annotations
/>
</Chart>

The code sample for the above chart can be seen below.
The code sample for the above chart can be seen below.
<details>

```js
<Chart className={'story-chart'}>
<Settings debug={boolean('debug', false)} rotation={getChartRotationKnob} />
<LineAnnotation
id="anno_1"
domainType={AnnotationDomainTypes.XDomain}
domainType={AnnotationDomainType.XDomain}
dataValues={[{dataValue: 'a', details: 'detail-0'}, {dataValue: 'c', details:'details-1'}]}
marker={<Icon type="alert" />}
/>
Expand All @@ -166,4 +166,4 @@ The code sample for the above chart can be seen below.
/>
</Chart>
```
</details>
</details>
6 changes: 3 additions & 3 deletions docs/2-ChartPropTables/12-AxisProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ The bar chart with axis example in the `Types of charts` section includes only s

| Prop | Type | Default | Note |
|:------|:------:|:---------:|:------|
| chartType | `typeof ChartTypes.XYAxis` | ChartTypes.XYAxis | |
| specType | `typeof SpecTypes.Axis` | SpecTypes.Axis | |
| chartType | `typeof ChartType.XYAxis` | ChartType.XYAxis | |
| specType | `typeof SpecType.Axis` | SpecType.Axis | |
| groupId | GroupId | `__global__` | The ID of the axis group |
| hide | boolean | false | Hide this axis |
| showOverlappingTicks | boolean | false | Shows all ticks, also the one from the overlapping labels |
Expand All @@ -16,4 +16,4 @@ The bar chart with axis example in the `Types of charts` section includes only s
| tickFormat | `function` | `(tick: any) => ${tick}`| A function called to format each single tick label|
| tickLabelRotation | number | `0`| The degrees of rotation of the tick labels|

***
***
Loading