ng-prime-tools 1.0.94 → 1.0.96

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.
@@ -4093,6 +4093,228 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
4093
4093
  }]
4094
4094
  }] });
4095
4095
 
4096
+ const PT_CHART_DEFAULT_WIDTH = '100%';
4097
+ const PT_CHART_DEFAULT_HEIGHT = '100%';
4098
+ const PT_CHART_DEFAULT_RESIZE_DELAY = 100;
4099
+ const PT_CHART_DEFAULT_ANIMATION = {
4100
+ duration: 450,
4101
+ easing: 'easeOutQuart',
4102
+ };
4103
+ const PT_CHART_DEFAULT_LAYOUT_PADDING = {
4104
+ top: 12,
4105
+ right: 12,
4106
+ bottom: 8,
4107
+ left: 12,
4108
+ };
4109
+ const PT_CHART_LEGEND_LABELS = {
4110
+ usePointStyle: true,
4111
+ pointStyle: 'circle',
4112
+ boxWidth: 9,
4113
+ boxHeight: 9,
4114
+ padding: 18,
4115
+ };
4116
+ const PT_CHART_TOOLTIP_STYLE = {
4117
+ borderWidth: 1,
4118
+ cornerRadius: 10,
4119
+ caretSize: 7,
4120
+ caretPadding: 8,
4121
+ padding: 12,
4122
+ boxPadding: 6,
4123
+ usePointStyle: true,
4124
+ displayColors: true,
4125
+ };
4126
+ const PT_CHART_FONT_SIZES = {
4127
+ legend: 12,
4128
+ title: 16,
4129
+ tooltipTitle: 13,
4130
+ tooltipBody: 12,
4131
+ axisTicks: 11,
4132
+ axisTitle: 12,
4133
+ dataLabel: 11,
4134
+ };
4135
+ const PT_CHART_FONT_WEIGHTS = {
4136
+ regular: 400,
4137
+ medium: 500,
4138
+ semiBold: 600,
4139
+ bold: 'bold',
4140
+ };
4141
+ const PT_CHART_CARTESIAN_TYPES = [
4142
+ 'bar',
4143
+ 'line',
4144
+ 'scatter',
4145
+ 'bubble',
4146
+ ];
4147
+ const PT_CHART_CIRCULAR_TYPES = [
4148
+ 'pie',
4149
+ 'doughnut',
4150
+ 'polarArea',
4151
+ ];
4152
+ const buildAxisTickFont = (fontFamily) => ({
4153
+ family: fontFamily,
4154
+ size: PT_CHART_FONT_SIZES.axisTicks,
4155
+ weight: PT_CHART_FONT_WEIGHTS.regular,
4156
+ });
4157
+ const isCartesianChartType = (chartType) => PT_CHART_CARTESIAN_TYPES.includes(chartType);
4158
+ const isCircularChartType = (chartType) => PT_CHART_CIRCULAR_TYPES.includes(chartType);
4159
+ const createDefaultChartOptions = (chartType, theme, config) => {
4160
+ const isCartesianChart = isCartesianChartType(chartType);
4161
+ const isCircularChart = isCircularChartType(chartType);
4162
+ const options = {
4163
+ responsive: true,
4164
+ maintainAspectRatio: false,
4165
+ resizeDelay: PT_CHART_DEFAULT_RESIZE_DELAY,
4166
+ interaction: {
4167
+ intersect: false,
4168
+ mode: isCartesianChart ? 'index' : 'nearest',
4169
+ },
4170
+ animation: PT_CHART_DEFAULT_ANIMATION,
4171
+ layout: {
4172
+ padding: PT_CHART_DEFAULT_LAYOUT_PADDING,
4173
+ },
4174
+ plugins: {
4175
+ legend: {
4176
+ display: true,
4177
+ position: 'bottom',
4178
+ align: 'center',
4179
+ labels: {
4180
+ color: theme.textColor,
4181
+ ...PT_CHART_LEGEND_LABELS,
4182
+ font: {
4183
+ family: config.fontFamily,
4184
+ size: PT_CHART_FONT_SIZES.legend,
4185
+ weight: PT_CHART_FONT_WEIGHTS.medium,
4186
+ },
4187
+ },
4188
+ },
4189
+ title: {
4190
+ display: Boolean(config.medianTitle?.trim()),
4191
+ text: config.medianTitle?.trim() || '',
4192
+ align: 'start',
4193
+ color: theme.textColor,
4194
+ padding: {
4195
+ top: 4,
4196
+ bottom: 18,
4197
+ },
4198
+ font: {
4199
+ family: config.fontFamily,
4200
+ size: PT_CHART_FONT_SIZES.title,
4201
+ weight: PT_CHART_FONT_WEIGHTS.semiBold,
4202
+ },
4203
+ },
4204
+ tooltip: {
4205
+ enabled: true,
4206
+ backgroundColor: theme.tooltipBackgroundColor,
4207
+ titleColor: theme.tooltipTextColor,
4208
+ bodyColor: theme.tooltipTextColor,
4209
+ footerColor: theme.secondaryTextColor,
4210
+ borderColor: theme.tooltipBorderColor,
4211
+ ...PT_CHART_TOOLTIP_STYLE,
4212
+ titleFont: {
4213
+ family: config.fontFamily,
4214
+ size: PT_CHART_FONT_SIZES.tooltipTitle,
4215
+ weight: PT_CHART_FONT_WEIGHTS.semiBold,
4216
+ },
4217
+ bodyFont: {
4218
+ family: config.fontFamily,
4219
+ size: PT_CHART_FONT_SIZES.tooltipBody,
4220
+ weight: PT_CHART_FONT_WEIGHTS.regular,
4221
+ },
4222
+ callbacks: {
4223
+ label: (context) => config.tooltipLabel(context, isCircularChart),
4224
+ },
4225
+ },
4226
+ datalabels: {
4227
+ display: isCircularChart,
4228
+ color: theme.textColor,
4229
+ anchor: isCircularChart ? 'center' : 'end',
4230
+ align: isCircularChart ? 'center' : 'top',
4231
+ clamp: true,
4232
+ clip: false,
4233
+ formatter: (value, context) => config.dataLabel(value, context, isCircularChart),
4234
+ font: {
4235
+ family: config.fontFamily,
4236
+ size: PT_CHART_FONT_SIZES.dataLabel,
4237
+ weight: PT_CHART_FONT_WEIGHTS.bold,
4238
+ },
4239
+ textStrokeColor: theme.surfaceColor,
4240
+ textStrokeWidth: isCircularChart ? 2 : 0,
4241
+ },
4242
+ },
4243
+ };
4244
+ if (isCartesianChart) {
4245
+ options.scales = {
4246
+ x: {
4247
+ display: true,
4248
+ beginAtZero: false,
4249
+ border: {
4250
+ display: false,
4251
+ },
4252
+ grid: {
4253
+ display: false,
4254
+ color: theme.gridColor,
4255
+ drawTicks: false,
4256
+ },
4257
+ ticks: {
4258
+ color: theme.secondaryTextColor,
4259
+ padding: 10,
4260
+ maxRotation: 0,
4261
+ autoSkip: true,
4262
+ font: buildAxisTickFont(config.fontFamily),
4263
+ },
4264
+ title: {
4265
+ display: Boolean(config.xAxisTitle?.trim()),
4266
+ text: config.xAxisTitle?.trim() || '',
4267
+ color: theme.textColor,
4268
+ padding: {
4269
+ top: 12,
4270
+ },
4271
+ font: {
4272
+ family: config.fontFamily,
4273
+ size: PT_CHART_FONT_SIZES.axisTitle,
4274
+ weight: PT_CHART_FONT_WEIGHTS.semiBold,
4275
+ },
4276
+ },
4277
+ },
4278
+ y: {
4279
+ display: true,
4280
+ beginAtZero: config.yAxisBeginAtZero ?? true,
4281
+ min: config.yAxisMin,
4282
+ max: config.yAxisMax,
4283
+ border: {
4284
+ display: false,
4285
+ },
4286
+ grid: {
4287
+ display: true,
4288
+ color: theme.gridColor,
4289
+ drawTicks: false,
4290
+ lineWidth: 1,
4291
+ },
4292
+ ticks: {
4293
+ color: theme.secondaryTextColor,
4294
+ padding: 10,
4295
+ stepSize: config.yAxisStepSize,
4296
+ font: buildAxisTickFont(config.fontFamily),
4297
+ },
4298
+ title: {
4299
+ display: Boolean(config.yAxisTitle?.trim()),
4300
+ text: config.yAxisTitle?.trim() || '',
4301
+ color: theme.textColor,
4302
+ padding: {
4303
+ bottom: 12,
4304
+ },
4305
+ font: {
4306
+ family: config.fontFamily,
4307
+ size: PT_CHART_FONT_SIZES.axisTitle,
4308
+ weight: PT_CHART_FONT_WEIGHTS.semiBold,
4309
+ },
4310
+ },
4311
+ },
4312
+ };
4313
+ }
4314
+ return options;
4315
+ };
4316
+
4317
+ // ng-prime-tools/projects/ng-prime-tools/src/lib/pt-chart/pt-chart.component.ts
4096
4318
  class PTChartComponent {
4097
4319
  constructor(document) {
4098
4320
  this.document = document;
@@ -4107,6 +4329,7 @@ class PTChartComponent {
4107
4329
  this.initializeChart();
4108
4330
  this.observeContainerResize();
4109
4331
  this.observeThemeChanges();
4332
+ this.scheduleChartResize();
4110
4333
  }
4111
4334
  ngOnChanges(changes) {
4112
4335
  if (this.viewInitialized && changes['chartConfig'] && this.chartConfig) {
@@ -4121,8 +4344,8 @@ class PTChartComponent {
4121
4344
  }
4122
4345
  get chartContainerStyle() {
4123
4346
  return {
4124
- width: this.chartConfig?.chartWidth?.trim() || '100%',
4125
- height: this.chartConfig?.chartHeight?.trim() || '100%',
4347
+ width: this.chartConfig?.chartWidth?.trim() || PT_CHART_DEFAULT_WIDTH,
4348
+ height: this.chartConfig?.chartHeight?.trim() || PT_CHART_DEFAULT_HEIGHT,
4126
4349
  };
4127
4350
  }
4128
4351
  get chartAriaLabel() {
@@ -4137,6 +4360,7 @@ class PTChartComponent {
4137
4360
  const configuration = this.buildChartConfiguration();
4138
4361
  this.chart = new Chart(canvas, configuration);
4139
4362
  this.currentChartType = this.chartConfig.type;
4363
+ this.scheduleChartResize();
4140
4364
  }
4141
4365
  updateChart() {
4142
4366
  if (!this.viewInitialized || !this.chartConfig) {
@@ -4147,10 +4371,6 @@ class PTChartComponent {
4147
4371
  return;
4148
4372
  }
4149
4373
  const requestedType = this.chartConfig.type;
4150
- /*
4151
- * Chart.js does not safely support changing the root chart type
4152
- * dynamically. Recreate the chart when the requested type changes.
4153
- */
4154
4374
  if (this.currentChartType !== requestedType) {
4155
4375
  this.initializeChart();
4156
4376
  return;
@@ -4161,6 +4381,7 @@ class PTChartComponent {
4161
4381
  this.chart.options = configuration.options;
4162
4382
  }
4163
4383
  this.chart.update();
4384
+ this.scheduleChartResize();
4164
4385
  }
4165
4386
  buildChartConfiguration() {
4166
4387
  const chartType = this.chartConfig.type;
@@ -4174,192 +4395,18 @@ class PTChartComponent {
4174
4395
  };
4175
4396
  }
4176
4397
  buildDefaultOptions(chartType, theme) {
4177
- const isCartesianChart = this.isCartesianChart(chartType);
4178
- const isCircularChart = this.isCircularChart(chartType);
4179
- const options = {
4180
- responsive: true,
4181
- maintainAspectRatio: false,
4182
- resizeDelay: 100,
4183
- interaction: {
4184
- intersect: false,
4185
- mode: isCartesianChart ? 'index' : 'nearest',
4186
- },
4187
- animation: {
4188
- duration: 450,
4189
- easing: 'easeOutQuart',
4190
- },
4191
- layout: {
4192
- padding: {
4193
- top: 12,
4194
- right: 12,
4195
- bottom: 8,
4196
- left: 12,
4197
- },
4198
- },
4199
- plugins: {
4200
- legend: {
4201
- display: true,
4202
- position: 'bottom',
4203
- align: 'center',
4204
- labels: {
4205
- color: theme.textColor,
4206
- usePointStyle: true,
4207
- pointStyle: 'circle',
4208
- boxWidth: 9,
4209
- boxHeight: 9,
4210
- padding: 18,
4211
- font: {
4212
- family: this.resolveFontFamily(),
4213
- size: 12,
4214
- weight: 500,
4215
- },
4216
- },
4217
- },
4218
- title: {
4219
- display: Boolean(this.chartConfig.medianTitle?.trim()),
4220
- text: this.chartConfig.medianTitle?.trim() || '',
4221
- align: 'start',
4222
- color: theme.textColor,
4223
- padding: {
4224
- top: 4,
4225
- bottom: 18,
4226
- },
4227
- font: {
4228
- family: this.resolveFontFamily(),
4229
- size: 16,
4230
- weight: 600,
4231
- },
4232
- },
4233
- tooltip: {
4234
- enabled: true,
4235
- backgroundColor: theme.tooltipBackgroundColor,
4236
- titleColor: theme.tooltipTextColor,
4237
- bodyColor: theme.tooltipTextColor,
4238
- footerColor: theme.secondaryTextColor,
4239
- borderColor: theme.tooltipBorderColor,
4240
- borderWidth: 1,
4241
- cornerRadius: 10,
4242
- caretSize: 7,
4243
- caretPadding: 8,
4244
- padding: 12,
4245
- boxPadding: 6,
4246
- usePointStyle: true,
4247
- displayColors: true,
4248
- titleFont: {
4249
- family: this.resolveFontFamily(),
4250
- size: 13,
4251
- weight: 600,
4252
- },
4253
- bodyFont: {
4254
- family: this.resolveFontFamily(),
4255
- size: 12,
4256
- weight: 400,
4257
- },
4258
- callbacks: {
4259
- label: (context) => {
4260
- return this.buildTooltipLabel(context, isCircularChart);
4261
- },
4262
- },
4263
- },
4264
- datalabels: {
4265
- display: isCircularChart,
4266
- color: theme.textColor,
4267
- anchor: isCircularChart ? 'center' : 'end',
4268
- align: isCircularChart ? 'center' : 'top',
4269
- clamp: true,
4270
- clip: false,
4271
- formatter: (value, context) => {
4272
- return this.formatDataLabel(value, context.chart, context.datasetIndex, isCircularChart);
4273
- },
4274
- font: {
4275
- family: this.resolveFontFamily(),
4276
- size: 11,
4277
- weight: 'bold',
4278
- },
4279
- textStrokeColor: theme.surfaceColor,
4280
- textStrokeWidth: isCircularChart ? 2 : 0,
4281
- },
4282
- },
4283
- };
4284
- if (isCartesianChart) {
4285
- options.scales = this.buildDefaultScales(theme);
4286
- }
4287
- return options;
4288
- }
4289
- buildDefaultScales(theme) {
4290
- const commonTickFont = {
4291
- family: this.resolveFontFamily(),
4292
- size: 11,
4293
- weight: 400,
4294
- };
4295
- return {
4296
- x: {
4297
- display: true,
4298
- beginAtZero: false,
4299
- border: {
4300
- display: false,
4301
- },
4302
- grid: {
4303
- display: false,
4304
- color: theme.gridColor,
4305
- drawTicks: false,
4306
- },
4307
- ticks: {
4308
- color: theme.secondaryTextColor,
4309
- padding: 10,
4310
- maxRotation: 0,
4311
- autoSkip: true,
4312
- font: commonTickFont,
4313
- },
4314
- title: {
4315
- display: Boolean(this.chartConfig.xAxisTitle?.trim()),
4316
- text: this.chartConfig.xAxisTitle?.trim() || '',
4317
- color: theme.textColor,
4318
- padding: {
4319
- top: 12,
4320
- },
4321
- font: {
4322
- family: this.resolveFontFamily(),
4323
- size: 12,
4324
- weight: 600,
4325
- },
4326
- },
4327
- },
4328
- y: {
4329
- display: true,
4330
- beginAtZero: this.chartConfig.scales?.y?.ticks?.beginAtZero ?? true,
4331
- min: this.chartConfig.scales?.y?.min,
4332
- max: this.chartConfig.scales?.y?.max,
4333
- border: {
4334
- display: false,
4335
- },
4336
- grid: {
4337
- display: true,
4338
- color: theme.gridColor,
4339
- drawTicks: false,
4340
- lineWidth: 1,
4341
- },
4342
- ticks: {
4343
- color: theme.secondaryTextColor,
4344
- padding: 10,
4345
- stepSize: this.chartConfig.scales?.y?.ticks?.stepSize,
4346
- font: commonTickFont,
4347
- },
4348
- title: {
4349
- display: Boolean(this.chartConfig.yAxisTitle?.trim()),
4350
- text: this.chartConfig.yAxisTitle?.trim() || '',
4351
- color: theme.textColor,
4352
- padding: {
4353
- bottom: 12,
4354
- },
4355
- font: {
4356
- family: this.resolveFontFamily(),
4357
- size: 12,
4358
- weight: 600,
4359
- },
4360
- },
4361
- },
4362
- };
4398
+ return createDefaultChartOptions(chartType, theme, {
4399
+ medianTitle: this.chartConfig.medianTitle,
4400
+ xAxisTitle: this.chartConfig.xAxisTitle,
4401
+ yAxisTitle: this.chartConfig.yAxisTitle,
4402
+ yAxisBeginAtZero: this.chartConfig.scales?.y?.ticks?.beginAtZero,
4403
+ yAxisMin: this.chartConfig.scales?.y?.min,
4404
+ yAxisMax: this.chartConfig.scales?.y?.max,
4405
+ yAxisStepSize: this.chartConfig.scales?.y?.ticks?.stepSize,
4406
+ fontFamily: this.resolveFontFamily(),
4407
+ tooltipLabel: (context, includePercentage) => this.buildTooltipLabel(context, includePercentage),
4408
+ dataLabel: (value, context, isCircularChart) => this.formatDataLabel(value, context.chart, context.datasetIndex, isCircularChart),
4409
+ });
4363
4410
  }
4364
4411
  mergeChartOptions(defaultOptions, consumerOptions, chartType) {
4365
4412
  const defaultPlugins = defaultOptions.plugins;
@@ -4395,10 +4442,6 @@ class PTChartComponent {
4395
4442
  labels: {
4396
4443
  ...defaultPlugins?.legend?.labels,
4397
4444
  ...consumerPlugins?.legend?.labels,
4398
- /*
4399
- * Chart.js font options may be scriptable callbacks.
4400
- * Keep the complete consumer value rather than spreading it.
4401
- */
4402
4445
  font: consumerPlugins?.legend?.labels?.font ??
4403
4446
  defaultPlugins?.legend?.labels?.font,
4404
4447
  },
@@ -4428,7 +4471,7 @@ class PTChartComponent {
4428
4471
  },
4429
4472
  },
4430
4473
  };
4431
- if (this.isCartesianChart(chartType)) {
4474
+ if (isCartesianChartType(chartType)) {
4432
4475
  mergedOptions.scales = this.mergeScales(defaultOptions.scales, consumerOptions.scales);
4433
4476
  }
4434
4477
  else if (consumerOptions.scales) {
@@ -4552,14 +4595,34 @@ class PTChartComponent {
4552
4595
  if (typeof ResizeObserver === 'undefined') {
4553
4596
  return;
4554
4597
  }
4555
- const container = this.canvasRef.nativeElement.parentElement;
4556
- if (!container) {
4598
+ const canvas = this.canvasRef.nativeElement;
4599
+ const chartContainer = canvas.closest('.pt-chart');
4600
+ const canvasContainer = canvas.parentElement;
4601
+ const hostElement = chartContainer?.parentElement;
4602
+ this.resizeObserver = new ResizeObserver(() => {
4603
+ this.scheduleChartResize();
4604
+ });
4605
+ if (chartContainer) {
4606
+ this.resizeObserver.observe(chartContainer);
4607
+ }
4608
+ if (canvasContainer) {
4609
+ this.resizeObserver.observe(canvasContainer);
4610
+ }
4611
+ if (hostElement) {
4612
+ this.resizeObserver.observe(hostElement);
4613
+ }
4614
+ }
4615
+ scheduleChartResize() {
4616
+ if (!this.chart) {
4557
4617
  return;
4558
4618
  }
4559
- this.resizeObserver = new ResizeObserver(() => {
4560
- this.chart?.resize();
4619
+ requestAnimationFrame(() => {
4620
+ if (!this.chart) {
4621
+ return;
4622
+ }
4623
+ this.chart.resize();
4624
+ this.chart.update('none');
4561
4625
  });
4562
- this.resizeObserver.observe(container);
4563
4626
  }
4564
4627
  observeThemeChanges() {
4565
4628
  const documentElement = this.document.documentElement;
@@ -4592,6 +4655,7 @@ class PTChartComponent {
4592
4655
  this.chart.options = configuration.options;
4593
4656
  }
4594
4657
  this.chart.update('none');
4658
+ this.scheduleChartResize();
4595
4659
  }
4596
4660
  resolveTheme() {
4597
4661
  const rootStyles = getComputedStyle(this.document.documentElement);
@@ -4664,28 +4728,17 @@ class PTChartComponent {
4664
4728
  ? value
4665
4729
  : {};
4666
4730
  }
4667
- isCircularChart(chartType) {
4668
- return (chartType === 'pie' ||
4669
- chartType === 'doughnut' ||
4670
- chartType === 'polarArea');
4671
- }
4672
- isCartesianChart(chartType) {
4673
- return (chartType === 'bar' ||
4674
- chartType === 'line' ||
4675
- chartType === 'scatter' ||
4676
- chartType === 'bubble');
4677
- }
4678
4731
  destroyChart() {
4679
4732
  this.chart?.destroy();
4680
4733
  this.chart = undefined;
4681
4734
  this.currentChartType = undefined;
4682
4735
  }
4683
4736
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PTChartComponent, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Component }); }
4684
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.14", type: PTChartComponent, isStandalone: false, selector: "pt-chart", inputs: { chartConfig: "chartConfig" }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["chartCanvas"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div\n class=\"pt-chart\"\n [ngStyle]=\"chartContainerStyle\"\n role=\"img\"\n [attr.aria-label]=\"chartAriaLabel\"\n>\n <div class=\"pt-chart__canvas-container\">\n <canvas #chartCanvas></canvas>\n </div>\n</div>\n", styles: [":host{display:block;width:100%;min-width:0;height:100%;min-height:0}.pt-chart{position:relative;display:block;box-sizing:border-box;min-width:0;min-height:18rem;overflow:hidden;color:var(--p-text-color, var(--text-color, #0f172a));background:linear-gradient(145deg,color-mix(in srgb,var(--p-content-background, var(--surface-card, #ffffff)) 97%,var(--p-primary-color, #3b82f6) 3%),var(--p-content-background, var(--surface-card, #ffffff)));border:1px solid var(--p-content-border-color, var(--surface-border, rgba(15, 23, 42, .1)));border-radius:var(--p-content-border-radius, .875rem);box-shadow:0 1px 2px #0f172a0a,0 8px 24px #0f172a0d;transition:background-color .18s ease,border-color .18s ease,box-shadow .18s ease}.pt-chart:before{position:absolute;top:0;right:12%;left:12%;z-index:0;height:1px;pointer-events:none;content:\"\";background:linear-gradient(90deg,transparent,color-mix(in srgb,var(--p-primary-color, #3b82f6) 45%,transparent),transparent)}.pt-chart__canvas-container{position:relative;z-index:1;width:100%;height:100%;min-width:0;min-height:inherit;padding:clamp(.75rem,1.5vw,1.25rem);box-sizing:border-box}.pt-chart canvas{display:block;width:100%!important;max-width:100%;height:100%!important;max-height:100%;outline:none}.pt-chart:focus-within{border-color:var(--p-primary-color, #3b82f6);box-shadow:0 0 0 3px color-mix(in srgb,var(--p-primary-color, #3b82f6) 18%,transparent),0 10px 30px #0f172a14}:host-context(.p-dark) .pt-chart,:host-context(.dark) .pt-chart,:host-context(.dark-mode) .pt-chart,:host-context([data-theme=\"dark\"]) .pt-chart{background:linear-gradient(145deg,color-mix(in srgb,var(--p-content-background, var(--surface-card, #0f172a)) 96%,var(--p-primary-color, #60a5fa) 4%),var(--p-content-background, var(--surface-card, #0f172a)));border-color:var( --p-content-border-color, var(--surface-border, rgba(148, 163, 184, .2)) );box-shadow:0 1px 2px #0000002e,0 12px 32px #00000038}@media(prefers-color-scheme:dark){.pt-chart{box-shadow:0 1px 2px #0000002e,0 12px 32px #0000002e}}@media(max-width:768px){.pt-chart{min-height:16rem;border-radius:.75rem}.pt-chart__canvas-container{padding:.75rem .625rem}}@media(max-width:480px){.pt-chart{min-height:15rem}.pt-chart__canvas-container{padding:.625rem .375rem}}@media(prefers-reduced-motion:reduce){.pt-chart{transition:none}}@media print{.pt-chart{overflow:visible;background:#fff;border:1px solid #d1d5db;box-shadow:none}}\n"], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
4737
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.14", type: PTChartComponent, isStandalone: false, selector: "pt-chart", inputs: { chartConfig: "chartConfig" }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["chartCanvas"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div\n class=\"pt-chart\"\n [ngStyle]=\"chartContainerStyle\"\n role=\"img\"\n [attr.aria-label]=\"chartAriaLabel\"\n>\n <div class=\"pt-chart__canvas-container\">\n <canvas #chartCanvas></canvas>\n </div>\n</div>\n", styles: [":host{display:block;width:100%;height:100%;min-width:0;min-height:0}.pt-chart{position:relative;display:block;width:100%;height:100%;min-width:0;min-height:0;box-sizing:border-box;overflow:hidden;color:var(--p-text-color, var(--text-color, #0f172a));background:linear-gradient(145deg,color-mix(in srgb,var(--p-content-background, var(--surface-card, #ffffff)) 97%,var(--p-primary-color, #3b82f6) 3%),var(--p-content-background, var(--surface-card, #ffffff)));border:1px solid var(--p-content-border-color, var(--surface-border, rgba(15, 23, 42, .1)));border-radius:var(--p-content-border-radius, .875rem);box-shadow:0 1px 2px #0f172a0a,0 8px 24px #0f172a0d;transition:background-color .18s ease,border-color .18s ease,box-shadow .18s ease}.pt-chart:before{position:absolute;top:0;right:12%;left:12%;z-index:0;height:1px;pointer-events:none;content:\"\";background:linear-gradient(90deg,transparent,color-mix(in srgb,var(--p-primary-color, #3b82f6) 45%,transparent),transparent)}.pt-chart__canvas-container{position:relative;z-index:1;width:100%;height:100%;min-width:0;min-height:0;padding:clamp(.75rem,1.5vw,1.25rem);box-sizing:border-box}.pt-chart canvas{display:block;width:100%!important;height:100%!important;max-width:none;max-height:none;outline:none}.pt-chart:focus-within{border-color:var(--p-primary-color, #3b82f6);box-shadow:0 0 0 3px color-mix(in srgb,var(--p-primary-color, #3b82f6) 18%,transparent),0 10px 30px #0f172a14}:host-context(.p-dark) .pt-chart,:host-context(.dark) .pt-chart,:host-context(.dark-mode) .pt-chart,:host-context([data-theme=\"dark\"]) .pt-chart{background:linear-gradient(145deg,color-mix(in srgb,var(--p-content-background, var(--surface-card, #0f172a)) 96%,var(--p-primary-color, #60a5fa) 4%),var(--p-content-background, var(--surface-card, #0f172a)));border-color:var( --p-content-border-color, var(--surface-border, rgba(148, 163, 184, .2)) );box-shadow:0 1px 2px #0000002e,0 12px 32px #00000038}@media(max-width:768px){.pt-chart{border-radius:.75rem}.pt-chart__canvas-container{padding:.75rem .625rem}}@media(max-width:480px){.pt-chart__canvas-container{padding:.625rem .375rem}}@media(prefers-reduced-motion:reduce){.pt-chart{transition:none}}@media print{.pt-chart{overflow:visible;background:#fff;border:1px solid #d1d5db;box-shadow:none}}\n"], dependencies: [{ kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] }); }
4685
4738
  }
4686
4739
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PTChartComponent, decorators: [{
4687
4740
  type: Component,
4688
- args: [{ selector: 'pt-chart', standalone: false, template: "<div\n class=\"pt-chart\"\n [ngStyle]=\"chartContainerStyle\"\n role=\"img\"\n [attr.aria-label]=\"chartAriaLabel\"\n>\n <div class=\"pt-chart__canvas-container\">\n <canvas #chartCanvas></canvas>\n </div>\n</div>\n", styles: [":host{display:block;width:100%;min-width:0;height:100%;min-height:0}.pt-chart{position:relative;display:block;box-sizing:border-box;min-width:0;min-height:18rem;overflow:hidden;color:var(--p-text-color, var(--text-color, #0f172a));background:linear-gradient(145deg,color-mix(in srgb,var(--p-content-background, var(--surface-card, #ffffff)) 97%,var(--p-primary-color, #3b82f6) 3%),var(--p-content-background, var(--surface-card, #ffffff)));border:1px solid var(--p-content-border-color, var(--surface-border, rgba(15, 23, 42, .1)));border-radius:var(--p-content-border-radius, .875rem);box-shadow:0 1px 2px #0f172a0a,0 8px 24px #0f172a0d;transition:background-color .18s ease,border-color .18s ease,box-shadow .18s ease}.pt-chart:before{position:absolute;top:0;right:12%;left:12%;z-index:0;height:1px;pointer-events:none;content:\"\";background:linear-gradient(90deg,transparent,color-mix(in srgb,var(--p-primary-color, #3b82f6) 45%,transparent),transparent)}.pt-chart__canvas-container{position:relative;z-index:1;width:100%;height:100%;min-width:0;min-height:inherit;padding:clamp(.75rem,1.5vw,1.25rem);box-sizing:border-box}.pt-chart canvas{display:block;width:100%!important;max-width:100%;height:100%!important;max-height:100%;outline:none}.pt-chart:focus-within{border-color:var(--p-primary-color, #3b82f6);box-shadow:0 0 0 3px color-mix(in srgb,var(--p-primary-color, #3b82f6) 18%,transparent),0 10px 30px #0f172a14}:host-context(.p-dark) .pt-chart,:host-context(.dark) .pt-chart,:host-context(.dark-mode) .pt-chart,:host-context([data-theme=\"dark\"]) .pt-chart{background:linear-gradient(145deg,color-mix(in srgb,var(--p-content-background, var(--surface-card, #0f172a)) 96%,var(--p-primary-color, #60a5fa) 4%),var(--p-content-background, var(--surface-card, #0f172a)));border-color:var( --p-content-border-color, var(--surface-border, rgba(148, 163, 184, .2)) );box-shadow:0 1px 2px #0000002e,0 12px 32px #00000038}@media(prefers-color-scheme:dark){.pt-chart{box-shadow:0 1px 2px #0000002e,0 12px 32px #0000002e}}@media(max-width:768px){.pt-chart{min-height:16rem;border-radius:.75rem}.pt-chart__canvas-container{padding:.75rem .625rem}}@media(max-width:480px){.pt-chart{min-height:15rem}.pt-chart__canvas-container{padding:.625rem .375rem}}@media(prefers-reduced-motion:reduce){.pt-chart{transition:none}}@media print{.pt-chart{overflow:visible;background:#fff;border:1px solid #d1d5db;box-shadow:none}}\n"] }]
4741
+ args: [{ selector: 'pt-chart', standalone: false, template: "<div\n class=\"pt-chart\"\n [ngStyle]=\"chartContainerStyle\"\n role=\"img\"\n [attr.aria-label]=\"chartAriaLabel\"\n>\n <div class=\"pt-chart__canvas-container\">\n <canvas #chartCanvas></canvas>\n </div>\n</div>\n", styles: [":host{display:block;width:100%;height:100%;min-width:0;min-height:0}.pt-chart{position:relative;display:block;width:100%;height:100%;min-width:0;min-height:0;box-sizing:border-box;overflow:hidden;color:var(--p-text-color, var(--text-color, #0f172a));background:linear-gradient(145deg,color-mix(in srgb,var(--p-content-background, var(--surface-card, #ffffff)) 97%,var(--p-primary-color, #3b82f6) 3%),var(--p-content-background, var(--surface-card, #ffffff)));border:1px solid var(--p-content-border-color, var(--surface-border, rgba(15, 23, 42, .1)));border-radius:var(--p-content-border-radius, .875rem);box-shadow:0 1px 2px #0f172a0a,0 8px 24px #0f172a0d;transition:background-color .18s ease,border-color .18s ease,box-shadow .18s ease}.pt-chart:before{position:absolute;top:0;right:12%;left:12%;z-index:0;height:1px;pointer-events:none;content:\"\";background:linear-gradient(90deg,transparent,color-mix(in srgb,var(--p-primary-color, #3b82f6) 45%,transparent),transparent)}.pt-chart__canvas-container{position:relative;z-index:1;width:100%;height:100%;min-width:0;min-height:0;padding:clamp(.75rem,1.5vw,1.25rem);box-sizing:border-box}.pt-chart canvas{display:block;width:100%!important;height:100%!important;max-width:none;max-height:none;outline:none}.pt-chart:focus-within{border-color:var(--p-primary-color, #3b82f6);box-shadow:0 0 0 3px color-mix(in srgb,var(--p-primary-color, #3b82f6) 18%,transparent),0 10px 30px #0f172a14}:host-context(.p-dark) .pt-chart,:host-context(.dark) .pt-chart,:host-context(.dark-mode) .pt-chart,:host-context([data-theme=\"dark\"]) .pt-chart{background:linear-gradient(145deg,color-mix(in srgb,var(--p-content-background, var(--surface-card, #0f172a)) 96%,var(--p-primary-color, #60a5fa) 4%),var(--p-content-background, var(--surface-card, #0f172a)));border-color:var( --p-content-border-color, var(--surface-border, rgba(148, 163, 184, .2)) );box-shadow:0 1px 2px #0000002e,0 12px 32px #00000038}@media(max-width:768px){.pt-chart{border-radius:.75rem}.pt-chart__canvas-container{padding:.75rem .625rem}}@media(max-width:480px){.pt-chart__canvas-container{padding:.625rem .375rem}}@media(prefers-reduced-motion:reduce){.pt-chart{transition:none}}@media print{.pt-chart{overflow:visible;background:#fff;border:1px solid #d1d5db;box-shadow:none}}\n"] }]
4689
4742
  }], ctorParameters: () => [{ type: Document, decorators: [{
4690
4743
  type: Inject,
4691
4744
  args: [DOCUMENT]
@@ -7671,46 +7724,109 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
7671
7724
  }]
7672
7725
  }] });
7673
7726
 
7727
+ const PT_CHART_COMPARISON_DEFAULT_WIDTH = '100%';
7728
+ const PT_CHART_COMPARISON_DEFAULT_HEIGHT = '100%';
7729
+ const PT_CHART_COMPARISON_DEFAULT_MEDIAN_TITLE = 'Médiane';
7730
+ const PT_CHART_COMPARISON_DEFAULT_X_AXIS_TITLE = 'Time';
7731
+ const PT_CHART_COMPARISON_DEFAULT_Y_AXIS_TITLE = 'Value';
7732
+ const PT_CHART_COMPARISON_DEFAULT_RESIZE_DELAY = 100;
7733
+ const PT_CHART_COMPARISON_MEDIAN_DATASET = {
7734
+ borderColor: '#0000ff',
7735
+ borderWidth: 3,
7736
+ backgroundColor: 'transparent',
7737
+ pointRadius: 0,
7738
+ pointHoverRadius: 0,
7739
+ fill: false,
7740
+ tension: 0.1,
7741
+ borderDash: [],
7742
+ };
7743
+ const PT_CHART_COMPARISON_DEFAULT_TOOLTIP = {
7744
+ mode: 'index',
7745
+ intersect: false,
7746
+ position: 'nearest',
7747
+ };
7748
+ const PT_CHART_COMPARISON_DEFAULT_X_TICK_FONT_SIZE = 12;
7749
+ const PT_CHART_COMPARISON_DEFAULT_Y_TICK_FONT = {
7750
+ size: 16,
7751
+ weight: 'bold',
7752
+ };
7753
+ const PT_CHART_COMPARISON_DEFAULT_Y_TICK_COLOR = '#333333';
7754
+ const PT_CHART_COMPARISON_DEFAULT_Y_GRID_COLOR = 'rgba(0, 0, 0, 0.10)';
7755
+ const PT_CHART_COMPARISON_DEFAULT_Y_BORDER_COLOR = '#000000';
7756
+ const createComparisonChartBaseOptions = () => ({
7757
+ responsive: true,
7758
+ maintainAspectRatio: false,
7759
+ resizeDelay: PT_CHART_COMPARISON_DEFAULT_RESIZE_DELAY,
7760
+ });
7761
+
7674
7762
  class PTChartComparisonComponent {
7675
7763
  constructor() {
7676
- this.medianTitle = 'Médiane';
7677
- this.xAxisTitle = 'Time';
7678
- this.yAxisTitle = 'Value';
7679
- this.chartHeight = '400px';
7680
- this.chartWidth = '1200px';
7764
+ this.medianTitle = PT_CHART_COMPARISON_DEFAULT_MEDIAN_TITLE;
7765
+ this.xAxisTitle = PT_CHART_COMPARISON_DEFAULT_X_AXIS_TITLE;
7766
+ this.yAxisTitle = PT_CHART_COMPARISON_DEFAULT_Y_AXIS_TITLE;
7767
+ this.viewInitialized = false;
7681
7768
  Chart.register(...registerables, ChartDataLabels);
7682
7769
  }
7683
- ngOnInit() {
7770
+ ngAfterViewInit() {
7771
+ this.viewInitialized = true;
7684
7772
  this.initializeChart();
7773
+ this.observeResize();
7774
+ this.scheduleResize();
7775
+ }
7776
+ ngOnChanges(changes) {
7777
+ if (!this.viewInitialized) {
7778
+ return;
7779
+ }
7780
+ if (changes['chartConfig'] ||
7781
+ changes['chartHeight'] ||
7782
+ changes['chartWidth'] ||
7783
+ changes['medianTitle'] ||
7784
+ changes['xAxisTitle'] ||
7785
+ changes['yAxisTitle'] ||
7786
+ changes['yMin'] ||
7787
+ changes['yMax'] ||
7788
+ changes['yStepSize']) {
7789
+ this.initializeChart();
7790
+ }
7685
7791
  }
7686
7792
  ngOnDestroy() {
7793
+ this.resizeObserver?.disconnect();
7687
7794
  this.destroyChart();
7688
7795
  }
7796
+ get resolvedChartWidth() {
7797
+ return (this.chartConfig?.chartWidth?.trim() ||
7798
+ this.chartWidth?.trim() ||
7799
+ PT_CHART_COMPARISON_DEFAULT_WIDTH);
7800
+ }
7801
+ get resolvedChartHeight() {
7802
+ return (this.chartConfig?.chartHeight?.trim() ||
7803
+ this.chartHeight?.trim() ||
7804
+ PT_CHART_COMPARISON_DEFAULT_HEIGHT);
7805
+ }
7689
7806
  initializeChart() {
7807
+ if (!this.chartConfig || !this.canvasRef) {
7808
+ return;
7809
+ }
7690
7810
  const canvas = this.canvasRef.nativeElement;
7691
7811
  this.destroyChart();
7692
- const config = {
7812
+ const configuration = {
7693
7813
  type: this.chartConfig.type || 'line',
7694
7814
  data: this.getFormattedChartData(),
7695
7815
  options: this.getChartOptions(),
7696
7816
  };
7697
- this.chart = new Chart(canvas, config);
7817
+ this.chart = new Chart(canvas, configuration);
7818
+ this.scheduleResize();
7698
7819
  }
7699
7820
  getFormattedChartData() {
7700
- const medianValues = this.calculateMedian();
7701
7821
  return {
7702
7822
  labels: this.chartConfig.data.labels,
7703
7823
  datasets: [
7704
7824
  {
7705
- label: this.chartConfig.medianTitle || this.medianTitle || 'Médiane',
7706
- data: medianValues,
7707
- borderColor: '#0000FF',
7708
- borderWidth: 3,
7709
- backgroundColor: 'transparent',
7710
- pointRadius: 0,
7711
- fill: false,
7712
- tension: 0.1,
7713
- borderDash: [], // ✅ médiane continue
7825
+ label: this.chartConfig.medianTitle?.trim() ||
7826
+ this.medianTitle ||
7827
+ PT_CHART_COMPARISON_DEFAULT_MEDIAN_TITLE,
7828
+ data: this.calculateMedian(),
7829
+ ...PT_CHART_COMPARISON_MEDIAN_DATASET,
7714
7830
  },
7715
7831
  ...this.chartConfig.data.datasets,
7716
7832
  ],
@@ -7718,75 +7834,134 @@ class PTChartComparisonComponent {
7718
7834
  }
7719
7835
  calculateMedian() {
7720
7836
  const datasets = this.chartConfig.data.datasets;
7721
- return this.chartConfig.data.labels.map((_, index) => {
7837
+ const labels = this.chartConfig.data.labels ?? [];
7838
+ return labels.map((_, index) => {
7722
7839
  const valuesAtTime = datasets
7723
7840
  .map((dataset) => dataset.data[index])
7724
- .filter((val) => typeof val === 'number' && !Number.isNaN(val));
7725
- if (valuesAtTime.length === 0)
7841
+ .filter((value) => typeof value === 'number' && Number.isFinite(value))
7842
+ .sort((left, right) => left - right);
7843
+ if (!valuesAtTime.length) {
7726
7844
  return 0;
7727
- valuesAtTime.sort((a, b) => a - b);
7728
- const middle = Math.floor(valuesAtTime.length / 2);
7729
- return valuesAtTime.length % 2 === 0
7730
- ? (valuesAtTime[middle - 1] + valuesAtTime[middle]) / 2
7731
- : valuesAtTime[middle];
7845
+ }
7846
+ const middleIndex = Math.floor(valuesAtTime.length / 2);
7847
+ if (valuesAtTime.length % 2 !== 0) {
7848
+ return valuesAtTime[middleIndex];
7849
+ }
7850
+ return (valuesAtTime[middleIndex - 1] + valuesAtTime[middleIndex]) / 2;
7732
7851
  });
7733
7852
  }
7734
7853
  getChartOptions() {
7735
7854
  const externalOptions = this.chartConfig.options ?? {};
7855
+ const externalPlugins = externalOptions.plugins ?? {};
7856
+ const externalScales = externalOptions.scales;
7857
+ const configuredYMin = this.chartConfig.scales?.y?.min ?? this.yMin;
7858
+ const configuredYMax = this.chartConfig.scales?.y?.max ?? this.yMax;
7859
+ const configuredYStepSize = this.chartConfig.scales?.y?.ticks?.stepSize ?? this.yStepSize;
7736
7860
  return {
7861
+ ...createComparisonChartBaseOptions(),
7862
+ ...externalOptions,
7737
7863
  responsive: true,
7738
7864
  maintainAspectRatio: false,
7739
7865
  plugins: {
7740
- legend: { display: true, position: 'top' },
7741
- tooltip: { mode: 'index', intersect: false },
7866
+ ...externalPlugins,
7867
+ legend: {
7868
+ display: true,
7869
+ position: 'top',
7870
+ ...(externalPlugins.legend ?? {}),
7871
+ },
7872
+ tooltip: {
7873
+ ...PT_CHART_COMPARISON_DEFAULT_TOOLTIP,
7874
+ ...(externalPlugins.tooltip ?? {}),
7875
+ },
7742
7876
  datalabels: {
7743
- display: false, // ✅ supprime les nombres au-dessus des lignes
7877
+ display: false,
7878
+ ...(externalPlugins.datalabels ?? {}),
7744
7879
  },
7745
- ...(externalOptions.plugins ?? {}),
7746
7880
  },
7747
7881
  scales: {
7748
7882
  x: {
7749
- title: { display: true, text: this.chartConfig.xAxisTitle || 'Time' },
7750
- ticks: { font: { size: 12 } },
7751
- ...externalOptions.scales?.x,
7883
+ title: {
7884
+ display: true,
7885
+ text: this.chartConfig.xAxisTitle?.trim() ||
7886
+ this.xAxisTitle ||
7887
+ PT_CHART_COMPARISON_DEFAULT_X_AXIS_TITLE,
7888
+ },
7889
+ ticks: {
7890
+ font: {
7891
+ size: PT_CHART_COMPARISON_DEFAULT_X_TICK_FONT_SIZE,
7892
+ },
7893
+ },
7894
+ ...(externalScales?.['x'] ?? {}),
7752
7895
  },
7753
7896
  y: {
7754
7897
  title: {
7755
7898
  display: true,
7756
- text: this.chartConfig.yAxisTitle || 'Value',
7899
+ text: this.chartConfig.yAxisTitle?.trim() ||
7900
+ this.yAxisTitle ||
7901
+ PT_CHART_COMPARISON_DEFAULT_Y_AXIS_TITLE,
7757
7902
  },
7758
- min: this.chartConfig.scales?.y?.min,
7759
- max: this.chartConfig.scales?.y?.max,
7903
+ min: configuredYMin,
7904
+ max: configuredYMax,
7760
7905
  ticks: {
7761
- stepSize: this.chartConfig.scales?.y?.ticks?.stepSize,
7762
- font: { size: 16, weight: 'bold' },
7763
- color: '#333',
7906
+ stepSize: configuredYStepSize,
7907
+ font: PT_CHART_COMPARISON_DEFAULT_Y_TICK_FONT,
7908
+ color: PT_CHART_COMPARISON_DEFAULT_Y_TICK_COLOR,
7764
7909
  },
7765
7910
  grid: {
7766
- color: 'rgba(0,0,0,0.1)',
7911
+ color: PT_CHART_COMPARISON_DEFAULT_Y_GRID_COLOR,
7767
7912
  },
7768
7913
  border: {
7769
7914
  display: true,
7770
- color: '#000',
7915
+ color: PT_CHART_COMPARISON_DEFAULT_Y_BORDER_COLOR,
7771
7916
  },
7772
- ...externalOptions.scales?.y,
7917
+ ...(externalScales?.['y'] ?? {}),
7773
7918
  },
7774
7919
  },
7775
- ...externalOptions,
7776
7920
  };
7777
7921
  }
7778
- destroyChart() {
7779
- if (this.chart) {
7780
- this.chart.destroy();
7781
- this.chart = undefined;
7922
+ observeResize() {
7923
+ if (typeof ResizeObserver === 'undefined') {
7924
+ return;
7925
+ }
7926
+ const canvas = this.canvasRef.nativeElement;
7927
+ const chartInner = canvas.parentElement;
7928
+ const chartScrollContainer = chartInner?.parentElement;
7929
+ const hostElement = chartScrollContainer?.parentElement;
7930
+ this.resizeObserver = new ResizeObserver(() => {
7931
+ this.scheduleResize();
7932
+ });
7933
+ if (chartInner) {
7934
+ this.resizeObserver.observe(chartInner);
7935
+ }
7936
+ if (chartScrollContainer) {
7937
+ this.resizeObserver.observe(chartScrollContainer);
7938
+ }
7939
+ if (hostElement) {
7940
+ this.resizeObserver.observe(hostElement);
7941
+ }
7942
+ }
7943
+ scheduleResize() {
7944
+ if (!this.chart) {
7945
+ return;
7782
7946
  }
7947
+ requestAnimationFrame(() => {
7948
+ if (!this.chart) {
7949
+ return;
7950
+ }
7951
+ this.chart.resize();
7952
+ this.chart.update('none');
7953
+ });
7954
+ }
7955
+ destroyChart() {
7956
+ this.chart?.destroy();
7957
+ this.chart = undefined;
7783
7958
  }
7784
7959
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PTChartComparisonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
7785
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.14", type: PTChartComparisonComponent, isStandalone: false, selector: "pt-chart-comparison", inputs: { chartConfig: "chartConfig", medianTitle: "medianTitle", xAxisTitle: "xAxisTitle", yAxisTitle: "yAxisTitle", yMin: "yMin", yMax: "yMax", yStepSize: "yStepSize", chartHeight: "chartHeight", chartWidth: "chartWidth" }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["chartCanvas"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"chart-scroll-container\">\n <div\n class=\"chart-inner\"\n [style.width]=\"chartConfig.chartWidth || '1200px'\"\n [style.height]=\"chartConfig.chartHeight || '400px'\"\n >\n <canvas #chartCanvas></canvas>\n </div>\n</div>\n", styles: [".chart-scroll-container{width:100%;overflow-x:auto;white-space:nowrap;padding-bottom:10px}.chart-inner{display:inline-block}\n"] }); }
7960
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.14", type: PTChartComparisonComponent, isStandalone: false, selector: "pt-chart-comparison", inputs: { chartConfig: "chartConfig", medianTitle: "medianTitle", xAxisTitle: "xAxisTitle", yAxisTitle: "yAxisTitle", yMin: "yMin", yMax: "yMax", yStepSize: "yStepSize", chartHeight: "chartHeight", chartWidth: "chartWidth" }, viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["chartCanvas"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"chart-scroll-container\">\n <div\n class=\"chart-inner\"\n [style.width]=\"resolvedChartWidth\"\n [style.height]=\"resolvedChartHeight\"\n >\n <canvas #chartCanvas></canvas>\n </div>\n</div>\n", styles: [":host{display:block;width:100%;height:100%;min-width:0;min-height:0}.chart-scroll-container{width:100%;height:100%;min-width:0;min-height:0;overflow-x:auto;overflow-y:hidden;box-sizing:border-box;padding-bottom:.625rem}.chart-inner{display:block;min-width:0;min-height:0;box-sizing:border-box}.chart-inner canvas{display:block;width:100%!important;height:100%!important;max-width:none;max-height:none}\n"] }); }
7786
7961
  }
7787
7962
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: PTChartComparisonComponent, decorators: [{
7788
7963
  type: Component,
7789
- args: [{ selector: 'pt-chart-comparison', standalone: false, template: "<div class=\"chart-scroll-container\">\n <div\n class=\"chart-inner\"\n [style.width]=\"chartConfig.chartWidth || '1200px'\"\n [style.height]=\"chartConfig.chartHeight || '400px'\"\n >\n <canvas #chartCanvas></canvas>\n </div>\n</div>\n", styles: [".chart-scroll-container{width:100%;overflow-x:auto;white-space:nowrap;padding-bottom:10px}.chart-inner{display:inline-block}\n"] }]
7964
+ args: [{ selector: 'pt-chart-comparison', standalone: false, template: "<div class=\"chart-scroll-container\">\n <div\n class=\"chart-inner\"\n [style.width]=\"resolvedChartWidth\"\n [style.height]=\"resolvedChartHeight\"\n >\n <canvas #chartCanvas></canvas>\n </div>\n</div>\n", styles: [":host{display:block;width:100%;height:100%;min-width:0;min-height:0}.chart-scroll-container{width:100%;height:100%;min-width:0;min-height:0;overflow-x:auto;overflow-y:hidden;box-sizing:border-box;padding-bottom:.625rem}.chart-inner{display:block;min-width:0;min-height:0;box-sizing:border-box}.chart-inner canvas{display:block;width:100%!important;height:100%!important;max-width:none;max-height:none}\n"] }]
7790
7965
  }], ctorParameters: () => [], propDecorators: { chartConfig: [{
7791
7966
  type: Input
7792
7967
  }], medianTitle: [{