@visionaris-bruno/vs-echarts 6.1.1 → 6.2.0
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.
|
@@ -19,6 +19,8 @@ const EChartsTokens = {
|
|
|
19
19
|
fontSize: 11,
|
|
20
20
|
axisColor: '#666',
|
|
21
21
|
lineColor: '#ddd',
|
|
22
|
+
sBorderColor: '#a0a0a0ff',
|
|
23
|
+
sShadowColor: '#2e2e2e80',
|
|
22
24
|
primaryColor: '#08B1D5',
|
|
23
25
|
tooltipBg: 'rgba(255, 255, 255, 0.95)',
|
|
24
26
|
defaultPalette: ['#08B1D5', '#2C3E50', '#F39C12', '#E74C3C', '#27AE60', '#8E44AD', '#3498DB', '#16A085', '#D35400', '#2980B9']
|
|
@@ -152,10 +154,6 @@ class BaseEchartsComponent {
|
|
|
152
154
|
updateSubject = new ReplaySubject(1);
|
|
153
155
|
updateSubscription;
|
|
154
156
|
chartInstance;
|
|
155
|
-
currentLegendSelected = null;
|
|
156
|
-
/** Estado de selección para filtros cruzados */
|
|
157
|
-
selectedCategoryIndex = null;
|
|
158
|
-
selectedSeriesIndex = null;
|
|
159
157
|
/** Opciones de inicializacion de echarts
|
|
160
158
|
*
|
|
161
159
|
* NgxEchartsDirective.initOpts
|
|
@@ -163,14 +161,12 @@ class BaseEchartsComponent {
|
|
|
163
161
|
initOptions = {
|
|
164
162
|
renderer: 'svg', // svg se visualiza mejor en el reescalado de tableros.
|
|
165
163
|
};
|
|
166
|
-
/** Opciones configuradas para ngx-echarts */
|
|
167
|
-
chartOptions = {};
|
|
168
|
-
mergeOptions = {};
|
|
169
164
|
constructor() {
|
|
170
165
|
this.updateSubscription = this.updateSubject.pipe(debounceTime(150)).subscribe(options => {
|
|
171
|
-
this.
|
|
166
|
+
this.setOptions(options);
|
|
172
167
|
});
|
|
173
168
|
}
|
|
169
|
+
// angular hooks //
|
|
174
170
|
ngOnChanges(changes) {
|
|
175
171
|
this.onInputChanges(changes);
|
|
176
172
|
}
|
|
@@ -178,33 +174,63 @@ class BaseEchartsComponent {
|
|
|
178
174
|
this.updateSubscription?.unsubscribe();
|
|
179
175
|
this.chartInstance?.dispose();
|
|
180
176
|
}
|
|
177
|
+
// metodos privados //
|
|
178
|
+
/** setear/actualizar opciones del chart
|
|
179
|
+
*
|
|
180
|
+
* Ver: https://echarts.apache.org/en/api.html#echartsInstance.setOption
|
|
181
|
+
*/
|
|
182
|
+
setOptions(chartOptions, opts) {
|
|
183
|
+
const notMerge = opts?.notMerge ?? true, silent = opts?.silent ?? false, replaceMerge = opts?.replaceMerge ?? [];
|
|
184
|
+
const _opts = {
|
|
185
|
+
notMerge,
|
|
186
|
+
silent,
|
|
187
|
+
replaceMerge,
|
|
188
|
+
};
|
|
189
|
+
this.chartInstance?.setOption(chartOptions, _opts);
|
|
190
|
+
}
|
|
191
|
+
// metodos protegidos //
|
|
192
|
+
dispatchAction(type, d) {
|
|
193
|
+
if (this.chartInstance == undefined)
|
|
194
|
+
return;
|
|
195
|
+
const { seriesIndex = [], dataIndex = [], } = d;
|
|
196
|
+
this.chartInstance.dispatchAction({
|
|
197
|
+
type,
|
|
198
|
+
seriesIndex,
|
|
199
|
+
dataIndex,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
;
|
|
181
203
|
/**
|
|
182
|
-
*
|
|
204
|
+
* Hook de template method invocado por `ngOnChanges`.
|
|
205
|
+
* Las subclases lo sobreescriben para añadir lógica propia
|
|
206
|
+
* y deben llamar a `super.onInputChanges(changes)` para preservar
|
|
207
|
+
* el comportamiento base (detectar inputs relevantes y actualizar el chart).
|
|
183
208
|
*/
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
209
|
+
onInputChanges(changes) {
|
|
210
|
+
if (changes['data'] || changes['optionsOverrides'] || changes['palette'] || changes['colorResolver'] || changes['valueFormatter']) {
|
|
211
|
+
this.updateChartOptions();
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Gatilla actualización.
|
|
216
|
+
*
|
|
217
|
+
*/
|
|
218
|
+
triggerUpdate(options) {
|
|
219
|
+
this.updateSubject.next(options);
|
|
188
220
|
}
|
|
221
|
+
// metodos publicos //
|
|
189
222
|
/**
|
|
190
|
-
*
|
|
223
|
+
* Captura la instancia de echarts (usado por ngx-echarts)
|
|
191
224
|
*/
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
const zr = this.chartInstance.getZr();
|
|
196
|
-
zr.on('click', (params) => {
|
|
197
|
-
if (!params.target) {
|
|
198
|
-
this.clearSelection();
|
|
199
|
-
}
|
|
200
|
-
});
|
|
225
|
+
onChartInit(instance) {
|
|
226
|
+
this.chartInstance = instance;
|
|
227
|
+
this.updateChartOptions();
|
|
201
228
|
}
|
|
202
229
|
onChartClick(event) {
|
|
203
230
|
if (event.componentType === 'series') {
|
|
204
231
|
const index = event.dataIndex;
|
|
205
232
|
const seriesIndex = event.seriesIndex;
|
|
206
233
|
if (index !== undefined && index >= 0) {
|
|
207
|
-
this.handleSelection(index, seriesIndex);
|
|
208
234
|
// Emit standardized payload for cross-filtering
|
|
209
235
|
this.chartClick.emit({
|
|
210
236
|
type: 'cross-filter',
|
|
@@ -218,70 +244,36 @@ class BaseEchartsComponent {
|
|
|
218
244
|
}
|
|
219
245
|
}
|
|
220
246
|
/**
|
|
221
|
-
*
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (isSamePoint) {
|
|
226
|
-
this.clearSelection();
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
this.selectedCategoryIndex = dataIndex;
|
|
230
|
-
this.selectedSeriesIndex = seriesIndex;
|
|
231
|
-
this.updateChartOptions();
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* Limpia el estado de selección actual.
|
|
236
|
-
*/
|
|
237
|
-
clearSelection() {
|
|
238
|
-
this.selectedCategoryIndex = null;
|
|
239
|
-
this.selectedSeriesIndex = null;
|
|
240
|
-
this.updateChartOptions();
|
|
241
|
-
}
|
|
242
|
-
dispatchAction(type, d) {
|
|
243
|
-
if (this.chartInstance == undefined)
|
|
244
|
-
return;
|
|
245
|
-
const { seriesIndex = [], dataIndex = [], } = d;
|
|
246
|
-
this.chartInstance.dispatchAction({
|
|
247
|
-
type,
|
|
248
|
-
seriesIndex,
|
|
249
|
-
dataIndex,
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Maneja clics en la leyenda para persistir filtros.
|
|
254
|
-
*/
|
|
255
|
-
onLegendSelectChanged(event) {
|
|
256
|
-
if (event && event.selected) {
|
|
257
|
-
this.currentLegendSelected = event.selected;
|
|
258
|
-
this.updateChartOptions();
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
updateOptions(options) {
|
|
262
|
-
this.chartOptions = { ...options };
|
|
263
|
-
this.chartInstance?.setOption(options, { notMerge: true });
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Hook de template method invocado por `ngOnChanges`.
|
|
267
|
-
* Las subclases lo sobreescriben para añadir lógica propia
|
|
268
|
-
* y deben llamar a `super.onInputChanges(changes)` para preservar
|
|
269
|
-
* el comportamiento base (detectar inputs relevantes y actualizar el chart).
|
|
247
|
+
* Seleccion y des seleccion de item.
|
|
248
|
+
*
|
|
249
|
+
* Para hacer uso de esta funcion las opciones de series
|
|
250
|
+
* del grafico deben tener seteado 'selectMode'.
|
|
270
251
|
*/
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
252
|
+
onChartSelectChanged(event) {
|
|
253
|
+
const { type = '', fromActionPayload, fromAction = '', isFromClick, selected, } = event;
|
|
254
|
+
if (!isFromClick)
|
|
255
|
+
return; // avoid internal ECharts selection loop.
|
|
256
|
+
// limpiar seleccion
|
|
257
|
+
const seriesIndexes = selected.map(s => s.seriesIndex);
|
|
258
|
+
const dataIndexes = selected.flatMap(s => s.dataIndex.map(d => d));
|
|
259
|
+
const ud = {
|
|
260
|
+
seriesIndex: seriesIndexes,
|
|
261
|
+
dataIndex: dataIndexes,
|
|
262
|
+
};
|
|
263
|
+
this.dispatchAction('unselect', ud);
|
|
264
|
+
// seleccionar
|
|
265
|
+
if (fromAction == 'unselect') {
|
|
266
|
+
return; // avoid selection loop by same.
|
|
274
267
|
}
|
|
268
|
+
const sd = {
|
|
269
|
+
seriesIndex: [fromActionPayload.seriesIndex],
|
|
270
|
+
dataIndex: [fromActionPayload.dataIndexInside],
|
|
271
|
+
};
|
|
272
|
+
this.dispatchAction('select', sd);
|
|
275
273
|
}
|
|
276
274
|
/**
|
|
277
|
-
*
|
|
275
|
+
* Método público para forzar el redimensionado desde el padre
|
|
278
276
|
*/
|
|
279
|
-
triggerUpdate(options) {
|
|
280
|
-
this.updateSubject.next(options);
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Método público para forzar el redimensionado desde el padre
|
|
284
|
-
*/
|
|
285
277
|
resize() {
|
|
286
278
|
this.chartInstance?.resize();
|
|
287
279
|
}
|
|
@@ -490,7 +482,7 @@ function getTooltipOptions(overrides) {
|
|
|
490
482
|
* @param selectedSeriesIndex Index of the selected series
|
|
491
483
|
* @returns Modified series array
|
|
492
484
|
*/
|
|
493
|
-
function applyLineSelectionStyle
|
|
485
|
+
function applyLineSelectionStyle(series, selectedCategoryIndex, selectedSeriesIndex) {
|
|
494
486
|
if (selectedCategoryIndex === null || !series)
|
|
495
487
|
return series;
|
|
496
488
|
return series.map((s, sIdx) => {
|
|
@@ -873,13 +865,13 @@ class EchartsRingComponent extends BaseEchartsComponent {
|
|
|
873
865
|
emphasis: {
|
|
874
866
|
scale: true,
|
|
875
867
|
scaleSize: 2,
|
|
876
|
-
itemStyle: {
|
|
877
|
-
borderColor: '#fff',
|
|
878
|
-
},
|
|
879
868
|
},
|
|
880
869
|
select: {
|
|
881
870
|
itemStyle: {
|
|
882
|
-
borderColor:
|
|
871
|
+
borderColor: EChartsTokens.sBorderColor,
|
|
872
|
+
shadowColor: EChartsTokens.sShadowColor,
|
|
873
|
+
borderWidth: 1,
|
|
874
|
+
shadowBlur: 4,
|
|
883
875
|
},
|
|
884
876
|
},
|
|
885
877
|
animationType: 'scale',
|
|
@@ -909,7 +901,6 @@ class EchartsRingComponent extends BaseEchartsComponent {
|
|
|
909
901
|
this.lastSelectedSeriesIndex = null;
|
|
910
902
|
this.lastSelectedDataIndex = null;
|
|
911
903
|
this.selectedPercent = null;
|
|
912
|
-
this.currentLegendSelected = null;
|
|
913
904
|
this.currentGraphicText = '';
|
|
914
905
|
}
|
|
915
906
|
super.onInputChanges(changes);
|
|
@@ -928,11 +919,6 @@ class EchartsRingComponent extends BaseEchartsComponent {
|
|
|
928
919
|
this.lastSelectedDataIndex = null;
|
|
929
920
|
this.selectedPercent = null;
|
|
930
921
|
this.setGraphicText('');
|
|
931
|
-
this.chartInstance.dispatchAction({
|
|
932
|
-
type: 'unselect',
|
|
933
|
-
seriesIndex: event.seriesIndex,
|
|
934
|
-
dataIndex: event.dataIndex
|
|
935
|
-
});
|
|
936
922
|
}
|
|
937
923
|
else {
|
|
938
924
|
// SELECT
|
|
@@ -961,29 +947,44 @@ class EchartsRingComponent extends BaseEchartsComponent {
|
|
|
961
947
|
this.setGraphicText('');
|
|
962
948
|
}
|
|
963
949
|
}
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
950
|
+
onChartSelectChangedParcheado(e) {
|
|
951
|
+
/** corrige inside data index cuando se filtran leyendas en ring.
|
|
952
|
+
*
|
|
953
|
+
* En ring, cuando se filtran leyendas, no coinciden el 'inside data index'
|
|
954
|
+
* con el 'selected data index'. El correcto deberia ser el 'inside data intex'
|
|
955
|
+
* pero en ring por algun motivo esto es distinto.
|
|
956
|
+
*
|
|
957
|
+
* apache echarts version: 5.6.0
|
|
958
|
+
*/
|
|
959
|
+
const patchedEvent = (e) => {
|
|
960
|
+
/** selected serie index */
|
|
961
|
+
const ssi = e.fromActionPayload.seriesIndex;
|
|
962
|
+
const selected = e.selected.find(sel => sel.seriesIndex == ssi);
|
|
963
|
+
if (e.fromAction == 'unselect' || !selected) {
|
|
964
|
+
return e;
|
|
965
|
+
}
|
|
966
|
+
const fixedDataIndex = selected.dataIndex[0]; // [0] por seleccion single;
|
|
967
|
+
e.fromActionPayload.dataIndexInside = fixedDataIndex; // aplico corrección de index inside.
|
|
968
|
+
return e;
|
|
969
|
+
};
|
|
970
|
+
super.onChartSelectChanged(patchedEvent(e)); // continuo flujo convencional
|
|
977
971
|
}
|
|
978
972
|
/**
|
|
979
973
|
* Actualiza el texto del Graphic central y persiste la selección en el modelo de opciones.
|
|
980
974
|
*/
|
|
981
975
|
setGraphicText(text) {
|
|
982
976
|
this.currentGraphicText = text;
|
|
983
|
-
|
|
977
|
+
// Persistencia de GRAPHIC (KPI central)
|
|
978
|
+
this.chartInstance?.setOption({
|
|
979
|
+
graphic: {
|
|
980
|
+
style: {
|
|
981
|
+
text: this.currentGraphicText,
|
|
982
|
+
opacity: this.currentGraphicText ? 1 : 0,
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
});
|
|
984
986
|
}
|
|
985
|
-
updateChartOptions(
|
|
986
|
-
const notMerge = opts?.notMerge ?? false;
|
|
987
|
+
updateChartOptions() {
|
|
987
988
|
if (!this.chartInstance)
|
|
988
989
|
return;
|
|
989
990
|
if (!this.data)
|
|
@@ -996,49 +997,18 @@ class EchartsRingComponent extends BaseEchartsComponent {
|
|
|
996
997
|
};
|
|
997
998
|
this.make(makeOpts);
|
|
998
999
|
// 2. Obtenemos las bases del chart usando el builder
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
if (options.graphic && Array.isArray(options.graphic)) {
|
|
1002
|
-
const graphic = options.graphic[0];
|
|
1003
|
-
if (graphic && graphic.style) {
|
|
1004
|
-
graphic.style.text = this.currentGraphicText;
|
|
1005
|
-
graphic.style.opacity = this.currentGraphicText ? 1 : 0;
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
// 4. Persistencia de SELECCIÓN (sector elevado)
|
|
1009
|
-
if (options.series && Array.isArray(options.series)) {
|
|
1010
|
-
options.series.forEach((s, sIdx) => {
|
|
1011
|
-
if (s.data && Array.isArray(s.data)) {
|
|
1012
|
-
s.data.forEach((item, dIdx) => {
|
|
1013
|
-
if (typeof item === 'object') {
|
|
1014
|
-
item.selected = (sIdx === this.lastSelectedSeriesIndex && dIdx === this.lastSelectedDataIndex);
|
|
1015
|
-
}
|
|
1016
|
-
});
|
|
1017
|
-
}
|
|
1018
|
-
});
|
|
1019
|
-
}
|
|
1020
|
-
// 5. Persistencia de LEYENDA (filtros de usuario)
|
|
1021
|
-
if (this.currentLegendSelected && options.legend) {
|
|
1022
|
-
options.legend = {
|
|
1023
|
-
...options.legend,
|
|
1024
|
-
selected: { ...this.currentLegendSelected }
|
|
1025
|
-
};
|
|
1026
|
-
}
|
|
1027
|
-
if (notMerge) {
|
|
1028
|
-
// Gatillar actualización en ngx-echarts
|
|
1029
|
-
this.triggerUpdate(options);
|
|
1030
|
-
}
|
|
1031
|
-
this.mergeOptions = { ...options };
|
|
1000
|
+
const options = this.builder.getResult();
|
|
1001
|
+
this.triggerUpdate(options);
|
|
1032
1002
|
}
|
|
1033
1003
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsRingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1034
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EchartsRingComponent, isStandalone: true, selector: "vs-echarts-ring", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div class=\"echarts-container\" \n echarts \n [options]=\"
|
|
1004
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EchartsRingComponent, isStandalone: true, selector: "vs-echarts-ring", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div class=\"echarts-container\" \n echarts \n [options]=\"{}\"\n [initOpts]=\"initOptions\"\n [autoResize]=\"true\" \n (chartInit)=\"onChartInit($event)\" \n (chartClick)=\"onChartClick($event)\" \n (chartMouseOver)=\"onChartMouseOver($event)\" \n (chartMouseOut)=\"onChartMouseOut($event)\" \n (chartSelectChanged)=\"onChartSelectChangedParcheado($event)\"\n></div>\n ", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: NgxEchartsDirective, selector: "echarts, [echarts]", inputs: ["options", "theme", "initOpts", "merge", "autoResize", "loading", "loadingType", "loadingOpts"], outputs: ["chartInit", "optionsError", "chartClick", "chartDblClick", "chartMouseDown", "chartMouseMove", "chartMouseUp", "chartMouseOver", "chartMouseOut", "chartGlobalOut", "chartContextMenu", "chartHighlight", "chartDownplay", "chartSelectChanged", "chartLegendSelectChanged", "chartLegendSelected", "chartLegendUnselected", "chartLegendLegendSelectAll", "chartLegendLegendInverseSelect", "chartLegendScroll", "chartDataZoom", "chartDataRangeSelected", "chartGraphRoam", "chartGeoRoam", "chartTreeRoam", "chartTimelineChanged", "chartTimelinePlayChanged", "chartRestore", "chartDataViewChanged", "chartMagicTypeChanged", "chartGeoSelectChanged", "chartGeoSelected", "chartGeoUnselected", "chartAxisAreaSelected", "chartBrush", "chartBrushEnd", "chartBrushSelected", "chartGlobalCursorTaken", "chartRendered", "chartFinished"], exportAs: ["echarts"] }] });
|
|
1035
1005
|
}
|
|
1036
1006
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsRingComponent, decorators: [{
|
|
1037
1007
|
type: Component,
|
|
1038
1008
|
args: [{ selector: 'vs-echarts-ring', standalone: true, imports: [
|
|
1039
1009
|
CommonModule,
|
|
1040
1010
|
NgxEchartsDirective,
|
|
1041
|
-
], providers: [provideVSEcharts()], template: "<div class=\"echarts-container\" \n echarts \n [options]=\"
|
|
1011
|
+
], providers: [provideVSEcharts()], template: "<div class=\"echarts-container\" \n echarts \n [options]=\"{}\"\n [initOpts]=\"initOptions\"\n [autoResize]=\"true\" \n (chartInit)=\"onChartInit($event)\" \n (chartClick)=\"onChartClick($event)\" \n (chartMouseOver)=\"onChartMouseOver($event)\" \n (chartMouseOut)=\"onChartMouseOut($event)\" \n (chartSelectChanged)=\"onChartSelectChangedParcheado($event)\"\n></div>\n ", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"] }]
|
|
1042
1012
|
}], ctorParameters: () => [] });
|
|
1043
1013
|
|
|
1044
1014
|
/**
|
|
@@ -1232,9 +1202,7 @@ class EchartsBarComponent extends BaseEchartsComponent {
|
|
|
1232
1202
|
*/
|
|
1233
1203
|
baseSeriesOptions = {
|
|
1234
1204
|
type: 'bar',
|
|
1235
|
-
|
|
1236
|
-
barGap: '15%',
|
|
1237
|
-
barCategoryGap: '35%',
|
|
1205
|
+
barGap: '10%',
|
|
1238
1206
|
animation: true,
|
|
1239
1207
|
animationDuration: 1000,
|
|
1240
1208
|
animationEasing: 'cubicOut',
|
|
@@ -1249,6 +1217,15 @@ class EchartsBarComponent extends BaseEchartsComponent {
|
|
|
1249
1217
|
backgroundStyle: {
|
|
1250
1218
|
color: 'rgba(180, 180, 180, 0.2)' // gris claro
|
|
1251
1219
|
},
|
|
1220
|
+
selectedMode: 'single',
|
|
1221
|
+
select: {
|
|
1222
|
+
itemStyle: {
|
|
1223
|
+
borderWidth: 1,
|
|
1224
|
+
borderColor: EChartsTokens.sBorderColor,
|
|
1225
|
+
shadowColor: EChartsTokens.sShadowColor,
|
|
1226
|
+
shadowBlur: 6,
|
|
1227
|
+
}
|
|
1228
|
+
},
|
|
1252
1229
|
label: {
|
|
1253
1230
|
show: false,
|
|
1254
1231
|
position: 'top',
|
|
@@ -1282,101 +1259,17 @@ class EchartsBarComponent extends BaseEchartsComponent {
|
|
|
1282
1259
|
};
|
|
1283
1260
|
this.make(makeBarOpts);
|
|
1284
1261
|
const baseOptions = this.builder.getResult();
|
|
1285
|
-
if (this.currentLegendSelected && baseOptions.legend) {
|
|
1286
|
-
baseOptions.legend.selected = { ...this.currentLegendSelected };
|
|
1287
|
-
}
|
|
1288
|
-
if (this.selectedCategoryIndex !== null && baseOptions.series) {
|
|
1289
|
-
const seriesArray = baseOptions.series;
|
|
1290
|
-
baseOptions.series = seriesArray.map((s, sIdx) => {
|
|
1291
|
-
if (s.type === 'bar' && Array.isArray(s.data)) {
|
|
1292
|
-
return {
|
|
1293
|
-
...s,
|
|
1294
|
-
emphasis: {
|
|
1295
|
-
disabled: true
|
|
1296
|
-
},
|
|
1297
|
-
data: s.data.map((val, idx) => {
|
|
1298
|
-
const isSelected = idx === this.selectedCategoryIndex;
|
|
1299
|
-
const isBarSelected = isSelected && sIdx === this.selectedSeriesIndex;
|
|
1300
|
-
const itemVal = (val && typeof val === 'object' && val.value !== undefined) ? val.value : val;
|
|
1301
|
-
return {
|
|
1302
|
-
value: itemVal,
|
|
1303
|
-
itemStyle: {
|
|
1304
|
-
opacity: isSelected ? (isBarSelected ? 1 : 0.5) : 0.15,
|
|
1305
|
-
borderWidth: 0
|
|
1306
|
-
}
|
|
1307
|
-
};
|
|
1308
|
-
})
|
|
1309
|
-
};
|
|
1310
|
-
}
|
|
1311
|
-
return s;
|
|
1312
|
-
});
|
|
1313
|
-
}
|
|
1314
1262
|
this.triggerUpdate(baseOptions);
|
|
1315
1263
|
}
|
|
1316
|
-
onChartInit(instance) {
|
|
1317
|
-
super.onChartInit(instance);
|
|
1318
|
-
this.setupAdditionalInteractions();
|
|
1319
|
-
}
|
|
1320
|
-
onInputChanges(changes) {
|
|
1321
|
-
if (changes['data']) {
|
|
1322
|
-
this.selectedCategoryIndex = null;
|
|
1323
|
-
this.selectedSeriesIndex = null;
|
|
1324
|
-
this.currentLegendSelected = null;
|
|
1325
|
-
}
|
|
1326
|
-
super.onInputChanges(changes);
|
|
1327
|
-
}
|
|
1328
|
-
setupAdditionalInteractions() {
|
|
1329
|
-
if (!this.chartInstance)
|
|
1330
|
-
return;
|
|
1331
|
-
// 1. ZRender click para sectores de fondo (específico para barras)
|
|
1332
|
-
const zr = this.chartInstance.getZr();
|
|
1333
|
-
zr.on('click', (params) => {
|
|
1334
|
-
if (!params.target) {
|
|
1335
|
-
const pointInPixel = [params.offsetX, params.offsetY];
|
|
1336
|
-
if (this.chartInstance.containPixel('grid', pointInPixel)) {
|
|
1337
|
-
const xIndexResult = this.chartInstance.convertFromPixel({ xAxisIndex: 0 }, pointInPixel);
|
|
1338
|
-
const xIndex = Array.isArray(xIndexResult) ? xIndexResult[0] : xIndexResult;
|
|
1339
|
-
if (typeof xIndex === 'number' && xIndex >= 0) {
|
|
1340
|
-
this.handleSelection(xIndex, -1);
|
|
1341
|
-
}
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
});
|
|
1345
|
-
}
|
|
1346
|
-
highlightSector(index) {
|
|
1347
|
-
if (!this.chartInstance || this.selectedCategoryIndex !== null)
|
|
1348
|
-
return;
|
|
1349
|
-
const seriesCount = Array.isArray(this.chartOptions.series) ? this.chartOptions.series.length : 0;
|
|
1350
|
-
this.chartInstance.dispatchAction({
|
|
1351
|
-
type: 'highlight',
|
|
1352
|
-
seriesIndex: Array.from({ length: seriesCount }, (_, i) => i),
|
|
1353
|
-
dataIndex: index
|
|
1354
|
-
});
|
|
1355
|
-
}
|
|
1356
|
-
clearHighlight() {
|
|
1357
|
-
if (!this.chartInstance)
|
|
1358
|
-
return;
|
|
1359
|
-
const seriesCount = Array.isArray(this.chartOptions.series) ? this.chartOptions.series.length : 0;
|
|
1360
|
-
this.chartInstance.dispatchAction({
|
|
1361
|
-
type: 'downplay',
|
|
1362
|
-
seriesIndex: Array.from({ length: seriesCount }, (_, i) => i)
|
|
1363
|
-
});
|
|
1364
|
-
}
|
|
1365
|
-
onLegendSelectChanged(event) {
|
|
1366
|
-
if (event && event.selected) {
|
|
1367
|
-
this.currentLegendSelected = event.selected;
|
|
1368
|
-
this.updateChartOptions();
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
1264
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1372
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EchartsBarComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div class=\"echarts-container\" echarts [
|
|
1265
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EchartsBarComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div class=\"echarts-container\" echarts \n [options]=\"{}\"\n [initOpts]=\"initOptions\" \n [autoResize]=\"true\" \n (chartInit)=\"onChartInit($event)\" \n (chartClick)=\"onChartClick($event)\" \n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>\n", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: NgxEchartsDirective, selector: "echarts, [echarts]", inputs: ["options", "theme", "initOpts", "merge", "autoResize", "loading", "loadingType", "loadingOpts"], outputs: ["chartInit", "optionsError", "chartClick", "chartDblClick", "chartMouseDown", "chartMouseMove", "chartMouseUp", "chartMouseOver", "chartMouseOut", "chartGlobalOut", "chartContextMenu", "chartHighlight", "chartDownplay", "chartSelectChanged", "chartLegendSelectChanged", "chartLegendSelected", "chartLegendUnselected", "chartLegendLegendSelectAll", "chartLegendLegendInverseSelect", "chartLegendScroll", "chartDataZoom", "chartDataRangeSelected", "chartGraphRoam", "chartGeoRoam", "chartTreeRoam", "chartTimelineChanged", "chartTimelinePlayChanged", "chartRestore", "chartDataViewChanged", "chartMagicTypeChanged", "chartGeoSelectChanged", "chartGeoSelected", "chartGeoUnselected", "chartAxisAreaSelected", "chartBrush", "chartBrushEnd", "chartBrushSelected", "chartGlobalCursorTaken", "chartRendered", "chartFinished"], exportAs: ["echarts"] }] });
|
|
1373
1266
|
}
|
|
1374
1267
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsBarComponent, decorators: [{
|
|
1375
1268
|
type: Component,
|
|
1376
1269
|
args: [{ selector: 'vs-echarts-bar', standalone: true, imports: [
|
|
1377
1270
|
CommonModule,
|
|
1378
1271
|
NgxEchartsDirective,
|
|
1379
|
-
], providers: [provideVSEcharts()], template: "<div class=\"echarts-container\" echarts [
|
|
1272
|
+
], providers: [provideVSEcharts()], template: "<div class=\"echarts-container\" echarts \n [options]=\"{}\"\n [initOpts]=\"initOptions\" \n [autoResize]=\"true\" \n (chartInit)=\"onChartInit($event)\" \n (chartClick)=\"onChartClick($event)\" \n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>\n", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"] }]
|
|
1380
1273
|
}], ctorParameters: () => [] });
|
|
1381
1274
|
|
|
1382
1275
|
class EChartsHBarComponent extends EchartsBarComponent {
|
|
@@ -1402,14 +1295,14 @@ class EChartsHBarComponent extends EchartsBarComponent {
|
|
|
1402
1295
|
this.director.makeBar(this.data, this.optionsOverrides, makeOpts);
|
|
1403
1296
|
}
|
|
1404
1297
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsHBarComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1405
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EChartsHBarComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div class=\"echarts-container\" echarts [
|
|
1298
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EChartsHBarComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div class=\"echarts-container\" echarts \n [options]=\"{}\"\n [initOpts]=\"initOptions\" \n [autoResize]=\"true\" \n (chartInit)=\"onChartInit($event)\" \n (chartClick)=\"onChartClick($event)\" \n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>\n", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: NgxEchartsDirective, selector: "echarts, [echarts]", inputs: ["options", "theme", "initOpts", "merge", "autoResize", "loading", "loadingType", "loadingOpts"], outputs: ["chartInit", "optionsError", "chartClick", "chartDblClick", "chartMouseDown", "chartMouseMove", "chartMouseUp", "chartMouseOver", "chartMouseOut", "chartGlobalOut", "chartContextMenu", "chartHighlight", "chartDownplay", "chartSelectChanged", "chartLegendSelectChanged", "chartLegendSelected", "chartLegendUnselected", "chartLegendLegendSelectAll", "chartLegendLegendInverseSelect", "chartLegendScroll", "chartDataZoom", "chartDataRangeSelected", "chartGraphRoam", "chartGeoRoam", "chartTreeRoam", "chartTimelineChanged", "chartTimelinePlayChanged", "chartRestore", "chartDataViewChanged", "chartMagicTypeChanged", "chartGeoSelectChanged", "chartGeoSelected", "chartGeoUnselected", "chartAxisAreaSelected", "chartBrush", "chartBrushEnd", "chartBrushSelected", "chartGlobalCursorTaken", "chartRendered", "chartFinished"], exportAs: ["echarts"] }] });
|
|
1406
1299
|
}
|
|
1407
1300
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsHBarComponent, decorators: [{
|
|
1408
1301
|
type: Component,
|
|
1409
1302
|
args: [{ selector: 'vs-echarts-bar', standalone: true, imports: [
|
|
1410
1303
|
CommonModule,
|
|
1411
1304
|
NgxEchartsDirective,
|
|
1412
|
-
], providers: [provideVSEcharts()], template: "<div class=\"echarts-container\" echarts [
|
|
1305
|
+
], providers: [provideVSEcharts()], template: "<div class=\"echarts-container\" echarts \n [options]=\"{}\"\n [initOpts]=\"initOptions\" \n [autoResize]=\"true\" \n (chartInit)=\"onChartInit($event)\" \n (chartClick)=\"onChartClick($event)\" \n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>\n", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"] }]
|
|
1413
1306
|
}] });
|
|
1414
1307
|
|
|
1415
1308
|
class EChartsBarStackedComponent extends EchartsBarComponent {
|
|
@@ -1432,14 +1325,14 @@ class EChartsBarStackedComponent extends EchartsBarComponent {
|
|
|
1432
1325
|
builder = new EChartBuilder(this.variantBaseProduct);
|
|
1433
1326
|
director = new VSECDirector(this.builder);
|
|
1434
1327
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsBarStackedComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1435
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EChartsBarStackedComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div class=\"echarts-container\" echarts [
|
|
1328
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EChartsBarStackedComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div class=\"echarts-container\" echarts \n [options]=\"{}\"\n [initOpts]=\"initOptions\" \n [autoResize]=\"true\" \n (chartInit)=\"onChartInit($event)\" \n (chartClick)=\"onChartClick($event)\" \n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>\n", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: NgxEchartsDirective, selector: "echarts, [echarts]", inputs: ["options", "theme", "initOpts", "merge", "autoResize", "loading", "loadingType", "loadingOpts"], outputs: ["chartInit", "optionsError", "chartClick", "chartDblClick", "chartMouseDown", "chartMouseMove", "chartMouseUp", "chartMouseOver", "chartMouseOut", "chartGlobalOut", "chartContextMenu", "chartHighlight", "chartDownplay", "chartSelectChanged", "chartLegendSelectChanged", "chartLegendSelected", "chartLegendUnselected", "chartLegendLegendSelectAll", "chartLegendLegendInverseSelect", "chartLegendScroll", "chartDataZoom", "chartDataRangeSelected", "chartGraphRoam", "chartGeoRoam", "chartTreeRoam", "chartTimelineChanged", "chartTimelinePlayChanged", "chartRestore", "chartDataViewChanged", "chartMagicTypeChanged", "chartGeoSelectChanged", "chartGeoSelected", "chartGeoUnselected", "chartAxisAreaSelected", "chartBrush", "chartBrushEnd", "chartBrushSelected", "chartGlobalCursorTaken", "chartRendered", "chartFinished"], exportAs: ["echarts"] }] });
|
|
1436
1329
|
}
|
|
1437
1330
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsBarStackedComponent, decorators: [{
|
|
1438
1331
|
type: Component,
|
|
1439
1332
|
args: [{ selector: 'vs-echarts-bar', standalone: true, imports: [
|
|
1440
1333
|
CommonModule,
|
|
1441
1334
|
NgxEchartsDirective,
|
|
1442
|
-
], providers: [provideVSEcharts()], template: "<div class=\"echarts-container\" echarts [
|
|
1335
|
+
], providers: [provideVSEcharts()], template: "<div class=\"echarts-container\" echarts \n [options]=\"{}\"\n [initOpts]=\"initOptions\" \n [autoResize]=\"true\" \n (chartInit)=\"onChartInit($event)\" \n (chartClick)=\"onChartClick($event)\" \n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>\n", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"] }]
|
|
1443
1336
|
}] });
|
|
1444
1337
|
|
|
1445
1338
|
class EChartsHBarStackedComponent extends EchartsBarComponent {
|
|
@@ -1469,14 +1362,14 @@ class EChartsHBarStackedComponent extends EchartsBarComponent {
|
|
|
1469
1362
|
this.director.makeBar(this.data, this.optionsOverrides, makeOpts);
|
|
1470
1363
|
}
|
|
1471
1364
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsHBarStackedComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1472
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EChartsHBarStackedComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div class=\"echarts-container\" echarts [
|
|
1365
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EChartsHBarStackedComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div class=\"echarts-container\" echarts \n [options]=\"{}\"\n [initOpts]=\"initOptions\" \n [autoResize]=\"true\" \n (chartInit)=\"onChartInit($event)\" \n (chartClick)=\"onChartClick($event)\" \n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>\n", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: NgxEchartsDirective, selector: "echarts, [echarts]", inputs: ["options", "theme", "initOpts", "merge", "autoResize", "loading", "loadingType", "loadingOpts"], outputs: ["chartInit", "optionsError", "chartClick", "chartDblClick", "chartMouseDown", "chartMouseMove", "chartMouseUp", "chartMouseOver", "chartMouseOut", "chartGlobalOut", "chartContextMenu", "chartHighlight", "chartDownplay", "chartSelectChanged", "chartLegendSelectChanged", "chartLegendSelected", "chartLegendUnselected", "chartLegendLegendSelectAll", "chartLegendLegendInverseSelect", "chartLegendScroll", "chartDataZoom", "chartDataRangeSelected", "chartGraphRoam", "chartGeoRoam", "chartTreeRoam", "chartTimelineChanged", "chartTimelinePlayChanged", "chartRestore", "chartDataViewChanged", "chartMagicTypeChanged", "chartGeoSelectChanged", "chartGeoSelected", "chartGeoUnselected", "chartAxisAreaSelected", "chartBrush", "chartBrushEnd", "chartBrushSelected", "chartGlobalCursorTaken", "chartRendered", "chartFinished"], exportAs: ["echarts"] }] });
|
|
1473
1366
|
}
|
|
1474
1367
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsHBarStackedComponent, decorators: [{
|
|
1475
1368
|
type: Component,
|
|
1476
1369
|
args: [{ selector: 'vs-echarts-bar', standalone: true, imports: [
|
|
1477
1370
|
CommonModule,
|
|
1478
1371
|
NgxEchartsDirective,
|
|
1479
|
-
], providers: [provideVSEcharts()], template: "<div class=\"echarts-container\" echarts [
|
|
1372
|
+
], providers: [provideVSEcharts()], template: "<div class=\"echarts-container\" echarts \n [options]=\"{}\"\n [initOpts]=\"initOptions\" \n [autoResize]=\"true\" \n (chartInit)=\"onChartInit($event)\" \n (chartClick)=\"onChartClick($event)\" \n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>\n", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"] }]
|
|
1480
1373
|
}] });
|
|
1481
1374
|
|
|
1482
1375
|
class EChartsBarStackedRadialComponent extends EchartsBarComponent {
|
|
@@ -1503,90 +1396,16 @@ class EChartsBarStackedRadialComponent extends EchartsBarComponent {
|
|
|
1503
1396
|
this.director.makeBarRadial(this.data, this.optionsOverrides, makeOpts);
|
|
1504
1397
|
}
|
|
1505
1398
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsBarStackedRadialComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1506
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EChartsBarStackedRadialComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div class=\"echarts-container\" echarts [
|
|
1399
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EChartsBarStackedRadialComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div class=\"echarts-container\" echarts \n [options]=\"{}\"\n [initOpts]=\"initOptions\" \n [autoResize]=\"true\" \n (chartInit)=\"onChartInit($event)\" \n (chartClick)=\"onChartClick($event)\" \n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>\n", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: NgxEchartsDirective, selector: "echarts, [echarts]", inputs: ["options", "theme", "initOpts", "merge", "autoResize", "loading", "loadingType", "loadingOpts"], outputs: ["chartInit", "optionsError", "chartClick", "chartDblClick", "chartMouseDown", "chartMouseMove", "chartMouseUp", "chartMouseOver", "chartMouseOut", "chartGlobalOut", "chartContextMenu", "chartHighlight", "chartDownplay", "chartSelectChanged", "chartLegendSelectChanged", "chartLegendSelected", "chartLegendUnselected", "chartLegendLegendSelectAll", "chartLegendLegendInverseSelect", "chartLegendScroll", "chartDataZoom", "chartDataRangeSelected", "chartGraphRoam", "chartGeoRoam", "chartTreeRoam", "chartTimelineChanged", "chartTimelinePlayChanged", "chartRestore", "chartDataViewChanged", "chartMagicTypeChanged", "chartGeoSelectChanged", "chartGeoSelected", "chartGeoUnselected", "chartAxisAreaSelected", "chartBrush", "chartBrushEnd", "chartBrushSelected", "chartGlobalCursorTaken", "chartRendered", "chartFinished"], exportAs: ["echarts"] }] });
|
|
1507
1400
|
}
|
|
1508
1401
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsBarStackedRadialComponent, decorators: [{
|
|
1509
1402
|
type: Component,
|
|
1510
1403
|
args: [{ selector: 'vs-echarts-bar', standalone: true, imports: [
|
|
1511
1404
|
CommonModule,
|
|
1512
1405
|
NgxEchartsDirective,
|
|
1513
|
-
], providers: [provideVSEcharts()], template: "<div class=\"echarts-container\" echarts [
|
|
1406
|
+
], providers: [provideVSEcharts()], template: "<div class=\"echarts-container\" echarts \n [options]=\"{}\"\n [initOpts]=\"initOptions\" \n [autoResize]=\"true\" \n (chartInit)=\"onChartInit($event)\" \n (chartClick)=\"onChartClick($event)\" \n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>\n", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"] }]
|
|
1514
1407
|
}] });
|
|
1515
1408
|
|
|
1516
|
-
/**
|
|
1517
|
-
* Applies a visual selection effect to line-based series.
|
|
1518
|
-
* Highlights the selected series and point, and dims everything else.
|
|
1519
|
-
*
|
|
1520
|
-
* @param series The series array to modify
|
|
1521
|
-
* @param selectedCategoryIndex Index of the selected category
|
|
1522
|
-
* @param selectedSeriesIndex Index of the selected series
|
|
1523
|
-
* @returns Modified series array
|
|
1524
|
-
*/
|
|
1525
|
-
function applyLineSelectionStyle(series, selectedCategoryIndex, selectedSeriesIndex) {
|
|
1526
|
-
if (selectedCategoryIndex === null || !series)
|
|
1527
|
-
return series;
|
|
1528
|
-
return series.map((s, sIdx) => {
|
|
1529
|
-
const isSelectedSeries = sIdx === selectedSeriesIndex;
|
|
1530
|
-
// Serie seleccionada: Línea con opacidad 1 para que destaque la tendencia.
|
|
1531
|
-
// Serie NO seleccionada: Opacidad 0.20 para atenuar fuertemente.
|
|
1532
|
-
const seriesOpacity = isSelectedSeries ? 1 : 0.20;
|
|
1533
|
-
return {
|
|
1534
|
-
...s,
|
|
1535
|
-
emphasis: {
|
|
1536
|
-
disabled: true // Deshabilitar el énfasis (hover) cuando hay una selección activa
|
|
1537
|
-
},
|
|
1538
|
-
itemStyle: {
|
|
1539
|
-
...s.itemStyle,
|
|
1540
|
-
opacity: seriesOpacity
|
|
1541
|
-
},
|
|
1542
|
-
lineStyle: {
|
|
1543
|
-
...s.lineStyle,
|
|
1544
|
-
opacity: seriesOpacity
|
|
1545
|
-
},
|
|
1546
|
-
...(s.areaStyle ? {
|
|
1547
|
-
areaStyle: {
|
|
1548
|
-
...s.areaStyle,
|
|
1549
|
-
opacity: isSelectedSeries ? 0.6 : 0.1
|
|
1550
|
-
}
|
|
1551
|
-
} : {}),
|
|
1552
|
-
// Personalizamos los puntos individualmente
|
|
1553
|
-
data: (s.data || []).map((val, idx) => {
|
|
1554
|
-
const isSelectedPoint = isSelectedSeries && idx === selectedCategoryIndex;
|
|
1555
|
-
const isOtherPointInSelectedSeries = isSelectedSeries && idx !== selectedCategoryIndex;
|
|
1556
|
-
const originalPoint = (val && typeof val === 'object') ? val : { value: val };
|
|
1557
|
-
if (isSelectedPoint) {
|
|
1558
|
-
return {
|
|
1559
|
-
...originalPoint,
|
|
1560
|
-
z: 10, // Asegurar que el punto seleccionado esté por encima de los demás
|
|
1561
|
-
itemStyle: {
|
|
1562
|
-
...originalPoint.itemStyle,
|
|
1563
|
-
opacity: 1,
|
|
1564
|
-
borderWidth: 2,
|
|
1565
|
-
borderColor: '#fff',
|
|
1566
|
-
shadowBlur: 10,
|
|
1567
|
-
shadowColor: 'rgba(0,0,0,0.5)'
|
|
1568
|
-
},
|
|
1569
|
-
symbolSize: 12
|
|
1570
|
-
};
|
|
1571
|
-
}
|
|
1572
|
-
else if (isOtherPointInSelectedSeries) {
|
|
1573
|
-
// Puntos de la serie seleccionada que NO son el clicado: un poco más pequeños y traslúcidos
|
|
1574
|
-
return {
|
|
1575
|
-
...originalPoint,
|
|
1576
|
-
itemStyle: {
|
|
1577
|
-
...originalPoint.itemStyle,
|
|
1578
|
-
opacity: 0.5
|
|
1579
|
-
},
|
|
1580
|
-
symbolSize: 6
|
|
1581
|
-
};
|
|
1582
|
-
}
|
|
1583
|
-
// Puntos de otras series o por defecto
|
|
1584
|
-
return val;
|
|
1585
|
-
})
|
|
1586
|
-
};
|
|
1587
|
-
});
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
1409
|
class EchartsLineComponent extends BaseEchartsComponent {
|
|
1591
1410
|
baseSeriesOptions = {
|
|
1592
1411
|
type: 'line',
|
|
@@ -1595,10 +1414,11 @@ class EchartsLineComponent extends BaseEchartsComponent {
|
|
|
1595
1414
|
animationEasing: 'cubicOut',
|
|
1596
1415
|
smooth: true,
|
|
1597
1416
|
smoothMonotone: 'x',
|
|
1417
|
+
symbol: 'emptyCircle',
|
|
1598
1418
|
symbolSize: 6,
|
|
1599
1419
|
itemStyle: {
|
|
1600
1420
|
shadowColor: 'rgba(0, 0, 0, 0.2)',
|
|
1601
|
-
shadowBlur:
|
|
1421
|
+
shadowBlur: 4,
|
|
1602
1422
|
shadowOffsetY: 2,
|
|
1603
1423
|
},
|
|
1604
1424
|
lineStyle: {
|
|
@@ -1611,15 +1431,19 @@ class EchartsLineComponent extends BaseEchartsComponent {
|
|
|
1611
1431
|
},
|
|
1612
1432
|
emphasis: {
|
|
1613
1433
|
focus: 'none',
|
|
1614
|
-
itemStyle: {
|
|
1615
|
-
borderWidth: 2,
|
|
1616
|
-
shadowBlur: 10,
|
|
1617
|
-
},
|
|
1618
1434
|
lineStyle: {
|
|
1619
1435
|
width: 4,
|
|
1620
|
-
shadowBlur:
|
|
1436
|
+
shadowBlur: 10,
|
|
1621
1437
|
}
|
|
1622
1438
|
},
|
|
1439
|
+
selectedMode: 'single',
|
|
1440
|
+
select: {
|
|
1441
|
+
itemStyle: {
|
|
1442
|
+
color: 'rgba(255, 255, 255, 1)',
|
|
1443
|
+
borderCap: 'round',
|
|
1444
|
+
borderWidth: 8,
|
|
1445
|
+
},
|
|
1446
|
+
},
|
|
1623
1447
|
};
|
|
1624
1448
|
baseProduct = {
|
|
1625
1449
|
chartKey: 'line',
|
|
@@ -1632,14 +1456,6 @@ class EchartsLineComponent extends BaseEchartsComponent {
|
|
|
1632
1456
|
constructor() {
|
|
1633
1457
|
super();
|
|
1634
1458
|
}
|
|
1635
|
-
onInputChanges(changes) {
|
|
1636
|
-
if (changes['data']) {
|
|
1637
|
-
this.selectedCategoryIndex = null;
|
|
1638
|
-
this.selectedSeriesIndex = null;
|
|
1639
|
-
this.currentLegendSelected = null;
|
|
1640
|
-
}
|
|
1641
|
-
super.onInputChanges(changes);
|
|
1642
|
-
}
|
|
1643
1459
|
make(makeOpts) {
|
|
1644
1460
|
this.director.makeLine(this.data, this.optionsOverrides, makeOpts);
|
|
1645
1461
|
}
|
|
@@ -1648,7 +1464,6 @@ class EchartsLineComponent extends BaseEchartsComponent {
|
|
|
1648
1464
|
return;
|
|
1649
1465
|
if (!this.data)
|
|
1650
1466
|
return;
|
|
1651
|
-
// 1.
|
|
1652
1467
|
const makeBarOpts = {
|
|
1653
1468
|
valueFormatter: this.valueFormatter,
|
|
1654
1469
|
palette: this.palette,
|
|
@@ -1656,20 +1471,12 @@ class EchartsLineComponent extends BaseEchartsComponent {
|
|
|
1656
1471
|
};
|
|
1657
1472
|
this.make(makeBarOpts);
|
|
1658
1473
|
const baseOptions = this.builder.getResult();
|
|
1659
|
-
// 2. Re-apply legend selection state if exists
|
|
1660
|
-
if (this.currentLegendSelected && baseOptions.legend) {
|
|
1661
|
-
baseOptions.legend.selected = { ...this.currentLegendSelected };
|
|
1662
|
-
}
|
|
1663
|
-
//3. Apply persistent selection style if a point is selected
|
|
1664
|
-
if (this.selectedCategoryIndex !== null && baseOptions.series) {
|
|
1665
|
-
baseOptions.series = applyLineSelectionStyle(baseOptions.series, this.selectedCategoryIndex, this.selectedSeriesIndex);
|
|
1666
|
-
}
|
|
1667
1474
|
this.triggerUpdate(baseOptions);
|
|
1668
1475
|
}
|
|
1669
1476
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsLineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1670
1477
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EchartsLineComponent, isStandalone: true, selector: "vs-echarts-line", providers: [
|
|
1671
1478
|
provideVSEcharts(),
|
|
1672
|
-
], usesInheritance: true, ngImport: i0, template: "<div\n class=\"echarts-container\"\n echarts\n [options]=\"
|
|
1479
|
+
], usesInheritance: true, ngImport: i0, template: "<div\n class=\"echarts-container\"\n echarts\n [options]=\"{}\"\n [initOpts]=\"initOptions\"\n [autoResize]=\"true\"\n (chartInit)=\"onChartInit($event)\"\n (chartClick)=\"onChartClick($event)\"\n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: NgxEchartsDirective, selector: "echarts, [echarts]", inputs: ["options", "theme", "initOpts", "merge", "autoResize", "loading", "loadingType", "loadingOpts"], outputs: ["chartInit", "optionsError", "chartClick", "chartDblClick", "chartMouseDown", "chartMouseMove", "chartMouseUp", "chartMouseOver", "chartMouseOut", "chartGlobalOut", "chartContextMenu", "chartHighlight", "chartDownplay", "chartSelectChanged", "chartLegendSelectChanged", "chartLegendSelected", "chartLegendUnselected", "chartLegendLegendSelectAll", "chartLegendLegendInverseSelect", "chartLegendScroll", "chartDataZoom", "chartDataRangeSelected", "chartGraphRoam", "chartGeoRoam", "chartTreeRoam", "chartTimelineChanged", "chartTimelinePlayChanged", "chartRestore", "chartDataViewChanged", "chartMagicTypeChanged", "chartGeoSelectChanged", "chartGeoSelected", "chartGeoUnselected", "chartAxisAreaSelected", "chartBrush", "chartBrushEnd", "chartBrushSelected", "chartGlobalCursorTaken", "chartRendered", "chartFinished"], exportAs: ["echarts"] }] });
|
|
1673
1480
|
}
|
|
1674
1481
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsLineComponent, decorators: [{
|
|
1675
1482
|
type: Component,
|
|
@@ -1678,7 +1485,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
|
|
|
1678
1485
|
NgxEchartsDirective,
|
|
1679
1486
|
], providers: [
|
|
1680
1487
|
provideVSEcharts(),
|
|
1681
|
-
], template: "<div\n class=\"echarts-container\"\n echarts\n [options]=\"
|
|
1488
|
+
], template: "<div\n class=\"echarts-container\"\n echarts\n [options]=\"{}\"\n [initOpts]=\"initOptions\"\n [autoResize]=\"true\"\n (chartInit)=\"onChartInit($event)\"\n (chartClick)=\"onChartClick($event)\"\n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"] }]
|
|
1682
1489
|
}], ctorParameters: () => [] });
|
|
1683
1490
|
|
|
1684
1491
|
class EChartsAreaComponent extends EchartsLineComponent {
|
|
@@ -1695,14 +1502,14 @@ class EChartsAreaComponent extends EchartsLineComponent {
|
|
|
1695
1502
|
builder = new EChartBuilder(this.variantBaseProduct);
|
|
1696
1503
|
director = new VSECDirector(this.builder);
|
|
1697
1504
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsAreaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1698
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EChartsAreaComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div\n class=\"echarts-container\"\n echarts\n [options]=\"
|
|
1505
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EChartsAreaComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div\n class=\"echarts-container\"\n echarts\n [options]=\"{}\"\n [initOpts]=\"initOptions\"\n [autoResize]=\"true\"\n (chartInit)=\"onChartInit($event)\"\n (chartClick)=\"onChartClick($event)\"\n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: NgxEchartsDirective, selector: "echarts, [echarts]", inputs: ["options", "theme", "initOpts", "merge", "autoResize", "loading", "loadingType", "loadingOpts"], outputs: ["chartInit", "optionsError", "chartClick", "chartDblClick", "chartMouseDown", "chartMouseMove", "chartMouseUp", "chartMouseOver", "chartMouseOut", "chartGlobalOut", "chartContextMenu", "chartHighlight", "chartDownplay", "chartSelectChanged", "chartLegendSelectChanged", "chartLegendSelected", "chartLegendUnselected", "chartLegendLegendSelectAll", "chartLegendLegendInverseSelect", "chartLegendScroll", "chartDataZoom", "chartDataRangeSelected", "chartGraphRoam", "chartGeoRoam", "chartTreeRoam", "chartTimelineChanged", "chartTimelinePlayChanged", "chartRestore", "chartDataViewChanged", "chartMagicTypeChanged", "chartGeoSelectChanged", "chartGeoSelected", "chartGeoUnselected", "chartAxisAreaSelected", "chartBrush", "chartBrushEnd", "chartBrushSelected", "chartGlobalCursorTaken", "chartRendered", "chartFinished"], exportAs: ["echarts"] }] });
|
|
1699
1506
|
}
|
|
1700
1507
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsAreaComponent, decorators: [{
|
|
1701
1508
|
type: Component,
|
|
1702
1509
|
args: [{ selector: 'vs-echarts-bar', standalone: true, imports: [
|
|
1703
1510
|
CommonModule,
|
|
1704
1511
|
NgxEchartsDirective,
|
|
1705
|
-
], providers: [provideVSEcharts()], template: "<div\n class=\"echarts-container\"\n echarts\n [options]=\"
|
|
1512
|
+
], providers: [provideVSEcharts()], template: "<div\n class=\"echarts-container\"\n echarts\n [options]=\"{}\"\n [initOpts]=\"initOptions\"\n [autoResize]=\"true\"\n (chartInit)=\"onChartInit($event)\"\n (chartClick)=\"onChartClick($event)\"\n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"] }]
|
|
1706
1513
|
}] });
|
|
1707
1514
|
|
|
1708
1515
|
class EChartsAreaStackComponent extends EchartsLineComponent {
|
|
@@ -1720,14 +1527,14 @@ class EChartsAreaStackComponent extends EchartsLineComponent {
|
|
|
1720
1527
|
builder = new EChartBuilder(this.variantBaseProduct);
|
|
1721
1528
|
director = new VSECDirector(this.builder);
|
|
1722
1529
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsAreaStackComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1723
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EChartsAreaStackComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div\n class=\"echarts-container\"\n echarts\n [options]=\"
|
|
1530
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EChartsAreaStackComponent, isStandalone: true, selector: "vs-echarts-bar", providers: [provideVSEcharts()], usesInheritance: true, ngImport: i0, template: "<div\n class=\"echarts-container\"\n echarts\n [options]=\"{}\"\n [initOpts]=\"initOptions\"\n [autoResize]=\"true\"\n (chartInit)=\"onChartInit($event)\"\n (chartClick)=\"onChartClick($event)\"\n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: NgxEchartsDirective, selector: "echarts, [echarts]", inputs: ["options", "theme", "initOpts", "merge", "autoResize", "loading", "loadingType", "loadingOpts"], outputs: ["chartInit", "optionsError", "chartClick", "chartDblClick", "chartMouseDown", "chartMouseMove", "chartMouseUp", "chartMouseOver", "chartMouseOut", "chartGlobalOut", "chartContextMenu", "chartHighlight", "chartDownplay", "chartSelectChanged", "chartLegendSelectChanged", "chartLegendSelected", "chartLegendUnselected", "chartLegendLegendSelectAll", "chartLegendLegendInverseSelect", "chartLegendScroll", "chartDataZoom", "chartDataRangeSelected", "chartGraphRoam", "chartGeoRoam", "chartTreeRoam", "chartTimelineChanged", "chartTimelinePlayChanged", "chartRestore", "chartDataViewChanged", "chartMagicTypeChanged", "chartGeoSelectChanged", "chartGeoSelected", "chartGeoUnselected", "chartAxisAreaSelected", "chartBrush", "chartBrushEnd", "chartBrushSelected", "chartGlobalCursorTaken", "chartRendered", "chartFinished"], exportAs: ["echarts"] }] });
|
|
1724
1531
|
}
|
|
1725
1532
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsAreaStackComponent, decorators: [{
|
|
1726
1533
|
type: Component,
|
|
1727
1534
|
args: [{ selector: 'vs-echarts-bar', standalone: true, imports: [
|
|
1728
1535
|
CommonModule,
|
|
1729
1536
|
NgxEchartsDirective,
|
|
1730
|
-
], providers: [provideVSEcharts()], template: "<div\n class=\"echarts-container\"\n echarts\n [options]=\"
|
|
1537
|
+
], providers: [provideVSEcharts()], template: "<div\n class=\"echarts-container\"\n echarts\n [options]=\"{}\"\n [initOpts]=\"initOptions\"\n [autoResize]=\"true\"\n (chartInit)=\"onChartInit($event)\"\n (chartClick)=\"onChartClick($event)\"\n (chartSelectChanged)=\"onChartSelectChanged($event)\"\n></div>", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"] }]
|
|
1731
1538
|
}] });
|
|
1732
1539
|
|
|
1733
1540
|
// Interfaces de Inputs de Base EChart Component //
|