@visionaris-bruno/vs-echarts 7.1.0 → 7.1.3

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.
@@ -242,9 +242,18 @@ class BaseEchartsComponent {
242
242
  */
243
243
  onInputChanges(changes) {
244
244
  if (changes['data'] || changes['optionsOverrides'] || changes['palette'] || changes['colorResolver'] || changes['valueFormatter']) {
245
- this.updateChartOptions();
245
+ this.prepareOptions();
246
246
  }
247
247
  }
248
+ prepareOptions() {
249
+ if (!this.chartInstance)
250
+ return;
251
+ if (!this.data)
252
+ return;
253
+ this.make();
254
+ const baseOptions = this.builder.getResult();
255
+ this.triggerUpdate(baseOptions);
256
+ }
248
257
  /**
249
258
  * Gatilla actualización.
250
259
  *
@@ -258,7 +267,7 @@ class BaseEchartsComponent {
258
267
  */
259
268
  onChartInit(instance) {
260
269
  this.chartInstance = instance;
261
- this.updateChartOptions();
270
+ this.prepareOptions();
262
271
  }
263
272
  onChartClick(event) {
264
273
  if (event.componentType === 'series') {
@@ -712,24 +721,26 @@ function mapToChartItems(categories, seriesNode) {
712
721
  /**
713
722
  * Formatter generator for 'item' trigger strategy in tooltips.
714
723
  */
715
- function getItemTooltipFormatter(data, formatCellValue) {
724
+ function getItemTooltipFormatter(data, formatCellValue, opts) {
716
725
  const totalSeries = data.series.length;
717
726
  return (params) => {
727
+ const showSerieName = opts?.showSerieName ?? true;
718
728
  const seriesObj = data.series[params.seriesIndex];
719
729
  const key = params.data?.originalMeassureKey || seriesObj?.originalKey || getCategoryKey(data.categories, params.dataIndex);
720
730
  const valFormatted = formatCellValue(params.value, key);
731
+ const serieName = showSerieName ? `${params.marker} ${params.seriesName}<br/ >` : '';
721
732
  //TODO: Unificar salida del tooltip
722
733
  if (params.percent !== undefined) {
723
- const seriesHeader = totalSeries > 1 ? `${params.marker}${params.seriesName}` : '';
724
- return `<div style="text-align: center;"><b>${params.name}</b><br/>${seriesHeader}<br/> <b>${valFormatted}</b> (${params.percent}%)</div>`;
734
+ const seriesHeader = totalSeries > 1 ? serieName : '';
735
+ return `<div style="text-align: center;"><b>${params.name}</b><br/>${seriesHeader} <b>${valFormatted}</b> (${params.percent}%)</div>`;
725
736
  }
726
- return `<div style="text-align: center;"><b>${params.name}</b><br/>${params.marker} ${params.seriesName}<br/><b>${valFormatted}</b></div>`;
737
+ return `<div style="text-align: center;"><b>${params.name}</b><br/>${serieName}<b>${valFormatted}</b></div>`;
727
738
  };
728
739
  }
729
740
  /**
730
741
  * Formatter generator for 'axis' trigger strategy in tooltips.
731
742
  */
732
- function getAxisTooltipFormatter(data, formatCellValue) {
743
+ function getAxisTooltipFormatter(data, formatCellValue, opts) {
733
744
  return (params) => {
734
745
  if (!params)
735
746
  return '';
@@ -752,10 +763,10 @@ function getAxisTooltipFormatter(data, formatCellValue) {
752
763
  /**
753
764
  * Unified tooltip formatter generator that selects the appropriate strategy based on the trigger.
754
765
  */
755
- function getTooltipFormatter(trigger, data, formatCellValue) {
766
+ function getTooltipFormatter(trigger, data, formatCellValue, opts) {
756
767
  return trigger === 'axis'
757
- ? getAxisTooltipFormatter(data, formatCellValue)
758
- : getItemTooltipFormatter(data, formatCellValue);
768
+ ? getAxisTooltipFormatter(data, formatCellValue, opts)
769
+ : getItemTooltipFormatter(data, formatCellValue, opts);
759
770
  }
760
771
  function getCommons(opts) {
761
772
  const palette = opts?.palette ?? getDefaultPalette();
@@ -777,14 +788,41 @@ function getCommons(opts) {
777
788
  return common;
778
789
  }
779
790
  /**
780
- * Maps hierarchical category nodes and a single series data array into a nested structure
791
+ * Maps hierarchical category nodes and an array of series into a nested structure
781
792
  * suitable for Sunburst/Treemap charts.
793
+ * The categories form the levels closest to the center, and the series form the leaf level.
782
794
  */
783
- function mapHierarchicalData(categories, seriesData) {
784
- if (!categories || !seriesData) {
795
+ function mapHierarchicalData(categories, series) {
796
+ if (!categories) {
785
797
  return [];
786
798
  }
787
799
  let leafIndex = 0;
800
+ function mapSeriesTree(seriesNodes, index) {
801
+ if (!seriesNodes) {
802
+ return [];
803
+ }
804
+ return seriesNodes.map(s => {
805
+ const node = {
806
+ name: s.name,
807
+ };
808
+ if (s.children && s.children.length > 0) {
809
+ node.children = mapSeriesTree(s.children, index);
810
+ }
811
+ else {
812
+ // Leaf series node: extract value from s.data[index]
813
+ const dataVal = s.data?.[index];
814
+ if (dataVal !== undefined && dataVal !== null) {
815
+ const value = typeof dataVal === 'object' && 'value' in dataVal ? dataVal.value : dataVal;
816
+ node.value = getCellValue(value);
817
+ }
818
+ else {
819
+ node.value = 0;
820
+ }
821
+ node.originalMeassureKey = s.originalKey;
822
+ }
823
+ return node;
824
+ });
825
+ }
788
826
  function traverse(nodes) {
789
827
  return nodes.map(cat => {
790
828
  const node = {
@@ -794,11 +832,9 @@ function mapHierarchicalData(categories, seriesData) {
794
832
  node.children = traverse(cat.children);
795
833
  }
796
834
  else {
797
- // Leaf node: extract and assign value sequentially from seriesData
798
- const dataVal = seriesData[leafIndex];
799
- if (dataVal !== undefined && dataVal !== null) {
800
- const value = typeof dataVal === 'object' && 'value' in dataVal ? dataVal.value : dataVal;
801
- node.value = getCellValue(value);
835
+ // Leaf category node: append the series tree as children
836
+ if (series && series.length > 0) {
837
+ node.children = mapSeriesTree(series, leafIndex);
802
838
  }
803
839
  else {
804
840
  node.value = 0;
@@ -810,6 +846,24 @@ function mapHierarchicalData(categories, seriesData) {
810
846
  }
811
847
  return traverse(categories);
812
848
  }
849
+ /**
850
+ * Calculates the maximum depth of a tree structure.
851
+ */
852
+ function getTreeDepth(nodes) {
853
+ if (!nodes || nodes.length === 0) {
854
+ return 0;
855
+ }
856
+ let maxChildDepth = 0;
857
+ for (const node of nodes) {
858
+ if (node.children && node.children.length > 0) {
859
+ const d = getTreeDepth(node.children);
860
+ if (d > maxChildDepth) {
861
+ maxChildDepth = d;
862
+ }
863
+ }
864
+ }
865
+ return 1 + maxChildDepth;
866
+ }
813
867
 
814
868
  /**
815
869
  * RingBuilder
@@ -1152,7 +1206,12 @@ class EchartsRingComponent extends BaseEchartsComponent {
1152
1206
  constructor() {
1153
1207
  super();
1154
1208
  }
1155
- make(makeOpts) {
1209
+ make() {
1210
+ const makeOpts = {
1211
+ valueFormatter: this.valueFormatter,
1212
+ palette: this.palette,
1213
+ colorResolver: this.colorResolver,
1214
+ };
1156
1215
  this.director.makeRing(this.data, this.optionsOverrides, makeOpts);
1157
1216
  }
1158
1217
  onInputChanges(changes) {
@@ -1222,22 +1281,6 @@ class EchartsRingComponent extends BaseEchartsComponent {
1222
1281
  }
1223
1282
  });
1224
1283
  }
1225
- updateChartOptions() {
1226
- if (!this.chartInstance)
1227
- return;
1228
- if (!this.data)
1229
- return;
1230
- // 1. Configuramos el builder (Formateadores, Colores, etc se manejan en la base)
1231
- const makeOpts = {
1232
- valueFormatter: this.valueFormatter,
1233
- palette: this.palette,
1234
- colorResolver: this.colorResolver,
1235
- };
1236
- this.make(makeOpts);
1237
- // 2. Obtenemos las bases del chart usando el builder
1238
- const options = this.builder.getResult();
1239
- this.triggerUpdate(options);
1240
- }
1241
1284
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsRingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1242
1285
  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"] }] });
1243
1286
  }
@@ -1439,24 +1482,13 @@ class EchartsPieComponent extends BaseEchartsComponent {
1439
1482
  constructor() {
1440
1483
  super();
1441
1484
  }
1442
- make(makeOpts) {
1443
- this.director.makePie(this.data, this.optionsOverrides, makeOpts);
1444
- }
1445
- updateChartOptions() {
1446
- if (!this.chartInstance)
1447
- return;
1448
- if (!this.data)
1449
- return;
1450
- // 1. Configuramos el builder
1485
+ make() {
1451
1486
  const makeOpts = {
1452
1487
  valueFormatter: this.valueFormatter,
1453
1488
  palette: this.palette,
1454
1489
  colorResolver: this.colorResolver,
1455
1490
  };
1456
- this.make(makeOpts);
1457
- // 2. Obtenemos las bases del chart usando el builder
1458
- const options = this.builder.getResult();
1459
- this.triggerUpdate(options);
1491
+ this.director.makePie(this.data, this.optionsOverrides, makeOpts);
1460
1492
  }
1461
1493
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsPieComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1462
1494
  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"] }] });
@@ -1619,22 +1651,13 @@ class EchartsFunnelComponent extends BaseEchartsComponent {
1619
1651
  constructor() {
1620
1652
  super();
1621
1653
  }
1622
- make(makeOpts) {
1623
- this.director.makeFunnel(this.data, this.optionsOverrides, makeOpts);
1624
- }
1625
- updateChartOptions() {
1626
- if (!this.chartInstance)
1627
- return;
1628
- if (!this.data)
1629
- return;
1654
+ make() {
1630
1655
  const makeOpts = {
1631
1656
  valueFormatter: this.valueFormatter,
1632
1657
  palette: this.palette,
1633
1658
  colorResolver: this.colorResolver,
1634
1659
  };
1635
- this.make(makeOpts);
1636
- const options = this.builder.getResult();
1637
- this.triggerUpdate(options);
1660
+ this.director.makeFunnel(this.data, this.optionsOverrides, makeOpts);
1638
1661
  }
1639
1662
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsFunnelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1640
1663
  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"] }] });
@@ -1890,23 +1913,13 @@ class EchartsBarComponent extends BaseEchartsComponent {
1890
1913
  constructor() {
1891
1914
  super();
1892
1915
  }
1893
- // va a tener que estar en el base como "abstract".
1894
- make(makeOpts) {
1895
- this.director.makeBar(this.data, this.optionsOverrides, makeOpts);
1896
- }
1897
- updateChartOptions() {
1898
- if (!this.chartInstance)
1899
- return;
1900
- if (!this.data)
1901
- return;
1916
+ make() {
1902
1917
  const makeBarOpts = {
1903
1918
  valueFormatter: this.valueFormatter,
1904
1919
  palette: this.palette,
1905
1920
  colorResolver: this.colorResolver,
1906
1921
  };
1907
- this.make(makeBarOpts);
1908
- const baseOptions = this.builder.getResult();
1909
- this.triggerUpdate(baseOptions);
1922
+ this.director.makeBar(this.data, this.optionsOverrides, makeBarOpts);
1910
1923
  }
1911
1924
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsBarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1912
1925
  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"] }] });
@@ -1934,10 +1947,15 @@ class EChartsHBarComponent extends EchartsBarComponent {
1934
1947
  };
1935
1948
  builder = new EChartBuilder(this.variantBaseProduct);
1936
1949
  director = new VSECDirector(this.builder);
1937
- make(makeOpts) {
1938
- makeOpts.axisTypes = {
1939
- x: 'value',
1940
- y: 'category',
1950
+ make() {
1951
+ const makeOpts = {
1952
+ valueFormatter: this.valueFormatter,
1953
+ palette: this.palette,
1954
+ colorResolver: this.colorResolver,
1955
+ axisTypes: {
1956
+ x: 'value',
1957
+ y: 'category',
1958
+ },
1941
1959
  };
1942
1960
  this.director.makeBar(this.data, this.optionsOverrides, makeOpts);
1943
1961
  }
@@ -2001,10 +2019,15 @@ class EChartsHBarStackedComponent extends EchartsBarComponent {
2001
2019
  };
2002
2020
  builder = new EChartBuilder(this.variantBaseProduct);
2003
2021
  director = new VSECDirector(this.builder);
2004
- make(makeOpts) {
2005
- makeOpts.axisTypes = {
2006
- x: 'value',
2007
- y: 'category',
2022
+ make() {
2023
+ const makeOpts = {
2024
+ valueFormatter: this.valueFormatter,
2025
+ palette: this.palette,
2026
+ colorResolver: this.colorResolver,
2027
+ axisTypes: {
2028
+ x: 'value',
2029
+ y: 'category',
2030
+ },
2008
2031
  };
2009
2032
  this.director.makeBar(this.data, this.optionsOverrides, makeOpts);
2010
2033
  }
@@ -2039,7 +2062,12 @@ class EChartsBarStackedRadialComponent extends EchartsBarComponent {
2039
2062
  };
2040
2063
  builder = new EChartBuilder(this.variantBaseProduct);
2041
2064
  director = new VSECDirector(this.builder);
2042
- make(makeOpts) {
2065
+ make() {
2066
+ const makeOpts = {
2067
+ valueFormatter: this.valueFormatter,
2068
+ palette: this.palette,
2069
+ colorResolver: this.colorResolver,
2070
+ };
2043
2071
  this.director.makeBarRadial(this.data, this.optionsOverrides, makeOpts);
2044
2072
  }
2045
2073
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsBarStackedRadialComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
@@ -2103,22 +2131,13 @@ class EchartsLineComponent extends BaseEchartsComponent {
2103
2131
  constructor() {
2104
2132
  super();
2105
2133
  }
2106
- make(makeOpts) {
2107
- this.director.makeLine(this.data, this.optionsOverrides, makeOpts);
2108
- }
2109
- updateChartOptions() {
2110
- if (!this.chartInstance)
2111
- return;
2112
- if (!this.data)
2113
- return;
2114
- const makeBarOpts = {
2134
+ make() {
2135
+ const makeOpts = {
2115
2136
  valueFormatter: this.valueFormatter,
2116
2137
  palette: this.palette,
2117
2138
  colorResolver: this.colorResolver,
2118
2139
  };
2119
- this.make(makeBarOpts);
2120
- const baseOptions = this.builder.getResult();
2121
- this.triggerUpdate(baseOptions);
2140
+ this.director.makeLine(this.data, this.optionsOverrides, makeOpts);
2122
2141
  }
2123
2142
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsLineComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2124
2143
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EchartsLineComponent, isStandalone: true, selector: "vs-echarts-line", providers: [
@@ -2229,22 +2248,13 @@ class EchartsScatterComponent extends BaseEchartsComponent {
2229
2248
  constructor() {
2230
2249
  super();
2231
2250
  }
2232
- make(makeOpts) {
2233
- this.director.makeScatter(this.data, this.optionsOverrides, makeOpts);
2234
- }
2235
- updateChartOptions() {
2236
- if (!this.chartInstance)
2237
- return;
2238
- if (!this.data)
2239
- return;
2240
- const makeScatterOpts = {
2251
+ make() {
2252
+ const makeOpts = {
2241
2253
  valueFormatter: this.valueFormatter,
2242
2254
  palette: this.palette,
2243
2255
  colorResolver: this.colorResolver,
2244
2256
  };
2245
- this.make(makeScatterOpts);
2246
- const baseOptions = this.builder.getResult();
2247
- this.triggerUpdate(baseOptions);
2257
+ this.director.makeScatter(this.data, this.optionsOverrides, makeOpts);
2248
2258
  }
2249
2259
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EchartsScatterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2250
2260
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EchartsScatterComponent, isStandalone: true, selector: "vs-echarts-scatter", 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"] }] });
@@ -2274,11 +2284,20 @@ class SunburstBuilder {
2274
2284
  if (!data || !data.series || data.series.length === 0) {
2275
2285
  return;
2276
2286
  }
2277
- const firstSeries = data.series[0];
2278
- const sunburstData = mapHierarchicalData(data.categories, firstSeries.data);
2287
+ const sunburstData = mapHierarchicalData(data.categories, data.series);
2288
+ const depth = getTreeDepth(sunburstData);
2289
+ const levels = [];
2290
+ for (let i = 0; i <= depth; i++) {
2291
+ levels.push({
2292
+ label: {
2293
+ show: false,
2294
+ },
2295
+ });
2296
+ }
2279
2297
  const dynamiSerieOptions = {
2280
- name: firstSeries.name,
2298
+ name: '',
2281
2299
  data: sunburstData,
2300
+ levels: levels
2282
2301
  };
2283
2302
  const serie = merge$1({}, dynamiSerieOptions, overrides);
2284
2303
  if (this.colorResolver) {
@@ -2343,18 +2362,18 @@ class SunburstBuilder {
2343
2362
  class EChartsSunburstComponent extends BaseEchartsComponent {
2344
2363
  baseSeriesOptions = {
2345
2364
  type: 'sunburst',
2346
- radius: [0, '85%'],
2365
+ radius: ['15%', '85%'],
2347
2366
  sort: undefined,
2348
2367
  emphasis: {
2349
2368
  focus: 'ancestor'
2350
2369
  },
2370
+ itemStyle: {
2371
+ borderWidth: 1.5,
2372
+ borderColor: '#fff'
2373
+ },
2351
2374
  levels: [
2352
2375
  {},
2353
2376
  {
2354
- r0: '15%',
2355
- itemStyle: {
2356
- borderWidth: 2
2357
- },
2358
2377
  label: {
2359
2378
  rotate: 'tangential'
2360
2379
  }
@@ -2377,15 +2396,6 @@ class EChartsSunburstComponent extends BaseEchartsComponent {
2377
2396
  };
2378
2397
  this.director.makeSunburst(this.data, this.optionsOverrides, makeOpts);
2379
2398
  }
2380
- updateChartOptions() {
2381
- if (!this.chartInstance)
2382
- return;
2383
- if (!this.data)
2384
- return;
2385
- this.make();
2386
- const baseOptions = this.builder.getResult();
2387
- this.triggerUpdate(baseOptions);
2388
- }
2389
2399
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: EChartsSunburstComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
2390
2400
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: EChartsSunburstComponent, isStandalone: true, selector: "vs-echarts-sunburst", 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"] }] });
2391
2401
  }