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

Remove ChartType duplicates #3355

Merged
merged 1 commit into from
Jan 9, 2025
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
5 changes: 2 additions & 3 deletions packages/ag-charts-community/src/api/agCharts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type {
import { CartesianChart } from '../chart/cartesianChart';
import { Chart } from '../chart/chart';
import { AgChartInstanceProxy, type FactoryApi } from '../chart/chartProxy';
import type { ChartType } from '../chart/factory/chartTypes';
import { registerInbuiltModules } from '../chart/factory/registerInbuiltModules';
import { setupModules } from '../chart/factory/setupModules';
import { FlowProportionChart } from '../chart/flowProportionChart';
Expand Down Expand Up @@ -45,9 +46,7 @@ function debugOptions(msg: string, options?: object) {
}
}

function chartType(
options: any
): 'cartesian' | 'polar' | 'hierarchy' | 'topology' | 'flow-proportion' | 'standalone' | 'gauge' {
function chartType(options: any): ChartType {
if (isAgCartesianChartOptions(options)) {
return 'cartesian';
} else if (isAgPolarChartOptions(options)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import type { ChartType } from './chartTypes';

type EnterpriseModuleStub = {
packageType?: 'enterprise';
identifier?: string;
chartTypes: ('cartesian' | 'polar' | 'hierarchy' | 'topology' | 'flow-proportion' | 'standalone' | 'gauge')[];
chartTypes: ChartType[];
useCount?: number;
optionsInnerKey?: string;
community?: boolean;
Expand Down
7 changes: 3 additions & 4 deletions packages/ag-charts-community/src/module/baseModule.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { DataController } from '../chart/data/dataController';
import type { ChartType } from '../chart/factory/chartTypes';
import type { BBox } from '../scene/bbox';

export interface LayoutContext {
Expand All @@ -13,15 +14,13 @@ export interface ModuleInstance {
destroy(): void;
}

export type ChartTypes = 'cartesian' | 'polar' | 'hierarchy' | 'topology' | 'flow-proportion' | 'standalone' | 'gauge';

export interface BaseModule<T extends ChartTypes = ChartTypes> {
export interface BaseModule<T extends ChartType = ChartType> {
packageType: 'community' | 'enterprise';
chartTypes: T[];
identifier?: string;
dependencies?: string[];
}

export interface BaseOptionsModule<T extends ChartTypes = ChartTypes> extends BaseModule<T> {
export interface BaseOptionsModule<T extends ChartType = ChartType> extends BaseModule<T> {
optionsKey: string;
}
7 changes: 4 additions & 3 deletions packages/ag-charts-community/src/module/coreModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import type {
WithThemeParams,
} from 'ag-charts-types';

import type { ChartType } from '../chart/factory/chartTypes';
import type { ChartLegend, ChartLegendType } from '../chart/legend/legendDatum';
import type { Series } from '../chart/series/series';
import type { BaseModule, BaseOptionsModule, ChartTypes, ModuleInstance } from './baseModule';
import type { BaseModule, BaseOptionsModule, ModuleInstance } from './baseModule';
import type { RequiredSeriesType, SeriesPaletteFactory } from './coreModulesTypes';
import type { ModuleContext } from './moduleContext';

Expand Down Expand Up @@ -89,8 +90,8 @@ export type SeriesTooltipDefaults = {

export interface SeriesModule<
SeriesType extends RequiredSeriesType = RequiredSeriesType,
ChartType extends ChartTypes = ChartTypes,
> extends BaseOptionsModule<ChartType> {
_ChartType extends ChartType = ChartType,
> extends BaseOptionsModule<_ChartType> {
type: 'series';

identifier: SeriesType;
Expand Down
Loading