3 Commits
Author SHA1 Message Date
saherelm f7b3cc65a3 last ... 2026-09-01 22:24:23 +03:30
saherelm 576136dbd3 last ... 2026-09-01 11:25:18 +03:30
saherelm 76dc91fb4b last works on x-chart components, adding separated features ... 2026-08-31 16:31:31 +03:30
2 changed files with 1120 additions and 243 deletions
File diff suppressed because it is too large Load Diff
@@ -13,6 +13,7 @@ import {
import { import {
XStandardType, XStandardType,
isValueInEnum, isValueInEnum,
getXColorValue,
XOneOrManyType, XOneOrManyType,
XColorIdentifier, XColorIdentifier,
XResourceIdentifier, XResourceIdentifier,
@@ -101,6 +102,41 @@ export type XChartXAxisAnnotations = XCahrtAxisBaseAnnotations & {
x2?: null | number | string; x2?: null | number | string;
}; };
export type XChartMarkerAnnotations = {
size?: number;
fillColor?: string;
strokeColor?: string;
strokeWidth?: number;
shape?: string;
offsetX?: number;
offsetY?: number;
cssClass?: string;
};
export type XChartTooltipAnnotations = {
enabled?: boolean;
/**
* Static tooltip content (HTML allowed; an array is joined with line
* breaks). Falls back to `label.text` when omitted.
*/
text?: string | string[];
/**
* Returns the tooltip markup (HTML). Takes precedence over `text`.
*/
formatter?: (opts: {
annotation: XChartPointAnnotations;
seriesIndex?: number;
id?: number | string;
w: any;
}) => string;
/**
* Tooltip theme. Falls back to the global `tooltip.theme`.
*/
theme?: 'light' | 'dark';
offsetX?: number;
offsetY?: number;
};
export type XChartPointAnnotations = { export type XChartPointAnnotations = {
id?: number | string; id?: number | string;
x?: number | string; x?: number | string;
@@ -115,16 +151,7 @@ export type XChartPointAnnotations = {
mouseEnter?: (annotation: XChartPointAnnotations, e: MouseEvent) => void; mouseEnter?: (annotation: XChartPointAnnotations, e: MouseEvent) => void;
mouseLeave?: (annotation: XChartPointAnnotations, e: MouseEvent) => void; mouseLeave?: (annotation: XChartPointAnnotations, e: MouseEvent) => void;
click?: (annotation: XChartPointAnnotations, e: MouseEvent) => void; click?: (annotation: XChartPointAnnotations, e: MouseEvent) => void;
marker?: { marker?: XChartMarkerAnnotations;
size?: number;
fillColor?: string;
strokeColor?: string;
strokeWidth?: number;
shape?: string;
offsetX?: number;
offsetY?: number;
cssClass?: string;
};
label?: XChartAnnotationLabel; label?: XChartAnnotationLabel;
image?: { image?: {
path?: string; path?: string;
@@ -137,29 +164,7 @@ export type XChartPointAnnotations = {
* Show a hover tooltip over the annotation marker, like a regular data * Show a hover tooltip over the annotation marker, like a regular data
* point. Useful for surfacing more detail than fits in the label. * point. Useful for surfacing more detail than fits in the label.
*/ */
tooltip?: { tooltip?: XChartTooltipAnnotations;
enabled?: boolean;
/**
* Static tooltip content (HTML allowed; an array is joined with line
* breaks). Falls back to `label.text` when omitted.
*/
text?: string | string[];
/**
* Returns the tooltip markup (HTML). Takes precedence over `text`.
*/
formatter?: (opts: {
annotation: XChartPointAnnotations;
seriesIndex?: number;
id?: number | string;
w: any;
}) => string;
/**
* Tooltip theme. Falls back to the global `tooltip.theme`.
*/
theme?: 'light' | 'dark';
offsetX?: number;
offsetY?: number;
};
/** /**
* Render arbitrary SVG markup at the annotation's position. Deprecated in * Render arbitrary SVG markup at the annotation's position. Deprecated in
* favor of `image`/`marker`, but still supported. * favor of `image`/`marker`, but still supported.
@@ -370,71 +375,71 @@ export type XChartAxisChartSeries = {
zIndex?: number; zIndex?: number;
parsing?: XChartParsing; parsing?: XChartParsing;
data: data:
| (number | null)[] | (number | null)[]
| { | {
/** /**
* A category label, a timestamp, or a `Date`. On a `datetime` axis all * A category label, a timestamp, or a `Date`. On a `datetime` axis all
* three keep millisecond resolution. * three keep millisecond resolution.
*/ */
x: string | number | Date; x: string | number | Date;
/** /**
* A plain value for most charts. For `candlestick`/`boxPlot`, the * A plain value for most charts. For `candlestick`/`boxPlot`, the
* summary array (`[O,H,L,C]` / `[min,Q1,median,Q3,max]`). For `violin`, an * summary array (`[O,H,L,C]` / `[min,Q1,median,Q3,max]`). For `violin`, an
* object carrying the precomputed density profile (`[value, weight]` pairs) * object carrying the precomputed density profile (`[value, weight]` pairs)
* plus the raw observations rendered as jitter. For a `scatter` strip plot * plus the raw observations rendered as jitter. For a `scatter` strip plot
* (`plotOptions.scatter.jitter`), the array of observations in this category. * (`plotOptions.scatter.jitter`), the array of observations in this category.
*/ */
y: y:
| number | number
| null | null
| number[] | number[]
| { density: [number, number][]; points?: number[] }; | { density: [number, number][]; points?: number[] };
/** /**
* Optional raw observations for a `boxPlot` data point, rendered as jitter * Optional raw observations for a `boxPlot` data point, rendered as jitter
* dots when `plotOptions.boxPlot.points.show` is enabled. * dots when `plotOptions.boxPlot.points.show` is enabled.
*/ */
points?: number[]; points?: number[];
fill?: XChartFill; fill?: XChartFill;
fillColor?: string; fillColor?: string;
strokeColor?: string; strokeColor?: string;
meta?: unknown; meta?: unknown;
/** /**
* A second metric that drives this point's COLOUR, independent of `y` * A second metric that drives this point's COLOUR, independent of `y`
* which drives its size (`treemap`). See * which drives its size (`treemap`). See
* `plotOptions.treemap.colorScale.colorValue` to read a different key. * `plotOptions.treemap.colorScale.colorValue` to read a different key.
*/ */
colorValue?: number; colorValue?: number;
/** /**
* Nested hierarchy: this point is a branch containing these children, * Nested hierarchy: this point is a branch containing these children,
* to any depth (`treemap`, `sunburst`). A branch normally omits `y` and * to any depth (`treemap`, `sunburst`). A branch normally omits `y` and
* takes the sum of its children instead. * takes the sum of its children instead.
*/ */
children?: XChartHierarchyNode[]; children?: XChartHierarchyNode[];
/** /**
* Drilldown target: the `id` of a `drilldown.series` entry. Clicking this * Drilldown target: the `id` of a `drilldown.series` entry. Clicking this
* point drills into that level. Requires the Drilldown feature. * point drills into that level. Requires the Drilldown feature.
*/ */
drilldown?: string | number; drilldown?: string | number;
goals?: { goals?: {
name?: string; name?: string;
value: number; value: number;
strokeHeight?: number; strokeHeight?: number;
strokeWidth?: number; strokeWidth?: number;
strokeColor?: string; strokeColor?: string;
strokeDashArray?: number; strokeDashArray?: number;
strokeLineCap?: 'butt' | 'square' | 'round'; strokeLineCap?: 'butt' | 'square' | 'round';
}[]; }[];
barHeightOffset?: number; barHeightOffset?: number;
columnWidthOffset?: number; columnWidthOffset?: number;
}[] }[]
| [number, number | null][] | [number, number | null][]
| [number, (number | null)[]][] | [number, (number | null)[]][]
| number[][] | number[][]
// A `children` hierarchy for the partition charts, where a branch carries no // A `children` hierarchy for the partition charts, where a branch carries no
// value of its own. Listed before the catch-all so authors get completion on // value of its own. Listed before the catch-all so authors get completion on
// the node shape instead of falling through to `Record<string, any>`. // the node shape instead of falling through to `Record<string, any>`.
| XChartHierarchyNode[] | XChartHierarchyNode[]
| Record<string, any>[]; | Record<string, any>[];
}[]; }[];
export type XChartNonAxisChartSeries = number[] | XChartAxisChartSeries; export type XChartNonAxisChartSeries = number[] | XChartAxisChartSeries;
@@ -931,11 +936,11 @@ export type XChartPlotOptions = {
* property, or an accessor to compute one. * property, or an accessor to compute one.
*/ */
colorValue?: colorValue?:
| string | string
| (( | ((
datum: any, datum: any,
opts: { seriesIndex: number; dataPointIndex: number; w: any }, opts: { seriesIndex: number; dataPointIndex: number; w: any },
) => number); ) => number);
/** /**
* Continuous interpolation between colour stops, for the metric above. * Continuous interpolation between colour stops, for the metric above.
* Active as soon as any datum carries a colour metric; `enabled: false` * Active as soon as any datum carries a colour metric; `enabled: false`
@@ -1068,13 +1073,13 @@ export type XChartPlotOptions = {
* 'custom': positions come from `positions`. * 'custom': positions come from `positions`.
*/ */
layout?: layout?:
| 'grouped' | 'grouped'
| 'packed' | 'packed'
| 'columns' | 'columns'
| 'grid' | 'grid'
| 'scatter' | 'scatter'
| 'arc' | 'arc'
| 'custom'; | 'custom';
/** /**
* `layout: 'custom'` only. The layout provider: either a function returning * `layout: 'custom'` only. The layout provider: either a function returning
* plot-pixel positions, or the name of one registered with * plot-pixel positions, or the name of one registered with
@@ -2102,19 +2107,19 @@ export interface XChartDrilldown {
/** Inline child levels referenced by data-point `drilldown` ids. */ /** Inline child levels referenced by data-point `drilldown` ids. */
series?: XChartDrilldownSeries[]; series?: XChartDrilldownSeries[];
breadcrumb?: breadcrumb?:
| false | false
| { | {
show?: boolean; show?: boolean;
position?: 'top-left' | 'top-right'; position?: 'top-left' | 'top-right';
separator?: string; separator?: string;
rootLabel?: string; rootLabel?: string;
offsetX?: number; offsetX?: number;
offsetY?: number; offsetY?: number;
formatter?( formatter?(
label: string, label: string,
opts: { index: number; depth: number }, opts: { index: number; depth: number },
): string; ): string;
}; };
animation?: { animation?: {
enabled?: boolean; enabled?: boolean;
/** /**
@@ -2163,11 +2168,11 @@ export interface XChartDrilldown {
* name, so the default ships no user-visible English. * name, so the default ships no user-visible English.
*/ */
loading?: loading?:
| false | false
| { | {
show?: boolean; show?: boolean;
text?: string; text?: string;
}; };
/** /**
* Cache levels resolved by `onDrillDown`, keyed by id, so drilling back down * Cache levels resolved by `onDrillDown`, keyed by id, so drilling back down
* a branch does not re-fetch. Default true. Clear it with the drilldown * a branch does not re-fetch. Default true. Clear it with the drilldown
@@ -2273,12 +2278,12 @@ export type XChartStates = {
export type XChartStroke = { export type XChartStroke = {
show?: boolean; show?: boolean;
curve?: curve?:
| 'smooth' | 'smooth'
| 'straight' | 'straight'
| 'stepline' | 'stepline'
| 'linestep' | 'linestep'
| 'monotoneCubic' | 'monotoneCubic'
| ('smooth' | 'straight' | 'stepline' | 'linestep' | 'monotoneCubic')[]; | ('smooth' | 'straight' | 'stepline' | 'linestep' | 'monotoneCubic')[];
lineCap?: 'butt' | 'square' | 'round'; lineCap?: 'butt' | 'square' | 'round';
colors?: string[]; colors?: string[];
width?: number | number[]; width?: number | number[];
@@ -2329,11 +2334,11 @@ export type XChartTheme = {
}; };
accessibility?: { accessibility?: {
colorBlindMode?: colorBlindMode?:
| 'deuteranopia' | 'deuteranopia'
| 'protanopia' | 'protanopia'
| 'tritanopia' | 'tritanopia'
| 'highContrast' | 'highContrast'
| ''; | '';
}; };
}; };
@@ -2362,14 +2367,14 @@ export type XChartTooltip = {
inverseOrder?: boolean; inverseOrder?: boolean;
arrow?: boolean; arrow?: boolean;
custom?: custom?:
| (( | ((
opts: XChartTooltipCustomOpts, opts: XChartTooltipCustomOpts,
) => string | number | Element | { nodeName: string }) ) => string | number | Element | { nodeName: string })
| Array< | Array<
( (
opts: XChartTooltipCustomOpts, opts: XChartTooltipCustomOpts,
) => string | number | Element | { nodeName: string } ) => string | number | Element | { nodeName: string }
>; >;
fillSeriesColor?: boolean; fillSeriesColor?: boolean;
theme?: 'light' | 'dark'; theme?: 'light' | 'dark';
cssClass?: string; cssClass?: string;
@@ -2407,6 +2412,8 @@ export type XChartTooltip = {
}; };
}; };
export type XChartColorType = Array<string | ((opts: XChartColorFormatterOpts) => string)>;
export interface XChartOptions { export interface XChartOptions {
annotations?: XChartAnnotations; annotations?: XChartAnnotations;
chart?: XChart; chart?: XChart;
@@ -2415,7 +2422,7 @@ export interface XChartOptions {
* named) or a function returning one per-datapoint. The list cycles when * named) or a function returning one per-datapoint. The list cycles when
* there are more series than colors. * there are more series than colors.
*/ */
colors?: Array<string | ((opts: XChartColorFormatterOpts) => string)>; colors?: XChartColorType;
dataLabels?: XChartDataLabels; dataLabels?: XChartDataLabels;
/** Opt-in drilldown navigation. Requires `import 'apexcharts/features/drilldown'`. */ /** Opt-in drilldown navigation. Requires `import 'apexcharts/features/drilldown'`. */
drilldown?: XChartDrilldown; drilldown?: XChartDrilldown;
@@ -2446,30 +2453,30 @@ export type XChart = {
width?: string | number; width?: string | number;
height?: string | number; height?: string | number;
type?: type?:
| 'line' | 'line'
| 'area' | 'area'
| 'bar' | 'bar'
| 'pie' | 'pie'
| 'donut' | 'donut'
| 'radialBar' | 'radialBar'
| 'scatter' | 'scatter'
| 'bubble' | 'bubble'
| 'heatmap' | 'heatmap'
| 'candlestick' | 'candlestick'
| 'boxPlot' | 'boxPlot'
| 'violin' | 'violin'
| 'histogram' | 'histogram'
| 'radar' | 'radar'
| 'polarArea' | 'polarArea'
| 'rangeBar' | 'rangeBar'
| 'rangeArea' | 'rangeArea'
| 'treemap' | 'treemap'
| 'unit' | 'unit'
| 'waffle' | 'waffle'
| 'sunburst' | 'sunburst'
| 'funnel' | 'funnel'
| 'pyramid' | 'pyramid'
| 'gauge'; | 'gauge';
/** /**
* Internal — populated when `type` is a first-class alias (`'funnel'`, * Internal — populated when `type` is a first-class alias (`'funnel'`,
* `'pyramid'`, `'gauge'`, `'waffle'`, `'histogram'`). The original requested * `'pyramid'`, `'gauge'`, `'waffle'`, `'histogram'`). The original requested
@@ -2752,9 +2759,9 @@ export type XChart = {
dimension?: (row: any) => any; dimension?: (row: any) => any;
/** FILTER mode: reduction over a bucket's rows. @default 'count' */ /** FILTER mode: reduction over a bucket's rows. @default 'count' */
reduce?: reduce?:
| 'count' | 'count'
| { sum?: string; avg?: string; min?: string; max?: string } | { sum?: string; avg?: string; min?: string; max?: string }
| ((rows: any[]) => number); | ((rows: any[]) => number);
/** /**
* FILTER mode: bucket kind. Else inferred: `bins` present => 'range', a * FILTER mode: bucket kind. Else inferred: `bins` present => 'range', a
* heatmap chart => 'matrix' (2D), otherwise 'category'. * heatmap chart => 'matrix' (2D), otherwise 'category'.
@@ -2872,21 +2879,21 @@ export type XChart = {
| 'yline' | 'yline'
| 'measure' | 'measure'
| { | {
id?: string; id?: string;
label?: string; label?: string;
icon?: string; icon?: string;
onClick?: ( onClick?: (
chart: ApexCharts, chart: ApexCharts,
context: { context: {
x: any; x: any;
y: any; y: any;
seriesIndex: number | null; seriesIndex: number | null;
dataPointIndex: number | null; dataPointIndex: number | null;
clientX: number; clientX: number;
clientY: number; clientY: number;
}, },
) => void; ) => void;
} }
>; >;
/** Override the built-in item labels. */ /** Override the built-in item labels. */
labels?: { labels?: {
@@ -3225,7 +3232,7 @@ export enum XChartAction {
export type XChartActionIdentifier = XChartAction | string; export type XChartActionIdentifier = XChartAction | string;
export interface XChartActionModel extends XBaseActionModel<XChartActionIdentifier> {} export interface XChartActionModel extends XBaseActionModel<XChartActionIdentifier> { }
export type XChartSeriesType = XChartAxisChartSeries | XChartNonAxisChartSeries; export type XChartSeriesType = XChartAxisChartSeries | XChartNonAxisChartSeries;
@@ -3323,6 +3330,18 @@ export interface IXChartContainer extends TXChartContainer {
series: XStandardType<XChartSeriesType>; series: XStandardType<XChartSeriesType>;
type: XStandardType<XChartTypeIdentifier>; type: XStandardType<XChartTypeIdentifier>;
//
stroke: XStandardType<XChartStroke>;
colors: XStandardType<XChartColorType>;
//
xAxis: XStandardType<XChartXAxis>;
yAxis: XStandardType<XOneOrManyType<XChartYAxis>>;
//
tooltip: XStandardType<XChartTooltip>;
annotations: XStandardType<XChartAnnotations>;
// //
title: XStandardType<XResourceIdentifier>; title: XStandardType<XResourceIdentifier>;
titleAlign: XStandardType<XChartTextAlignIdentifier>; titleAlign: XStandardType<XChartTextAlignIdentifier>;
@@ -3460,8 +3479,7 @@ export interface IXChartContainer extends TXChartContainer {
}) })
export class XChartContainer export class XChartContainer
extends XBaseContainer extends XBaseContainer
implements Readonly<IXChartContainer> implements Readonly<IXChartContainer> {
{
// //
readonly actionProvider = new Subject<XChartActionModel>(); readonly actionProvider = new Subject<XChartActionModel>();
readonly cssClass: XStandardType<XOneOrManyType<string>>; readonly cssClass: XStandardType<XOneOrManyType<string>>;
@@ -3471,7 +3489,22 @@ export class XChartContainer
readonly options: XStandardType<XChartOptions>; readonly options: XStandardType<XChartOptions>;
readonly zoomStep: XStandardType<number> = 0.125; readonly zoomStep: XStandardType<number> = 0.125;
readonly series: XStandardType<XChartSeriesType>; readonly series: XStandardType<XChartSeriesType>;
//
readonly stroke: XStandardType<XChartStroke> = {
width: 3,
curve: 'smooth'
};
readonly type: XStandardType<XChartTypeIdentifier> = XChartType.Line; readonly type: XStandardType<XChartTypeIdentifier> = XChartType.Line;
readonly colors: XStandardType<XChartColorType> = [getXColorValue(XColorWithBrightness.PrimaryShade)];
//
readonly xAxis: XStandardType<XChartXAxis>;
readonly yAxis: XStandardType<XOneOrManyType<XChartYAxis>>;
//
readonly tooltip: XStandardType<XChartTooltip>;
readonly annotations: XStandardType<XChartAnnotations>;
// //
readonly title: XStandardType<XResourceIdentifier>; readonly title: XStandardType<XResourceIdentifier>;
@@ -3671,8 +3704,7 @@ export class XChartContainer
@Component({ template: `` }) @Component({ template: `` })
export abstract class XChartContainerComponent export abstract class XChartContainerComponent
extends XBaseContainerComponent extends XBaseContainerComponent
implements IXChartContainer implements IXChartContainer {
{
// //
//#region Props ... //#region Props ...
@Input() @Input()
@@ -3698,6 +3730,24 @@ export abstract class XChartContainerComponent
@Input() @Input()
zoomStep: XStandardType<number> = this.propertyProvider.zoomStep; zoomStep: XStandardType<number> = this.propertyProvider.zoomStep;
@Input()
xAxis: XStandardType<XChartXAxis> = this.propertyProvider.xAxis;
@Input()
yAxis: XStandardType<XOneOrManyType<XChartYAxis>> = this.propertyProvider.yAxis;
@Input()
colors: XStandardType<XChartColorType> = this.propertyProvider.colors;
@Input()
stroke: XStandardType<XChartStroke> = this.propertyProvider.stroke;
@Input()
tooltip: XStandardType<XChartTooltip> = this.propertyProvider.tooltip;
@Input()
annotations: XStandardType<XChartAnnotations> = this.propertyProvider.annotations;
@Input() @Input()
defaultActionBarItemColor: XStandardType<XColorIdentifier> = defaultActionBarItemColor: XStandardType<XColorIdentifier> =
this.propertyProvider.defaultActionBarItemColor; this.propertyProvider.defaultActionBarItemColor;
@@ -4030,9 +4080,21 @@ export abstract class XChartContainerComponent
// //
type: this.getValue(container ? container.type : this.type), type: this.getValue(container ? container.type : this.type),
options: this.getValue(container ? container.options : this.options),
series: this.getValue(container ? container.series : this.series), series: this.getValue(container ? container.series : this.series),
options: this.getValue(container ? container.options : this.options),
zoomStep: this.getValue(container ? container.zoomStep : this.zoomStep), zoomStep: this.getValue(container ? container.zoomStep : this.zoomStep),
//
stroke: this.getValue(container ? container.stroke : this.stroke),
colors: this.getArrayValue(container ? container.colors : this.colors),
//
xAxis: this.getValue(container ? container.xAxis : this.xAxis),
yAxis: this.getValue(container ? container.yAxis : this.yAxis),
//
tooltip: this.getValue(container ? container.tooltip : this.tooltip),
annotations: this.getValue(container ? container.annotations : this.annotations),
// //
title: this.getValue(container ? container.title : this.title), title: this.getValue(container ? container.title : this.title),