@visionaris-bruno/vs-echarts 6.4.1 → 6.5.1
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.
|
@@ -31,6 +31,25 @@ const EChartsTokens = {
|
|
|
31
31
|
function getDefaultPalette() {
|
|
32
32
|
return [...EChartsTokens.defaultPalette];
|
|
33
33
|
}
|
|
34
|
+
/** corrige inside data index cuando se filtran leyendas en graficos tipo 'pie'.
|
|
35
|
+
*
|
|
36
|
+
* En pie, cuando se filtran leyendas, no coinciden el 'inside data index'
|
|
37
|
+
* con el 'selected data index'. El correcto deberia ser el 'inside data intex'
|
|
38
|
+
* pero por algun motivo esto es distinto en este tipo de graficos.
|
|
39
|
+
*
|
|
40
|
+
* apache echarts version: 5.6.0
|
|
41
|
+
*/
|
|
42
|
+
const fixPieDataIndexInside = (e) => {
|
|
43
|
+
/** selected serie index */
|
|
44
|
+
const ssi = e.fromActionPayload.seriesIndex;
|
|
45
|
+
const selected = e.selected.find(sel => sel.seriesIndex == ssi);
|
|
46
|
+
if (e.fromAction == 'unselect' || !selected) {
|
|
47
|
+
return e;
|
|
48
|
+
}
|
|
49
|
+
const fixedDataIndex = selected.dataIndex[0]; // [0] por seleccion single;
|
|
50
|
+
e.fromActionPayload.dataIndexInside = fixedDataIndex; // aplico corrección de index inside.
|
|
51
|
+
return e;
|
|
52
|
+
};
|
|
34
53
|
|
|
35
54
|
/**
|
|
36
55
|
* Inicialización centralizada de ECharts para evitar duplicación y efectos secundarios
|
|
@@ -129,6 +148,9 @@ function defaultOptionsOverrides() {
|
|
|
129
148
|
ring: {
|
|
130
149
|
series: {}
|
|
131
150
|
},
|
|
151
|
+
pie: {
|
|
152
|
+
series: {}
|
|
153
|
+
},
|
|
132
154
|
scatter: {
|
|
133
155
|
series: {}
|
|
134
156
|
},
|
|
@@ -252,12 +274,18 @@ class BaseEchartsComponent {
|
|
|
252
274
|
}
|
|
253
275
|
}
|
|
254
276
|
/**
|
|
255
|
-
*
|
|
277
|
+
* Maneja el cambio de selección en el gráfico (selección y deselección de elementos).
|
|
278
|
+
* Requiere que las series del gráfico tengan configurado `selectMode`.
|
|
256
279
|
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
280
|
+
* @param event Datos del evento de cambio de selección de ECharts.
|
|
281
|
+
* @param opts Opciones de configuración adicionales.
|
|
282
|
+
* @param opts.fixPieDataIndexInside Si es true, aplica la corrección de índice para gráficos tipo pie.
|
|
259
283
|
*/
|
|
260
|
-
onChartSelectChanged(event) {
|
|
284
|
+
onChartSelectChanged(event, opts) {
|
|
285
|
+
const shouldFixPie = opts?.fixPieDataIndexInside ?? false;
|
|
286
|
+
if (shouldFixPie) {
|
|
287
|
+
fixPieDataIndexInside(event);
|
|
288
|
+
}
|
|
261
289
|
const { type = '', fromActionPayload, fromAction = '', isFromClick, selected, } = event;
|
|
262
290
|
if (!isFromClick)
|
|
263
291
|
return; // avoid internal ECharts selection loop.
|
|
@@ -558,10 +586,15 @@ function applyLineSelectionStyle(series, selectedCategoryIndex, selectedSeriesIn
|
|
|
558
586
|
* Formatter generator for 'item' trigger strategy in tooltips.
|
|
559
587
|
*/
|
|
560
588
|
function getItemTooltipFormatter(data, formatCellValue) {
|
|
589
|
+
const totalSeries = data.series.length;
|
|
561
590
|
return (params) => {
|
|
562
591
|
const seriesObj = data.series[params.seriesIndex];
|
|
563
|
-
const key = seriesObj?.originalKey || (data.categoryKeys ? data.categoryKeys[params.dataIndex] : String(params.dataIndex));
|
|
592
|
+
const key = params.data?.originalMeassureKey || seriesObj?.originalKey || (data.categoryKeys ? data.categoryKeys[params.dataIndex] : String(params.dataIndex));
|
|
564
593
|
const valFormatted = formatCellValue(params.value, key);
|
|
594
|
+
if (params.percent !== undefined) {
|
|
595
|
+
const seriesHeader = totalSeries > 1 ? `<b>${params.seriesName}</b><br/>` : '';
|
|
596
|
+
return `${seriesHeader}${params.name}<br/>${params.marker} <b>${valFormatted}</b> (${params.percent}%)`;
|
|
597
|
+
}
|
|
565
598
|
return `<div style="text-align: center;"><b>${params.name}</b><br/>${params.marker} ${params.seriesName}<br/><b>${valFormatted}</b></div>`;
|
|
566
599
|
};
|
|
567
600
|
}
|
|
@@ -714,14 +747,8 @@ class RingBuilder {
|
|
|
714
747
|
}];
|
|
715
748
|
}
|
|
716
749
|
addTooltip(data, overrides) {
|
|
717
|
-
const totalRings = data.series.length;
|
|
718
750
|
merge(overrides, {
|
|
719
|
-
formatter: (
|
|
720
|
-
const key = params.data.originalMeassureKey || '';
|
|
721
|
-
const valFormatted = this.formatCellValue(params.value, key);
|
|
722
|
-
const seriesHeader = totalRings > 1 ? `<b>${params.seriesName}</b><br/>` : '';
|
|
723
|
-
return `${seriesHeader}${params.name}<br/>${params.marker} <b>${valFormatted}</b> (${params.percent}%)`;
|
|
724
|
-
},
|
|
751
|
+
formatter: getTooltipFormatter(overrides.trigger, data, this.formatCellValue.bind(this)),
|
|
725
752
|
});
|
|
726
753
|
const tooltip = getTooltipOptions(overrides);
|
|
727
754
|
this.result.tooltip = tooltip;
|
|
@@ -870,6 +897,21 @@ class VSECDirector {
|
|
|
870
897
|
this.builder.addTooltip(data, overrides.tooltip);
|
|
871
898
|
this.builder.addLegend();
|
|
872
899
|
}
|
|
900
|
+
makePie(data, overrides, opts = {}) {
|
|
901
|
+
const { valueFormatter = undefined, palette = undefined, colorResolver = undefined, } = opts;
|
|
902
|
+
this.builder.reset();
|
|
903
|
+
// El orden importa, primero callbacks y despues componentes.
|
|
904
|
+
this.builder.setValueFormatter(valueFormatter);
|
|
905
|
+
this.builder.setPalette(palette);
|
|
906
|
+
this.builder.setColorResolver(colorResolver);
|
|
907
|
+
const product = this.builder.baseProduct;
|
|
908
|
+
const seriesOverrides = merge$1({}, product.baseOptions.series, overrides[product.chartKey].series);
|
|
909
|
+
// chart components
|
|
910
|
+
this.builder.addCommons();
|
|
911
|
+
this.builder.addSeries(data, seriesOverrides);
|
|
912
|
+
this.builder.addTooltip(data, overrides.tooltip);
|
|
913
|
+
this.builder.addLegend();
|
|
914
|
+
}
|
|
873
915
|
makeFunnel(data, overrides, opts = {}) {
|
|
874
916
|
const { valueFormatter = undefined, palette = undefined, colorResolver = undefined, } = opts;
|
|
875
917
|
this.builder.reset();
|
|
@@ -990,28 +1032,6 @@ class EchartsRingComponent extends BaseEchartsComponent {
|
|
|
990
1032
|
this.setGraphicText('');
|
|
991
1033
|
}
|
|
992
1034
|
}
|
|
993
|
-
onChartSelectChangedParcheado(e) {
|
|
994
|
-
/** corrige inside data index cuando se filtran leyendas en ring.
|
|
995
|
-
*
|
|
996
|
-
* En ring, cuando se filtran leyendas, no coinciden el 'inside data index'
|
|
997
|
-
* con el 'selected data index'. El correcto deberia ser el 'inside data intex'
|
|
998
|
-
* pero en ring por algun motivo esto es distinto.
|
|
999
|
-
*
|
|
1000
|
-
* apache echarts version: 5.6.0
|
|
1001
|
-
*/
|
|
1002
|
-
const patchedEvent = (e) => {
|
|
1003
|
-
/** selected serie index */
|
|
1004
|
-
const ssi = e.fromActionPayload.seriesIndex;
|
|
1005
|
-
const selected = e.selected.find(sel => sel.seriesIndex == ssi);
|
|
1006
|
-
if (e.fromAction == 'unselect' || !selected) {
|
|
1007
|
-
return e;
|
|
1008
|
-
}
|
|
1009
|
-
const fixedDataIndex = selected.dataIndex[0]; // [0] por seleccion single;
|
|
1010
|
-
e.fromActionPayload.dataIndexInside = fixedDataIndex; // aplico corrección de index inside.
|
|
1011
|
-
return e;
|
|
1012
|
-
};
|
|
1013
|
-
super.onChartSelectChanged(patchedEvent(e)); // continuo flujo convencional
|
|
1014
|
-
}
|
|
1015
1035
|
/**
|
|
1016
1036
|
* Actualiza el texto del Graphic central y persiste la selección en el modelo de opciones.
|
|
1017
1037
|
*/
|
|
@@ -1044,14 +1064,240 @@ class EchartsRingComponent extends BaseEchartsComponent {
|
|
|
1044
1064
|
this.triggerUpdate(options);
|
|
1045
1065
|
}
|
|
1046
1066
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsRingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1047
|
-
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)=\"
|
|
1067
|
+
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)=\"onChartSelectChanged($event, { fixPieDataIndexInside: true })\"\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"] }] });
|
|
1048
1068
|
}
|
|
1049
1069
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsRingComponent, decorators: [{
|
|
1050
1070
|
type: Component,
|
|
1051
1071
|
args: [{ selector: 'vs-echarts-ring', standalone: true, imports: [
|
|
1052
1072
|
CommonModule,
|
|
1053
1073
|
NgxEchartsDirective,
|
|
1054
|
-
], 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)=\"
|
|
1074
|
+
], 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)=\"onChartSelectChanged($event, { fixPieDataIndexInside: true })\"\n></div>\n ", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"] }]
|
|
1075
|
+
}], ctorParameters: () => [] });
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* PieBuilder
|
|
1079
|
+
*
|
|
1080
|
+
* Builder concreto para el gráfico de Pie (torta concéntrica).
|
|
1081
|
+
*
|
|
1082
|
+
*/
|
|
1083
|
+
class PieBuilder {
|
|
1084
|
+
baseProduct;
|
|
1085
|
+
valueFormatter = (value) => value.toLocaleString();
|
|
1086
|
+
palette = [];
|
|
1087
|
+
colorResolver;
|
|
1088
|
+
result = {};
|
|
1089
|
+
constructor(baseProduct) {
|
|
1090
|
+
this.baseProduct = baseProduct;
|
|
1091
|
+
}
|
|
1092
|
+
reset() {
|
|
1093
|
+
this.result = {};
|
|
1094
|
+
}
|
|
1095
|
+
addCommons() {
|
|
1096
|
+
const opts = {
|
|
1097
|
+
palette: this.palette,
|
|
1098
|
+
};
|
|
1099
|
+
const common = getCommons(opts);
|
|
1100
|
+
merge(this.result, common);
|
|
1101
|
+
}
|
|
1102
|
+
addSeries(data, overrides) {
|
|
1103
|
+
if (!data || !data.series.length)
|
|
1104
|
+
return;
|
|
1105
|
+
const totalSeries = data.series.length;
|
|
1106
|
+
let series = [];
|
|
1107
|
+
if (totalSeries === 1) {
|
|
1108
|
+
const s = data.series[0];
|
|
1109
|
+
const pieData = data.categories.map((catName, catIndex) => ({
|
|
1110
|
+
name: catName,
|
|
1111
|
+
value: s.data[catIndex],
|
|
1112
|
+
originalMeassureKey: s.originalKey || (data.categoryKeys ? data.categoryKeys[catIndex] : '')
|
|
1113
|
+
}));
|
|
1114
|
+
const dynamicPieSeriesOptions = {
|
|
1115
|
+
name: s.name,
|
|
1116
|
+
type: 'pie',
|
|
1117
|
+
data: pieData,
|
|
1118
|
+
id: `pie_0`,
|
|
1119
|
+
radius: [0, '50%'],
|
|
1120
|
+
label: {
|
|
1121
|
+
show: true,
|
|
1122
|
+
position: 'outside'
|
|
1123
|
+
},
|
|
1124
|
+
labelLine: {
|
|
1125
|
+
show: true,
|
|
1126
|
+
},
|
|
1127
|
+
};
|
|
1128
|
+
const seriesOption = merge(dynamicPieSeriesOptions, overrides);
|
|
1129
|
+
// Inyectar el resolver de color si existe
|
|
1130
|
+
if (this.colorResolver && seriesOption.itemStyle) {
|
|
1131
|
+
seriesOption.itemStyle.color = this.colorResolver;
|
|
1132
|
+
}
|
|
1133
|
+
series.push(seriesOption);
|
|
1134
|
+
}
|
|
1135
|
+
else {
|
|
1136
|
+
const centerPieRadius = Math.max(20, 40 - totalSeries * 3);
|
|
1137
|
+
const maxOuterRadius = Math.min(60, 75 + (totalSeries - 2) * 3);
|
|
1138
|
+
const margin = Math.max(1, 4 - totalSeries * 0.2);
|
|
1139
|
+
const numRings = totalSeries - 1;
|
|
1140
|
+
const availableSpan = maxOuterRadius - (centerPieRadius + margin) - (margin * (numRings - 1));
|
|
1141
|
+
const thickness = availableSpan / numRings;
|
|
1142
|
+
series = data.series.map((s, idx) => {
|
|
1143
|
+
const pieData = data.categories.map((catName, catIndex) => ({
|
|
1144
|
+
name: catName,
|
|
1145
|
+
value: s.data[catIndex],
|
|
1146
|
+
originalMeassureKey: s.originalKey || (data.categoryKeys ? data.categoryKeys[catIndex] : '')
|
|
1147
|
+
}));
|
|
1148
|
+
let radius;
|
|
1149
|
+
let labelPosition;
|
|
1150
|
+
let labelLineShow;
|
|
1151
|
+
let labelShow = true;
|
|
1152
|
+
if (idx === 0) {
|
|
1153
|
+
// Primera serie: Torta rellena desde el centro
|
|
1154
|
+
radius = [0, `${centerPieRadius}%`];
|
|
1155
|
+
labelPosition = 'inner';
|
|
1156
|
+
labelLineShow = false;
|
|
1157
|
+
labelShow = false;
|
|
1158
|
+
}
|
|
1159
|
+
else {
|
|
1160
|
+
// Series subsecuentes: Anillos alrededor
|
|
1161
|
+
const inner = (centerPieRadius + margin) + (idx - 1) * (thickness + margin);
|
|
1162
|
+
const outer = inner + thickness;
|
|
1163
|
+
radius = [`${inner}%`, `${outer}%`];
|
|
1164
|
+
labelPosition = 'outside';
|
|
1165
|
+
labelLineShow = true;
|
|
1166
|
+
}
|
|
1167
|
+
const dynamicPieSeriesOptions = {
|
|
1168
|
+
name: s.name,
|
|
1169
|
+
type: 'pie',
|
|
1170
|
+
radius: radius,
|
|
1171
|
+
label: {
|
|
1172
|
+
show: labelShow, // Por defecto en los anillos no mostramos labels para evitar overlaps
|
|
1173
|
+
position: labelPosition,
|
|
1174
|
+
},
|
|
1175
|
+
labelLine: {
|
|
1176
|
+
show: labelLineShow
|
|
1177
|
+
},
|
|
1178
|
+
data: pieData,
|
|
1179
|
+
id: `pie_${idx}`,
|
|
1180
|
+
};
|
|
1181
|
+
const seriesOption = merge(dynamicPieSeriesOptions, overrides);
|
|
1182
|
+
// Inyectar el resolver de color si existe
|
|
1183
|
+
if (this.colorResolver && seriesOption.itemStyle) {
|
|
1184
|
+
seriesOption.itemStyle.color = this.colorResolver;
|
|
1185
|
+
}
|
|
1186
|
+
return seriesOption;
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
this.result.series = series;
|
|
1190
|
+
}
|
|
1191
|
+
addTooltip(data, overrides) {
|
|
1192
|
+
merge(overrides, {
|
|
1193
|
+
formatter: getTooltipFormatter(overrides.trigger, data, this.formatCellValue.bind(this)),
|
|
1194
|
+
});
|
|
1195
|
+
const tooltip = getTooltipOptions(overrides);
|
|
1196
|
+
this.result.tooltip = tooltip;
|
|
1197
|
+
}
|
|
1198
|
+
addLegend() {
|
|
1199
|
+
this.result.legend = getLegendOptions();
|
|
1200
|
+
}
|
|
1201
|
+
// No-ops for pie charts
|
|
1202
|
+
addPolar() { }
|
|
1203
|
+
addXAxis(data, overrides, type) { }
|
|
1204
|
+
addYAxis(data, overrides, type) { }
|
|
1205
|
+
addRadiusAxis(data, overrides) { }
|
|
1206
|
+
addAngleAxis(data, overrides) { }
|
|
1207
|
+
addGraphic() { }
|
|
1208
|
+
// Callback setters
|
|
1209
|
+
setValueFormatter(formatter) {
|
|
1210
|
+
if (formatter) {
|
|
1211
|
+
this.valueFormatter = formatter;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
setPalette(palette) {
|
|
1215
|
+
if (palette) {
|
|
1216
|
+
this.palette = palette;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
setColorResolver(resolver) {
|
|
1220
|
+
if (resolver) {
|
|
1221
|
+
this.colorResolver = resolver;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
getResult() {
|
|
1225
|
+
return this.result;
|
|
1226
|
+
}
|
|
1227
|
+
formatCellValue(value, key) {
|
|
1228
|
+
return this.valueFormatter(value, key);
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
/**
|
|
1233
|
+
* EchartsPieComponent
|
|
1234
|
+
*
|
|
1235
|
+
* Especialista en visualización de tipo Pie (Torta y Anillos concéntricos).
|
|
1236
|
+
* La primera serie se dibuja como un gráfico de torta tradicional (lleno) y
|
|
1237
|
+
* las subsecuentes como anillos concéntricos alrededor.
|
|
1238
|
+
*/
|
|
1239
|
+
class EchartsPieComponent extends BaseEchartsComponent {
|
|
1240
|
+
baseSeriesOptions = {
|
|
1241
|
+
type: 'pie',
|
|
1242
|
+
center: ['50%', '50%'],
|
|
1243
|
+
avoidLabelOverlap: true,
|
|
1244
|
+
minAngle: 3,
|
|
1245
|
+
selectedMode: 'single',
|
|
1246
|
+
selectedOffset: 4,
|
|
1247
|
+
emphasis: {
|
|
1248
|
+
scale: true,
|
|
1249
|
+
scaleSize: 2,
|
|
1250
|
+
},
|
|
1251
|
+
select: {
|
|
1252
|
+
itemStyle: {
|
|
1253
|
+
borderColor: EChartsTokens.sBorderColor,
|
|
1254
|
+
shadowColor: EChartsTokens.sShadowColor,
|
|
1255
|
+
borderWidth: 1,
|
|
1256
|
+
shadowBlur: 4,
|
|
1257
|
+
},
|
|
1258
|
+
},
|
|
1259
|
+
animationType: 'scale',
|
|
1260
|
+
animationEasing: 'elasticOut',
|
|
1261
|
+
};
|
|
1262
|
+
baseProduct = {
|
|
1263
|
+
chartKey: 'pie',
|
|
1264
|
+
baseOptions: {
|
|
1265
|
+
series: this.baseSeriesOptions,
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
builder = new PieBuilder(this.baseProduct);
|
|
1269
|
+
director = new VSECDirector(this.builder);
|
|
1270
|
+
constructor() {
|
|
1271
|
+
super();
|
|
1272
|
+
}
|
|
1273
|
+
make(makeOpts) {
|
|
1274
|
+
this.director.makePie(this.data, this.optionsOverrides, makeOpts);
|
|
1275
|
+
}
|
|
1276
|
+
updateChartOptions() {
|
|
1277
|
+
if (!this.chartInstance)
|
|
1278
|
+
return;
|
|
1279
|
+
if (!this.data)
|
|
1280
|
+
return;
|
|
1281
|
+
// 1. Configuramos el builder
|
|
1282
|
+
const makeOpts = {
|
|
1283
|
+
valueFormatter: this.valueFormatter,
|
|
1284
|
+
palette: this.palette,
|
|
1285
|
+
colorResolver: this.colorResolver,
|
|
1286
|
+
};
|
|
1287
|
+
this.make(makeOpts);
|
|
1288
|
+
// 2. Obtenemos las bases del chart usando el builder
|
|
1289
|
+
const options = this.builder.getResult();
|
|
1290
|
+
this.triggerUpdate(options);
|
|
1291
|
+
}
|
|
1292
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsPieComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1293
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EchartsPieComponent, isStandalone: true, selector: "vs-echarts-pie", 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, { fixPieDataIndexInside: true })\"\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"] }] });
|
|
1294
|
+
}
|
|
1295
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsPieComponent, decorators: [{
|
|
1296
|
+
type: Component,
|
|
1297
|
+
args: [{ selector: 'vs-echarts-pie', standalone: true, imports: [
|
|
1298
|
+
CommonModule,
|
|
1299
|
+
NgxEchartsDirective,
|
|
1300
|
+
], 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, { fixPieDataIndexInside: true })\"\n></div>\n", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"] }]
|
|
1055
1301
|
}], ctorParameters: () => [] });
|
|
1056
1302
|
|
|
1057
1303
|
/**
|
|
@@ -1224,14 +1470,14 @@ class EchartsFunnelComponent extends BaseEchartsComponent {
|
|
|
1224
1470
|
this.triggerUpdate(options);
|
|
1225
1471
|
}
|
|
1226
1472
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsFunnelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1227
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EchartsFunnelComponent, isStandalone: true, selector: "vs-echarts-funnel", 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
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EchartsFunnelComponent, isStandalone: true, selector: "vs-echarts-funnel", 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, { fixPieDataIndexInside: true })\"\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"] }] });
|
|
1228
1474
|
}
|
|
1229
1475
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsFunnelComponent, decorators: [{
|
|
1230
1476
|
type: Component,
|
|
1231
1477
|
args: [{ selector: 'vs-echarts-funnel', standalone: true, imports: [
|
|
1232
1478
|
CommonModule,
|
|
1233
1479
|
NgxEchartsDirective,
|
|
1234
|
-
], 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
|
+
], 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, { fixPieDataIndexInside: true })\"\n></div>\n", styles: [".echarts-container{width:100%;height:100%;position:relative}\n"] }]
|
|
1235
1481
|
}], ctorParameters: () => [] });
|
|
1236
1482
|
|
|
1237
1483
|
/**
|
|
@@ -1855,5 +2101,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.19", ngImpo
|
|
|
1855
2101
|
* Generated bundle index. Do not edit.
|
|
1856
2102
|
*/
|
|
1857
2103
|
|
|
1858
|
-
export { BaseEchartsComponent, EChartsAreaComponent, EChartsAreaStackComponent, EChartsBarStackedComponent, EChartsBarStackedRadialComponent, EChartsHBarComponent, EChartsHBarStackedComponent, EchartsBarComponent, EchartsFunnelComponent, EchartsLineComponent, EchartsRingComponent, EchartsScatterComponent, defaultOptionsOverrides, initializeEcharts, provideVSEcharts };
|
|
2104
|
+
export { BaseEchartsComponent, EChartsAreaComponent, EChartsAreaStackComponent, EChartsBarStackedComponent, EChartsBarStackedRadialComponent, EChartsHBarComponent, EChartsHBarStackedComponent, EchartsBarComponent, EchartsFunnelComponent, EchartsLineComponent, EchartsPieComponent, EchartsRingComponent, EchartsScatterComponent, defaultOptionsOverrides, initializeEcharts, provideVSEcharts };
|
|
1859
2105
|
//# sourceMappingURL=visionaris-bruno-vs-echarts.mjs.map
|