@praxisui/charts 8.0.0-beta.85 → 8.0.0-beta.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,7 +60,7 @@ class PraxisChartDataTransformerService {
60
60
  categories,
61
61
  series,
62
62
  slices: [],
63
- hasData: categories.length > 0 && series.some((item) => item.points.some((point) => point !== null)),
63
+ hasData: categories.length > 0 && series.some((item) => item.points.some((point) => this.hasPointValue(point))),
64
64
  };
65
65
  }
66
66
  transformPie(config, rows) {
@@ -79,13 +79,18 @@ class PraxisChartDataTransformerService {
79
79
  for (const row of rows) {
80
80
  const key = this.normalizeCategory(row[categoryField]);
81
81
  const nextValue = this.extractMetricValue(row, seriesConfig);
82
- bucket.set(key, (bucket.get(key) ?? 0) + nextValue);
82
+ const current = bucket.get(key);
83
+ bucket.set(key, {
84
+ value: (current?.value ?? 0) + nextValue,
85
+ source: current?.source ?? row,
86
+ });
83
87
  }
84
- const slices = Array.from(bucket.entries()).map(([name, value]) => ({
88
+ const slices = Array.from(bucket.entries()).map(([name, item]) => ({
85
89
  id: `${seriesConfig.id}:${name}`,
86
90
  name,
87
- value,
91
+ value: item.value,
88
92
  color: seriesConfig.color,
93
+ data: this.buildPointData(item.source, item.value),
89
94
  }));
90
95
  return {
91
96
  mode: 'pie',
@@ -117,10 +122,31 @@ class PraxisChartDataTransformerService {
117
122
  points: categories.map((category) => {
118
123
  const bucket = byCategory.get(category) ?? [];
119
124
  const value = bucket.length ? this.aggregate(bucket, seriesConfig) : null;
120
- return timeAxis ? [category, value] : value;
125
+ const source = bucket[0];
126
+ return source
127
+ ? this.buildPointData(source, timeAxis ? [category, value] : value)
128
+ : (timeAxis ? [category, value] : value);
121
129
  }),
122
130
  };
123
131
  }
132
+ buildPointData(row, value) {
133
+ return {
134
+ ...row,
135
+ value,
136
+ };
137
+ }
138
+ hasPointValue(point) {
139
+ if (point == null) {
140
+ return false;
141
+ }
142
+ if (typeof point === 'number') {
143
+ return Number.isFinite(point);
144
+ }
145
+ if (Array.isArray(point)) {
146
+ return point[1] != null;
147
+ }
148
+ return this.hasPointValue(point['value']);
149
+ }
124
150
  resolveCartesianSeriesType(config, seriesConfig) {
125
151
  if (config.type === 'combo') {
126
152
  return seriesConfig.type === 'bar' ? 'bar' : 'line';
@@ -161,7 +187,7 @@ class PraxisChartDataTransformerService {
161
187
  if (xValue === null || !Number.isFinite(yValue)) {
162
188
  return null;
163
189
  }
164
- return [xValue, yValue];
190
+ return this.buildPointData(row, [xValue, yValue]);
165
191
  })
166
192
  .filter((point) => point !== null);
167
193
  return {
@@ -312,6 +338,7 @@ class PraxisChartOptionBuilderService {
312
338
  },
313
339
  labelLine: labelsVisible ? { length: 14, length2: 12, lineStyle: { color: textColor } } : undefined,
314
340
  data: transformed.slices.map((slice) => ({
341
+ ...(slice.data || {}),
315
342
  name: slice.name,
316
343
  value: slice.value,
317
344
  itemStyle: slice.color ? { color: slice.color } : undefined,
@@ -822,8 +849,8 @@ class EChartsEngineAdapter {
822
849
  seriesId: params?.seriesId,
823
850
  seriesName: params?.seriesName,
824
851
  category: params?.name,
825
- value: params?.value,
826
- data: params?.data,
852
+ value: pointValue(params?.value ?? params?.data),
853
+ data: pointData(params?.name, params?.data ?? params?.value),
827
854
  });
828
855
  });
829
856
  const zrender = this.chart?.getZr?.();
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@praxisui/charts",
3
- "version": "8.0.0-beta.85",
3
+ "version": "8.0.0-beta.87",
4
4
  "description": "Metadata-driven charts library for Praxis UI Angular with engine adapters and Apache ECharts as the initial renderer.",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^21.0.0",
7
7
  "@angular/core": "^21.0.0",
8
- "@praxisui/core": "^8.0.0-beta.85",
8
+ "@praxisui/core": "^8.0.0-beta.87",
9
9
  "@angular/forms": "^21.0.0",
10
10
  "@angular/material": "^21.0.0",
11
- "@praxisui/table": "^8.0.0-beta.85",
11
+ "@praxisui/table": "^8.0.0-beta.87",
12
12
  "rxjs": "~7.8.0"
13
13
  },
14
14
  "dependencies": {
@@ -746,13 +746,14 @@ interface PraxisChartCartesianSeries {
746
746
  area?: boolean;
747
747
  color?: string;
748
748
  labelsVisible?: boolean;
749
- points: Array<number | null | [number | string, number | null]>;
749
+ points: Array<number | null | [number | string, number | null] | Record<string, unknown>>;
750
750
  }
751
751
  interface PraxisChartPieSlice {
752
752
  id: string;
753
753
  name: string;
754
754
  value: number;
755
755
  color?: string;
756
+ data?: Record<string, unknown>;
756
757
  }
757
758
  interface PraxisChartTransformedData {
758
759
  mode: 'cartesian' | 'pie' | 'scatter';
@@ -766,6 +767,8 @@ declare class PraxisChartDataTransformerService {
766
767
  private transformCartesian;
767
768
  private transformPie;
768
769
  private buildCartesianSeries;
770
+ private buildPointData;
771
+ private hasPointValue;
769
772
  private resolveCartesianSeriesType;
770
773
  private isAreaLikeSeries;
771
774
  private transformScatter;