@swimlane/ngx-charts 20.2.2-beta.2 → 20.2.2-beta.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.
- package/esm2020/lib/common/axes/ticks.helper.mjs +1 -13
- package/esm2020/lib/common/axes/x-axis-ticks.component.mjs +9 -10
- package/fesm2015/swimlane-ngx-charts.mjs +8 -21
- package/fesm2015/swimlane-ngx-charts.mjs.map +1 -1
- package/fesm2020/swimlane-ngx-charts.mjs +8 -21
- package/fesm2020/swimlane-ngx-charts.mjs.map +1 -1
- package/lib/common/axes/ticks.helper.d.ts +0 -1
- package/package.json +1 -1
|
@@ -1422,18 +1422,6 @@ function getTickLines(label, maxLength, maxLines) {
|
|
|
1422
1422
|
}
|
|
1423
1423
|
return totalLines;
|
|
1424
1424
|
}
|
|
1425
|
-
function calculateMaxPossibleWidth(label, maxWidth) {
|
|
1426
|
-
let maxLength = label.length;
|
|
1427
|
-
const canvas = document.createElement('canvas');
|
|
1428
|
-
const context = canvas.getContext('2d');
|
|
1429
|
-
maxLength = label.length;
|
|
1430
|
-
let truncatedString = label;
|
|
1431
|
-
while (context.measureText(truncatedString).width > maxWidth && truncatedString.length > 0) {
|
|
1432
|
-
maxLength--;
|
|
1433
|
-
truncatedString = label.slice(0, maxLength);
|
|
1434
|
-
}
|
|
1435
|
-
return maxLength;
|
|
1436
|
-
}
|
|
1437
1425
|
|
|
1438
1426
|
var TextAnchor;
|
|
1439
1427
|
(function (TextAnchor) {
|
|
@@ -1580,13 +1568,12 @@ class XAxisTicksComponent {
|
|
|
1580
1568
|
return this.trimTicks ? trimLabel(label, this.maxTickLength) : label;
|
|
1581
1569
|
}
|
|
1582
1570
|
getMaxPossibleLengthForTick(ticks) {
|
|
1583
|
-
if (this.scale.
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
preferredWidth = 300;
|
|
1587
|
-
}
|
|
1571
|
+
if (this.scale.bandwidth) {
|
|
1572
|
+
const averageCharacterWidth = 7; // approximate char width
|
|
1573
|
+
const maxCharacters = Math.floor(this.scale.bandwidth() / averageCharacterWidth);
|
|
1588
1574
|
const label = ticks.reduce((savedText, text) => (text.length > savedText.length ? text : savedText), '');
|
|
1589
|
-
|
|
1575
|
+
const truncatedText = label.slice(0, maxCharacters);
|
|
1576
|
+
return Math.max(truncatedText.length, this.maxTickLength);
|
|
1590
1577
|
}
|
|
1591
1578
|
return this.maxTickLength;
|
|
1592
1579
|
}
|
|
@@ -1595,14 +1582,14 @@ class XAxisTicksComponent {
|
|
|
1595
1582
|
const maxAllowedLines = 5;
|
|
1596
1583
|
let maxLines = this.rotateTicks ? Math.floor(this.scale.step() / 14) : maxAllowedLines;
|
|
1597
1584
|
if (maxLines <= 1) {
|
|
1598
|
-
return [label];
|
|
1585
|
+
return [this.tickTrim(label)];
|
|
1599
1586
|
}
|
|
1600
1587
|
const possibleStringLength = Math.max(this.maxPossibleLengthForTick, this.maxTickLength);
|
|
1601
1588
|
maxLines = Math.min(maxLines, maxAllowedLines);
|
|
1602
1589
|
const lines = getTickLines(label, possibleStringLength, maxLines < 1 ? 1 : maxLines);
|
|
1603
1590
|
return lines;
|
|
1604
1591
|
}
|
|
1605
|
-
return [label];
|
|
1592
|
+
return [this.tickTrim(label)];
|
|
1606
1593
|
}
|
|
1607
1594
|
}
|
|
1608
1595
|
XAxisTicksComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.1.0", ngImport: i0, type: XAxisTicksComponent, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Component });
|
|
@@ -19856,5 +19843,5 @@ function tickFormat(fieldType, groupByType) {
|
|
|
19856
19843
|
* Generated bundle index. Do not edit.
|
|
19857
19844
|
*/
|
|
19858
19845
|
|
|
19859
|
-
export { AdvancedLegendComponent, AdvancedPieChartComponent, AreaChartComponent, AreaChartModule, AreaChartNormalizedComponent, AreaChartStackedComponent, AreaComponent, AreaSeriesComponent, AxesModule, AxisLabelComponent, BarChartModule, BarChartType, BarComponent, BarHorizontal2DComponent, BarHorizontalComponent, BarHorizontalNormalizedComponent, BarHorizontalStackedComponent, BarLabelComponent, BarOrientation, BarVertical2DComponent, BarVerticalComponent, BarVerticalNormalizedComponent, BarVerticalStackedComponent, BaseChartComponent, BoxChartComponent, BoxChartModule, BoxComponent, BoxSeriesComponent, BubbleChartComponent, BubbleChartModule, BubbleSeriesComponent, CardComponent, CardSeriesComponent, ChartCommonModule, ChartComponent, CircleComponent, CircleSeriesComponent, ColorHelper, CountUpDirective, D0Types, GaugeArcComponent, GaugeAxisComponent, GaugeComponent, GaugeModule, GridPanelComponent, GridPanelSeriesComponent, HeatCellSeriesComponent, HeatMapCellComponent, HeatMapComponent, HeatMapModule, LegendComponent, LegendEntryComponent, LegendPosition, LegendType, LineChartComponent, LineChartModule, LineComponent, LineSeriesComponent, LinearGaugeComponent, NgxChartsModule, NumberCardComponent, NumberCardModule, Orientation, PieArcComponent, PieChartComponent, PieChartModule, PieGridComponent, PieGridSeriesComponent, PieLabelComponent, PieSeriesComponent, PlacementTypes, PolarChartComponent, PolarChartModule, PolarSeriesComponent, ScaleLegendComponent, ScaleType, SeriesHorizontal, SeriesType, SeriesVerticalComponent, ShowTypes, StyleTypes, SvgLinearGradientComponent, SvgRadialGradientComponent, TextAnchor, Timeline, TooltipArea, TooltipContentComponent, TooltipDirective, TooltipModule, TooltipService, TreeMapCellComponent, TreeMapCellSeriesComponent, TreeMapComponent, TreeMapModule, VisibilityObserver, XAxisComponent, XAxisTicksComponent, YAxisComponent, YAxisTicksComponent,
|
|
19846
|
+
export { AdvancedLegendComponent, AdvancedPieChartComponent, AreaChartComponent, AreaChartModule, AreaChartNormalizedComponent, AreaChartStackedComponent, AreaComponent, AreaSeriesComponent, AxesModule, AxisLabelComponent, BarChartModule, BarChartType, BarComponent, BarHorizontal2DComponent, BarHorizontalComponent, BarHorizontalNormalizedComponent, BarHorizontalStackedComponent, BarLabelComponent, BarOrientation, BarVertical2DComponent, BarVerticalComponent, BarVerticalNormalizedComponent, BarVerticalStackedComponent, BaseChartComponent, BoxChartComponent, BoxChartModule, BoxComponent, BoxSeriesComponent, BubbleChartComponent, BubbleChartModule, BubbleSeriesComponent, CardComponent, CardSeriesComponent, ChartCommonModule, ChartComponent, CircleComponent, CircleSeriesComponent, ColorHelper, CountUpDirective, D0Types, GaugeArcComponent, GaugeAxisComponent, GaugeComponent, GaugeModule, GridPanelComponent, GridPanelSeriesComponent, HeatCellSeriesComponent, HeatMapCellComponent, HeatMapComponent, HeatMapModule, LegendComponent, LegendEntryComponent, LegendPosition, LegendType, LineChartComponent, LineChartModule, LineComponent, LineSeriesComponent, LinearGaugeComponent, NgxChartsModule, NumberCardComponent, NumberCardModule, Orientation, PieArcComponent, PieChartComponent, PieChartModule, PieGridComponent, PieGridSeriesComponent, PieLabelComponent, PieSeriesComponent, PlacementTypes, PolarChartComponent, PolarChartModule, PolarSeriesComponent, ScaleLegendComponent, ScaleType, SeriesHorizontal, SeriesType, SeriesVerticalComponent, ShowTypes, StyleTypes, SvgLinearGradientComponent, SvgRadialGradientComponent, TextAnchor, Timeline, TooltipArea, TooltipContentComponent, TooltipDirective, TooltipModule, TooltipService, TreeMapCellComponent, TreeMapCellSeriesComponent, TreeMapComponent, TreeMapModule, VisibilityObserver, XAxisComponent, XAxisTicksComponent, YAxisComponent, YAxisTicksComponent, calculateViewDimensions, colorSets, count, decimalChecker, escapeLabel, formatLabel, getDomain, getScale, getScaleType, getTickLines, getUniqueXDomainValues, getXDomainArray, gridLayout, gridSize, hexToRgb, id, invertColor, reduceTicks, shadeRGBColor, sortByDomain, sortByTime, sortLinear, throttle, throttleable, tickFormat, trimLabel };
|
|
19860
19847
|
//# sourceMappingURL=swimlane-ngx-charts.mjs.map
|