Skip to content

Commit

Permalink
Viz: make LegendItem public (T1191979) (#26150)
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Bulychev <git@bulychev.net>
  • Loading branch information
iBat and Alexander Bulychev authored Dec 20, 2023
1 parent b976527 commit 823a864
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 45 deletions.
1 change: 1 addition & 0 deletions packages/devextreme-angular/src/common/charts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export {
LabelOverlap,
LabelPosition,
LegendHoverMode,
LegendItem,
LegendMarkerState,
Palette,
PaletteColorSet,
Expand Down
7 changes: 3 additions & 4 deletions packages/devextreme-react/src/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import { Component as BaseComponent, IHtmlOptions } from "./core/component";
import NestedOption from "./core/nested-option";

import type { ArgumentAxisClickEvent, DisposingEvent, DoneEvent, DrawnEvent, ExportedEvent, ExportingEvent, FileSavingEvent, IncidentOccurredEvent, InitializedEvent, LegendClickEvent, PointClickEvent, SeriesClickEvent, TooltipHiddenEvent, TooltipShownEvent, ZoomEndEvent, ZoomStartEvent, chartPointAggregationInfoObject, chartSeriesObject, dxChartAnnotationConfig, chartPointObject } from "devextreme/viz/chart";
import type { Font as ChartsFont, ScaleBreak, ChartsColor } from "devextreme/common/charts";
import type { Font as ChartsFont, ScaleBreak, ChartsColor, LegendItem } from "devextreme/common/charts";
import type { template } from "devextreme/core/templates/template";
import type { BaseChartLegendItem } from "devextreme/viz/chart_components/base_chart";
import type { ChartSeries } from "devextreme/viz/common";

import type * as CommonChartTypes from "devextreme/common/charts";
Expand Down Expand Up @@ -1861,7 +1860,7 @@ type ILegendProps = React.PropsWithChildren<{
columnCount?: number;
columnItemSpacing?: number;
customizeHint?: ((seriesInfo: { seriesColor: string, seriesIndex: number, seriesName: any }) => string);
customizeItems?: ((items: Array<BaseChartLegendItem>) => Array<BaseChartLegendItem>);
customizeItems?: ((items: Array<LegendItem>) => Array<LegendItem>);
customizeText?: ((seriesInfo: { seriesColor: string, seriesIndex: number, seriesName: any }) => string);
font?: ChartsFont;
horizontalAlignment?: "center" | "left" | "right";
Expand All @@ -1875,7 +1874,7 @@ type ILegendProps = React.PropsWithChildren<{
top?: number;
};
markerSize?: number;
markerTemplate?: ((legendItem: BaseChartLegendItem, element: any) => string | any) | template;
markerTemplate?: ((legendItem: LegendItem, element: any) => string | any) | template;
orientation?: "horizontal" | "vertical";
paddingLeftRight?: number;
paddingTopBottom?: number;
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-react/src/common/charts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export {
LabelOverlap,
LabelPosition,
LegendHoverMode,
LegendItem,
LegendMarkerState,
Palette,
PaletteColorSet,
Expand Down
7 changes: 3 additions & 4 deletions packages/devextreme-react/src/polar-chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ import { Component as BaseComponent, IHtmlOptions } from "./core/component";
import NestedOption from "./core/nested-option";

import type { ArgumentAxisClickEvent, DisposingEvent, DoneEvent, DrawnEvent, ExportedEvent, ExportingEvent, FileSavingEvent, IncidentOccurredEvent, InitializedEvent, LegendClickEvent, PointClickEvent, SeriesClickEvent, TooltipHiddenEvent, TooltipShownEvent, ZoomEndEvent, ZoomStartEvent, dxPolarChartAnnotationConfig, dxPolarChartCommonAnnotationConfig, PolarChartSeries } from "devextreme/viz/polar_chart";
import type { Font as ChartsFont, ChartsColor } from "devextreme/common/charts";
import type { Font as ChartsFont, ChartsColor, LegendItem } from "devextreme/common/charts";
import type { template } from "devextreme/core/templates/template";
import type { BaseChartLegendItem } from "devextreme/viz/chart_components/base_chart";

import type * as CommonChartTypes from "devextreme/common/charts";
import type * as LocalizationTypes from "devextreme/localization";
Expand Down Expand Up @@ -1267,7 +1266,7 @@ type ILegendProps = React.PropsWithChildren<{
columnCount?: number;
columnItemSpacing?: number;
customizeHint?: ((seriesInfo: { seriesColor: string, seriesIndex: number, seriesName: any }) => string);
customizeItems?: ((items: Array<BaseChartLegendItem>) => Array<BaseChartLegendItem>);
customizeItems?: ((items: Array<LegendItem>) => Array<LegendItem>);
customizeText?: ((seriesInfo: { seriesColor: string, seriesIndex: number, seriesName: any }) => string);
font?: ChartsFont;
horizontalAlignment?: "center" | "left" | "right";
Expand All @@ -1281,7 +1280,7 @@ type ILegendProps = React.PropsWithChildren<{
top?: number;
};
markerSize?: number;
markerTemplate?: ((legendItem: BaseChartLegendItem, element: any) => string | any) | template;
markerTemplate?: ((legendItem: LegendItem, element: any) => string | any) | template;
orientation?: "horizontal" | "vertical";
paddingLeftRight?: number;
paddingTopBottom?: number;
Expand Down
1 change: 1 addition & 0 deletions packages/devextreme-vue/src/common/charts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export {
LabelOverlap,
LabelPosition,
LegendHoverMode,
LegendItem,
LegendMarkerState,
Palette,
PaletteColorSet,
Expand Down
17 changes: 17 additions & 0 deletions packages/devextreme/js/common/charts.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { HorizontalAlignment } from '../common';
import { Format } from '../localization';
import { BaseLegendItem } from '../viz/common';
import { baseSeriesObject } from '../viz/chart';

/**
* @public
Expand Down Expand Up @@ -739,3 +741,18 @@ export interface SeriesLabel {
*/
displayFormat?: string;
}

/**
* @public
* @docid
* @type object
* @inherits BaseLegendItem
* @namespace DevExpress.viz
*/
export interface LegendItem extends BaseLegendItem {
/**
* @docid
* @public
*/
series?: baseSeriesObject;
}
30 changes: 8 additions & 22 deletions packages/devextreme/js/viz/chart_components/base_chart.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {

import {
BaseLegend,
BaseLegendItem,
} from '../common';

import BaseWidget, {
Expand All @@ -37,11 +36,12 @@ import BaseWidget, {
} from '../core/base_widget';

import {
AnimationEaseMode,
SeriesLabel,
SeriesPoint,
Palette,
PaletteExtensionMode,
AnimationEaseMode,
LegendItem,
SeriesLabel,
SeriesPoint,
Palette,
PaletteExtensionMode,
} from '../../common/charts';

import {
Expand Down Expand Up @@ -261,14 +261,14 @@ export interface BaseChartLegend extends BaseLegend {
* @docid BaseChartOptions.legend.customizeItems
* @public
*/
customizeItems?: ((items: Array<BaseChartLegendItem>) => Array<BaseChartLegendItem>);
customizeItems?: ((items: Array<LegendItem>) => Array<LegendItem>);
/**
* @docid BaseChartOptions.legend.markerTemplate
* @default undefined
* @type_function_return string|SVGElement|jQuery
* @public
*/
markerTemplate?: template | ((legendItem: BaseChartLegendItem, element: SVGGElement) => string | UserDefinedElement<SVGElement>);
markerTemplate?: template | ((legendItem: LegendItem, element: SVGGElement) => string | UserDefinedElement<SVGElement>);
}
/**
* @hidden
Expand Down Expand Up @@ -367,20 +367,6 @@ export class BaseChart<TProperties> extends BaseWidget<TProperties> {
render(renderOptions: any): void;
}

/**
* @docid
* @type object
* @inherits BaseLegendItem
* @namespace DevExpress.viz
*/
export interface BaseChartLegendItem extends BaseLegendItem {
/**
* @docid
* @public
*/
series?: baseSeriesObject;
}

/**
* @docid
* @type object
Expand Down
26 changes: 11 additions & 15 deletions packages/devextreme/ts/dx.all.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30592,30 +30592,17 @@ declare module DevExpress.viz {
/**
* [descr:BaseChartOptions.legend.customizeItems]
*/
customizeItems?: (
items: Array<BaseChartLegendItem>
) => Array<BaseChartLegendItem>;
customizeItems?: (items: Array<LegendItem>) => Array<LegendItem>;
/**
* [descr:BaseChartOptions.legend.markerTemplate]
*/
markerTemplate?:
| DevExpress.core.template
| ((
legendItem: BaseChartLegendItem,
legendItem: LegendItem,
element: SVGGElement
) => string | DevExpress.core.UserDefinedElement<SVGElement>);
}
/**
* [descr:BaseChartLegendItem]
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
*/
export interface BaseChartLegendItem
extends DevExpress.common.charts.BaseLegendItem {
/**
* [descr:BaseChartLegendItem.series]
*/
series?: baseSeriesObject;
}
/**
* [descr:BaseChartOptions]
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
Expand Down Expand Up @@ -41837,6 +41824,15 @@ declare module DevExpress.viz {
* [descr:viz.getTheme(theme)]
*/
export function getTheme(theme: string): any;
/**
* [descr:LegendItem]
*/
export interface LegendItem extends DevExpress.common.charts.BaseLegendItem {
/**
* [descr:LegendItem.series]
*/
series?: baseSeriesObject;
}
/**
* [descr:MapLayer]
* @deprecated Attention! This type is for internal purposes only. If you used it previously, please submit a ticket to our {@link https://supportcenter.devexpress.com/ticket/create Support Center}. We will check if there is an alternative solution.
Expand Down

0 comments on commit 823a864

Please sign in to comment.