@bizy/core 20.4.2 → 20.4.4

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.
@@ -323,7 +323,7 @@ class BizyBarLineChartComponent {
323
323
  #renderer = inject(Renderer2);
324
324
  resizeRef = null;
325
325
  tooltip = true;
326
- download = { show: true, label: 'Descargar', name: 'Bizy' };
326
+ download = null;
327
327
  axisPointer = 'line';
328
328
  xAxisLabels = [];
329
329
  onTooltipFormatter;
@@ -398,6 +398,9 @@ class BizyBarLineChartComponent {
398
398
  }
399
399
  let position = 'right';
400
400
  let offset = 0;
401
+ let max = undefined;
402
+ let min = undefined;
403
+ let interval = undefined;
401
404
  let formatter = null;
402
405
  const xName = _d.xAxi && _d.xAxi.name ? _d.xAxi.name : _d.label;
403
406
  let yName = _d.label;
@@ -411,6 +414,17 @@ class BizyBarLineChartComponent {
411
414
  axisLine.show = false;
412
415
  formatter = null;
413
416
  }
417
+ else {
418
+ if (_d.yAxi.max || _d.yAxi.max === 0) {
419
+ max = _d.yAxi.max;
420
+ }
421
+ if (_d.yAxi.min || _d.yAxi.min === 0) {
422
+ min = _d.yAxi.min;
423
+ }
424
+ if (_d.yAxi.interval || _d.yAxi.interval === 0) {
425
+ interval = _d.yAxi.interval;
426
+ }
427
+ }
414
428
  }
415
429
  if (!_d.yAxi || !_d.yAxi.hide) {
416
430
  if (position === 'right') {
@@ -426,6 +440,9 @@ class BizyBarLineChartComponent {
426
440
  type: 'value',
427
441
  name: _d.yAxi && _d.yAxi.hide ? '' : yName,
428
442
  position,
443
+ min,
444
+ max,
445
+ interval,
429
446
  alignTicks: true,
430
447
  offset,
431
448
  axisLine,
@@ -449,14 +466,37 @@ class BizyBarLineChartComponent {
449
466
  else {
450
467
  this.#chartNames.push(yName);
451
468
  }
452
- series.push({ ...{
453
- type: _d.type,
454
- name: xName,
455
- yAxisIndex,
456
- smooth: !_d.discrete,
457
- stack: _d.stack,
458
- data: _d.values
459
- }, ...color });
469
+ if (_d.barMinHeight) {
470
+ const values = _d.values.map(v => v > 0 ? v : '-'); // use '-' for missing data
471
+ const emptyValues = _d.values.map(v => v === 0 ? 0 : '-');
472
+ series.push({ ...{
473
+ type: _d.type,
474
+ name: xName,
475
+ yAxisIndex,
476
+ smooth: !_d.discrete,
477
+ stack: _d.stack,
478
+ barMinHeight: _d.barMinHeight,
479
+ data: values
480
+ }, ...color });
481
+ series.push({ ...{
482
+ type: _d.type,
483
+ name: '-',
484
+ yAxisIndex,
485
+ smooth: !_d.discrete,
486
+ stack: _d.stack,
487
+ data: emptyValues
488
+ }, ...color });
489
+ }
490
+ else {
491
+ series.push({ ...{
492
+ type: _d.type,
493
+ name: xName,
494
+ yAxisIndex,
495
+ smooth: !_d.discrete,
496
+ stack: _d.stack,
497
+ data: _d.values
498
+ }, ...color });
499
+ }
460
500
  });
461
501
  const tooltip = {
462
502
  show: this.tooltip,
@@ -493,13 +533,15 @@ class BizyBarLineChartComponent {
493
533
  const textColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-bar-line-chart-tooltip-color');
494
534
  const textBackgroundColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-bar-line-chart-tooltip-background-color');
495
535
  const borderColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-bar-line-chart-tooltip-border-color');
536
+ const downloadTitle = this.download?.label || 'Descargar';
537
+ const downloadName = this.download?.name || 'bizy_chart';
496
538
  const toolbox = {
497
539
  show: true,
498
540
  feature: {
499
541
  mySaveAsImage: {
500
- show: this.download.show,
542
+ show: Boolean(this.download),
501
543
  icon: 'path://M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 242.7-73.4-73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L288 274.7 288 32zM64 352c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-101.5 0-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352 64 352zm368 56a24 24 0 1 1 0 48 24 24 0 1 1 0-48z',
502
- title: this.download.label,
544
+ title: downloadTitle,
503
545
  onclick: () => {
504
546
  const showAllLegends = (chart) => {
505
547
  const option = chart.getOption();
@@ -528,7 +570,7 @@ class BizyBarLineChartComponent {
528
570
  html2canvas(this.#chartContainer).then(canvas => {
529
571
  var link = this.#renderer.createElement('a');
530
572
  link.href = canvas.toDataURL('image/png');
531
- link.download = `${this.download.name}.png`;
573
+ link.download = downloadName;
532
574
  this.#renderer.appendChild(this.#document.body, link);
533
575
  link.click();
534
576
  this.#renderer.removeChild(this.#document.body, link);
@@ -3135,7 +3177,7 @@ class BizyHeatMapChartComponent {
3135
3177
  resizeRef = null;
3136
3178
  tooltip = true;
3137
3179
  ranges = [];
3138
- download = { show: true, label: 'Descargar', name: 'Bizy' };
3180
+ download = null;
3139
3181
  xAxisLabels = [];
3140
3182
  yAxisLabels = [];
3141
3183
  onTooltipFormatter;
@@ -3220,19 +3262,21 @@ class BizyHeatMapChartComponent {
3220
3262
  const textColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-heat-map-chart-tooltip-color');
3221
3263
  const textBackgroundColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-heat-map-chart-tooltip-background-color');
3222
3264
  const borderColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-heat-map-chart-tooltip-border-color');
3265
+ const downloadTitle = this.download?.label || 'Descargar';
3266
+ const downloadName = this.download?.name || 'bizy_chart';
3223
3267
  const toolbox = {
3224
3268
  show: true,
3225
3269
  feature: {
3226
3270
  mySaveAsImage: {
3227
- show: this.download.show,
3271
+ show: Boolean(this.download),
3228
3272
  icon: 'path://M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 242.7-73.4-73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L288 274.7 288 32zM64 352c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-101.5 0-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352 64 352zm368 56a24 24 0 1 1 0 48 24 24 0 1 1 0-48z',
3229
- title: this.download.label,
3273
+ title: downloadTitle,
3230
3274
  onclick: () => {
3231
3275
  setTimeout(() => {
3232
3276
  html2canvas(this.#chartContainer).then(canvas => {
3233
3277
  var link = this.#renderer.createElement('a');
3234
3278
  link.href = canvas.toDataURL('image/png');
3235
- link.download = `${this.download.name}.png`;
3279
+ link.download = downloadName;
3236
3280
  this.#renderer.appendChild(this.#document.body, link);
3237
3281
  link.click();
3238
3282
  this.#renderer.removeChild(this.#document.body, link);
@@ -3610,7 +3654,7 @@ class BizyPieChartComponent {
3610
3654
  centerLabel = null;
3611
3655
  type = 'pie';
3612
3656
  legend = null;
3613
- download = { show: true, label: 'Descargar', name: 'Bizy' };
3657
+ download = null;
3614
3658
  onLabelFormatter;
3615
3659
  onTooltipFormatter;
3616
3660
  onSelect = new EventEmitter();
@@ -3697,19 +3741,21 @@ class BizyPieChartComponent {
3697
3741
  const textColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-pie-chart-tooltip-color');
3698
3742
  const textBackgroundColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-pie-chart-tooltip-background-color');
3699
3743
  const borderColor = this.#getClosestCssVariable(this.#elementRef.nativeElement, '--bizy-pie-chart-tooltip-border-color');
3744
+ const downloadTitle = this.download?.label || 'Descargar';
3745
+ const downloadName = this.download?.name || 'bizy_chart';
3700
3746
  const toolbox = {
3701
3747
  show: true,
3702
3748
  feature: {
3703
3749
  mySaveAsImage: {
3704
- show: this.download.show,
3750
+ show: Boolean(this.download),
3705
3751
  icon: 'path://M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 242.7-73.4-73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L288 274.7 288 32zM64 352c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-101.5 0-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352 64 352zm368 56a24 24 0 1 1 0 48 24 24 0 1 1 0-48z',
3706
- title: this.download.label,
3752
+ title: downloadTitle,
3707
3753
  onclick: () => {
3708
3754
  setTimeout(() => {
3709
3755
  html2canvas(this.#chartContainer).then(canvas => {
3710
3756
  var link = this.#renderer.createElement('a');
3711
3757
  link.href = canvas.toDataURL('image/png');
3712
- link.download = `${this.download.name}.png`;
3758
+ link.download = downloadName;
3713
3759
  this.#renderer.appendChild(this.#document.body, link);
3714
3760
  link.click();
3715
3761
  this.#renderer.removeChild(this.#document.body, link);