@amcharts/amcharts5 5.2.32 → 5.2.33
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/.internal/charts/hierarchy/HierarchyDefaultTheme.d.ts.map +1 -1
- package/.internal/charts/hierarchy/HierarchyDefaultTheme.js +2 -0
- package/.internal/charts/hierarchy/HierarchyDefaultTheme.js.map +1 -1
- package/.internal/charts/hierarchy/Sunburst.d.ts.map +1 -1
- package/.internal/charts/hierarchy/Sunburst.js +6 -2
- package/.internal/charts/hierarchy/Sunburst.js.map +1 -1
- package/.internal/charts/map/MapChart.d.ts +1 -1
- package/.internal/charts/map/MapChart.d.ts.map +1 -1
- package/.internal/charts/map/MapChart.js.map +1 -1
- package/.internal/charts/map/MapSeries.d.ts +0 -2
- package/.internal/charts/map/MapSeries.d.ts.map +1 -1
- package/.internal/charts/map/MapSeries.js +26 -0
- package/.internal/charts/map/MapSeries.js.map +1 -1
- package/.internal/charts/percent/PercentDefaultTheme.js +2 -2
- package/.internal/charts/percent/PercentDefaultTheme.js.map +1 -1
- package/.internal/core/Registry.js +1 -1
- package/.internal/core/Registry.js.map +1 -1
- package/.internal/core/render/Label.d.ts +3 -0
- package/.internal/core/render/Label.d.ts.map +1 -1
- package/.internal/core/render/Label.js.map +1 -1
- package/.internal/core/render/Series.d.ts +0 -9
- package/.internal/core/render/Series.d.ts.map +1 -1
- package/.internal/core/render/Series.js.map +1 -1
- package/.internal/core/render/backend/CanvasRenderer.d.ts +1 -0
- package/.internal/core/render/backend/CanvasRenderer.d.ts.map +1 -1
- package/.internal/core/render/backend/CanvasRenderer.js +212 -154
- package/.internal/core/render/backend/CanvasRenderer.js.map +1 -1
- package/.internal/core/render/patterns/PathPattern.d.ts +26 -0
- package/.internal/core/render/patterns/PathPattern.d.ts.map +1 -0
- package/.internal/core/render/patterns/PathPattern.js +100 -0
- package/.internal/core/render/patterns/PathPattern.js.map +1 -0
- package/CHANGELOG.md +15 -0
- package/examples/javascript/flow-chord/package.json +1 -1
- package/examples/javascript/flow-chord-directed/package.json +1 -1
- package/examples/javascript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/javascript/flow-sankey/package.json +1 -1
- package/examples/javascript/gauge/package.json +1 -1
- package/examples/javascript/gauge-bands/package.json +1 -1
- package/examples/javascript/hierarchy-force-directed/package.json +1 -1
- package/examples/javascript/hierarchy-pack/package.json +1 -1
- package/examples/javascript/hierarchy-partition/package.json +1 -1
- package/examples/javascript/hierarchy-sunburst/package.json +1 -1
- package/examples/javascript/hierarchy-tree/package.json +1 -1
- package/examples/javascript/hierarchy-treemap/package.json +1 -1
- package/examples/javascript/jest/package.json +1 -1
- package/examples/javascript/json/package.json +1 -1
- package/examples/javascript/map-animating-along-lines/package.json +1 -1
- package/examples/javascript/map-day-and-night/package.json +1 -1
- package/examples/javascript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/javascript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/javascript/map-with-bubbles/package.json +1 -1
- package/examples/javascript/map-zoom-to-country/package.json +1 -1
- package/examples/javascript/misc-40-charts/package.json +1 -1
- package/examples/javascript/misc-microchart-grid/package.json +1 -1
- package/examples/javascript/pie-chart/package.json +1 -1
- package/examples/javascript/pie-donut-chart/package.json +1 -1
- package/examples/javascript/pie-variable-radius/package.json +1 -1
- package/examples/javascript/radar-column-iwatch-style/package.json +1 -1
- package/examples/javascript/radar-heat-map/package.json +1 -1
- package/examples/javascript/radar-line/package.json +1 -1
- package/examples/javascript/radar-time-line/package.json +1 -1
- package/examples/javascript/sliced-funnel/package.json +1 -1
- package/examples/javascript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/javascript/sliced-pyramid/package.json +1 -1
- package/examples/javascript/stock-chart/package.json +1 -1
- package/examples/javascript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/javascript/stock-chart-data-granularity/package.json +1 -1
- package/examples/javascript/stock-chart-data-grouping/package.json +1 -1
- package/examples/javascript/stock-chart-intraday/package.json +1 -1
- package/examples/javascript/stock-chart-live/package.json +1 -1
- package/examples/javascript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/javascript/venn-diagram/package.json +1 -1
- package/examples/javascript/wordcloud-with-data/package.json +1 -1
- package/examples/javascript/wordcloud-with-text/package.json +1 -1
- package/examples/javascript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/javascript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/javascript/xy-bubble/package.json +1 -1
- package/examples/javascript/xy-candlestick/package.json +1 -1
- package/examples/javascript/xy-clustered-column/package.json +1 -1
- package/examples/javascript/xy-column/package.json +1 -1
- package/examples/javascript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/javascript/xy-data-grouping/package.json +1 -1
- package/examples/javascript/xy-draggable-range/package.json +1 -1
- package/examples/javascript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/javascript/xy-dumbbell plot/package.json +1 -1
- package/examples/javascript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/javascript/xy-line/package.json +1 -1
- package/examples/javascript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/javascript/xy-live-data/package.json +1 -1
- package/examples/javascript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/javascript/xy-ohlc/package.json +1 -1
- package/examples/javascript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/javascript/xy-smoothed-line/package.json +1 -1
- package/examples/javascript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/javascript/xy-stacked-column/package.json +1 -1
- package/examples/javascript/xy-stacked-step/package.json +1 -1
- package/examples/javascript/xy-stock/package.json +1 -1
- package/examples/javascript/xy-stock-comparing/package.json +1 -1
- package/examples/typescript/flow-chord/package.json +1 -1
- package/examples/typescript/flow-chord-directed/package.json +1 -1
- package/examples/typescript/flow-chord-non-ribbon/package.json +1 -1
- package/examples/typescript/flow-sankey/package.json +1 -1
- package/examples/typescript/gauge/package.json +1 -1
- package/examples/typescript/gauge-bands/package.json +1 -1
- package/examples/typescript/hierarchy-force-directed/package.json +1 -1
- package/examples/typescript/hierarchy-pack/package.json +1 -1
- package/examples/typescript/hierarchy-partition/package.json +1 -1
- package/examples/typescript/hierarchy-sunburst/package.json +1 -1
- package/examples/typescript/hierarchy-tree/package.json +1 -1
- package/examples/typescript/hierarchy-treemap/package.json +1 -1
- package/examples/typescript/jest/package.json +1 -1
- package/examples/typescript/json/package.json +1 -1
- package/examples/typescript/map-animating-along-lines/package.json +1 -1
- package/examples/typescript/map-day-and-night/package.json +1 -1
- package/examples/typescript/map-globe-rotate-to-country/package.json +1 -1
- package/examples/typescript/map-globe-with-projected-circles/package.json +1 -1
- package/examples/typescript/map-with-bubbles/package.json +1 -1
- package/examples/typescript/map-zoom-to-country/package.json +1 -1
- package/examples/typescript/misc-40-charts/package.json +1 -1
- package/examples/typescript/misc-microchart-grid/package.json +1 -1
- package/examples/typescript/pie-chart/package.json +1 -1
- package/examples/typescript/pie-donut-chart/package.json +1 -1
- package/examples/typescript/pie-variable-radius/package.json +1 -1
- package/examples/typescript/radar-column-iwatch-style/package.json +1 -1
- package/examples/typescript/radar-heat-map/package.json +1 -1
- package/examples/typescript/radar-line/package.json +1 -1
- package/examples/typescript/radar-time-line/package.json +1 -1
- package/examples/typescript/sliced-funnel/package.json +1 -1
- package/examples/typescript/sliced-pictorial-stacked/package.json +1 -1
- package/examples/typescript/sliced-pyramid/package.json +1 -1
- package/examples/typescript/stock-chart/package.json +1 -1
- package/examples/typescript/stock-chart-comparing-stocks/package.json +1 -1
- package/examples/typescript/stock-chart-data-granularity/package.json +1 -1
- package/examples/typescript/stock-chart-data-grouping/package.json +1 -1
- package/examples/typescript/stock-chart-intraday/package.json +1 -1
- package/examples/typescript/stock-chart-live/package.json +1 -1
- package/examples/typescript/stock-chart-volume-separate-panel/package.json +1 -1
- package/examples/typescript/venn-diagram/package.json +1 -1
- package/examples/typescript/wordcloud-with-data/package.json +1 -1
- package/examples/typescript/wordcloud-with-text/package.json +1 -1
- package/examples/typescript/xy-100-percent-stacked-column/package.json +1 -1
- package/examples/typescript/xy-animated-bullet-at-the-end-of-the-series/package.json +1 -1
- package/examples/typescript/xy-bubble/package.json +1 -1
- package/examples/typescript/xy-candlestick/package.json +1 -1
- package/examples/typescript/xy-clustered-column/package.json +1 -1
- package/examples/typescript/xy-column/package.json +1 -1
- package/examples/typescript/xy-comparing-series-google-analytics-style/package.json +1 -1
- package/examples/typescript/xy-data-grouping/package.json +1 -1
- package/examples/typescript/xy-draggable-range/package.json +1 -1
- package/examples/typescript/xy-drawing-series-with-mouse-or-touch/package.json +1 -1
- package/examples/typescript/xy-dumbbell plot/package.json +1 -1
- package/examples/typescript/xy-evenly-spaced-date-axis/package.json +1 -1
- package/examples/typescript/xy-line/package.json +1 -1
- package/examples/typescript/xy-line-highlight-on-legend-hover/package.json +1 -1
- package/examples/typescript/xy-live-data/package.json +1 -1
- package/examples/typescript/xy-multiple-synced-value-axes/package.json +1 -1
- package/examples/typescript/xy-ohlc/package.json +1 -1
- package/examples/typescript/xy-real-time-data-sorting/package.json +1 -1
- package/examples/typescript/xy-smoothed-line/package.json +1 -1
- package/examples/typescript/xy-stacked-and-clustered-column/package.json +1 -1
- package/examples/typescript/xy-stacked-column/package.json +1 -1
- package/examples/typescript/xy-stacked-step/package.json +1 -1
- package/examples/typescript/xy-stock/package.json +1 -1
- package/examples/typescript/xy-stock-comparing/package.json +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -2600,6 +2600,14 @@ var CanvasText = /** @class */ (function (_super) {
|
|
|
2600
2600
|
}
|
|
2601
2601
|
}
|
|
2602
2602
|
});
|
|
2603
|
+
Object.defineProperty(CanvasText.prototype, "_ignoreFontWeight", {
|
|
2604
|
+
enumerable: false,
|
|
2605
|
+
configurable: true,
|
|
2606
|
+
writable: true,
|
|
2607
|
+
value: function () {
|
|
2608
|
+
return /apple/i.test(navigator.vendor);
|
|
2609
|
+
}
|
|
2610
|
+
});
|
|
2603
2611
|
Object.defineProperty(CanvasText.prototype, "_measure", {
|
|
2604
2612
|
enumerable: false,
|
|
2605
2613
|
configurable: true,
|
|
@@ -2619,7 +2627,7 @@ var CanvasText = /** @class */ (function (_super) {
|
|
|
2619
2627
|
// Pre-render
|
|
2620
2628
|
context.save();
|
|
2621
2629
|
ghostContext.save();
|
|
2622
|
-
this._prerender(layer, true,
|
|
2630
|
+
this._prerender(layer, true, this._ignoreFontWeight());
|
|
2623
2631
|
// Get default font metrix
|
|
2624
2632
|
var refText = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
|
|
2625
2633
|
// Split up text into lines
|
|
@@ -3272,173 +3280,175 @@ var CanvasRadialText = /** @class */ (function (_super) {
|
|
|
3272
3280
|
configurable: true,
|
|
3273
3281
|
writable: true,
|
|
3274
3282
|
value: function (parentLayer) {
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
context.save();
|
|
3283
|
-
if (interactive) {
|
|
3284
|
-
ghostContext.save();
|
|
3285
|
-
}
|
|
3286
|
-
// Init
|
|
3287
|
-
var radius = (this.radius || 0);
|
|
3288
|
-
var startAngle = (this.startAngle || 0);
|
|
3289
|
-
var deltaAngle = 0;
|
|
3290
|
-
var orientation = this.orientation;
|
|
3291
|
-
var inward = orientation == "auto" ? "auto" : orientation == "inward";
|
|
3292
|
-
var inside = this.inside;
|
|
3293
|
-
var align = this.style.textAlign || "left";
|
|
3294
|
-
var kerning = this.kerning || 0;
|
|
3295
|
-
var clockwise = align == "left" ? 1 : -1;
|
|
3296
|
-
var shouldReverse = !this._textReversed;
|
|
3297
|
-
// We need measurements in order to properly position text for alignment
|
|
3298
|
-
if (!this._textInfo) {
|
|
3299
|
-
this._measure(layer);
|
|
3300
|
-
}
|
|
3301
|
-
// Check if we need to invert the whole stuff
|
|
3302
|
-
if (inward == "auto") {
|
|
3303
|
-
// Calc max angle so we know whether we need to flip it
|
|
3304
|
-
var maxAngle_1 = 0;
|
|
3305
|
-
var midAngle = 0;
|
|
3306
|
-
$array.each(this._textInfo, function (line, _index) {
|
|
3307
|
-
var deltaAngle = startAngle + (line.width / (radius - line.height)) / 2 * -clockwise;
|
|
3308
|
-
if (deltaAngle > maxAngle_1) {
|
|
3309
|
-
maxAngle_1 = deltaAngle;
|
|
3310
|
-
}
|
|
3311
|
-
});
|
|
3312
|
-
if (align == "left") {
|
|
3313
|
-
midAngle = (maxAngle_1 + deltaAngle / 2) * $math.DEGREES;
|
|
3314
|
-
}
|
|
3315
|
-
else if (align == "right") {
|
|
3316
|
-
midAngle = (maxAngle_1 - deltaAngle / 2) * $math.DEGREES;
|
|
3317
|
-
}
|
|
3318
|
-
else {
|
|
3319
|
-
midAngle = startAngle * $math.DEGREES;
|
|
3320
|
-
}
|
|
3321
|
-
midAngle = $math.normalizeAngle(midAngle);
|
|
3322
|
-
inward = (midAngle >= 270) || (midAngle <= 90);
|
|
3323
|
-
}
|
|
3324
|
-
if (inward == true && shouldReverse) {
|
|
3325
|
-
this._textInfo.reverse();
|
|
3326
|
-
this._textReversed = true;
|
|
3327
|
-
}
|
|
3328
|
-
// if ((inward == false && align == "left") || (inward == true && align == "right")) {
|
|
3329
|
-
// clockwise *= -1;
|
|
3330
|
-
// }
|
|
3331
|
-
// Process text info produced by _measure()
|
|
3332
|
-
$array.each(this._textInfo, function (line, _index) {
|
|
3333
|
-
var textHeight = line.height;
|
|
3334
|
-
// Adjust radius (for `inside = false`)
|
|
3335
|
-
// Radius adjustment for `inside = false` is below the line calculation
|
|
3336
|
-
if (!inside) {
|
|
3337
|
-
radius += textHeight;
|
|
3338
|
-
}
|
|
3339
|
-
// Reverse letters if we're painting them counter-clockwise
|
|
3340
|
-
if (((clockwise == -1 && inward) || (clockwise == 1 && !inward)) && shouldReverse) {
|
|
3341
|
-
line.textChunks.reverse();
|
|
3342
|
-
}
|
|
3343
|
-
// Init angles
|
|
3344
|
-
var lineStartAngle = startAngle;
|
|
3345
|
-
deltaAngle = 0;
|
|
3346
|
-
// Adjust for center-align
|
|
3347
|
-
if (align == "center") {
|
|
3348
|
-
lineStartAngle += (line.width / (radius - textHeight)) / 2 * -clockwise;
|
|
3349
|
-
deltaAngle = lineStartAngle - startAngle;
|
|
3350
|
-
}
|
|
3351
|
-
// if (inward == "auto") {
|
|
3352
|
-
// let midAngle;
|
|
3353
|
-
// if (align == "left") {
|
|
3354
|
-
// midAngle = (lineStartAngle + deltaAngle / 2) * $math.DEGREES;
|
|
3355
|
-
// }
|
|
3356
|
-
// else if () {
|
|
3357
|
-
// midAngle = (lineStartAngle - deltaAngle / 2) * $math.DEGREES;
|
|
3358
|
-
// }
|
|
3359
|
-
// inward = (midAngle >= 270) || (midAngle <= 90);
|
|
3360
|
-
// }
|
|
3361
|
-
// Rotate letters if they are facing outward
|
|
3362
|
-
lineStartAngle += (Math.PI * (inward ? 0 : 1)); // Rotate 180 if outward
|
|
3283
|
+
if (this._textVisible) {
|
|
3284
|
+
var layer = this._layer || parentLayer;
|
|
3285
|
+
this._prerender(layer);
|
|
3286
|
+
var interactive_2 = this._isInteractive();
|
|
3287
|
+
var context_3 = layer.context;
|
|
3288
|
+
var layerDirty_2 = layer.dirty;
|
|
3289
|
+
var ghostContext_3 = this._renderer._ghostContext;
|
|
3363
3290
|
// Savepoint
|
|
3364
|
-
|
|
3365
|
-
if (
|
|
3366
|
-
|
|
3291
|
+
context_3.save();
|
|
3292
|
+
if (interactive_2) {
|
|
3293
|
+
ghostContext_3.save();
|
|
3367
3294
|
}
|
|
3368
|
-
//
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3295
|
+
// Init
|
|
3296
|
+
var radius_1 = (this.radius || 0);
|
|
3297
|
+
var startAngle_1 = (this.startAngle || 0);
|
|
3298
|
+
var deltaAngle_1 = 0;
|
|
3299
|
+
var orientation_1 = this.orientation;
|
|
3300
|
+
var inward_1 = orientation_1 == "auto" ? "auto" : orientation_1 == "inward";
|
|
3301
|
+
var inside_1 = this.inside;
|
|
3302
|
+
var align_1 = this.style.textAlign || "left";
|
|
3303
|
+
var kerning_1 = this.kerning || 0;
|
|
3304
|
+
var clockwise_1 = align_1 == "left" ? 1 : -1;
|
|
3305
|
+
var shouldReverse_1 = !this._textReversed;
|
|
3306
|
+
// We need measurements in order to properly position text for alignment
|
|
3307
|
+
if (!this._textInfo) {
|
|
3308
|
+
this._measure(layer);
|
|
3372
3309
|
}
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
//
|
|
3376
|
-
var
|
|
3377
|
-
var
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
ghostContext.rotate(angleShift);
|
|
3383
|
-
}
|
|
3384
|
-
// Set style
|
|
3385
|
-
if (chunk.style) {
|
|
3386
|
-
context.save();
|
|
3387
|
-
ghostContext.save();
|
|
3388
|
-
context.font = chunk.style;
|
|
3389
|
-
if (interactive) {
|
|
3390
|
-
ghostContext.font = chunk.style;
|
|
3310
|
+
// Check if we need to invert the whole stuff
|
|
3311
|
+
if (inward_1 == "auto") {
|
|
3312
|
+
// Calc max angle so we know whether we need to flip it
|
|
3313
|
+
var maxAngle_1 = 0;
|
|
3314
|
+
var midAngle = 0;
|
|
3315
|
+
$array.each(this._textInfo, function (line, _index) {
|
|
3316
|
+
var deltaAngle = startAngle_1 + (line.width / (radius_1 - line.height)) / 2 * -clockwise_1;
|
|
3317
|
+
if (deltaAngle > maxAngle_1) {
|
|
3318
|
+
maxAngle_1 = deltaAngle;
|
|
3391
3319
|
}
|
|
3320
|
+
});
|
|
3321
|
+
if (align_1 == "left") {
|
|
3322
|
+
midAngle = (maxAngle_1 + deltaAngle_1 / 2) * $math.DEGREES;
|
|
3392
3323
|
}
|
|
3393
|
-
if (
|
|
3394
|
-
|
|
3395
|
-
context.fillStyle = chunk.fill.toCSS();
|
|
3396
|
-
// Color does not affect ghostContext so we not set it
|
|
3324
|
+
else if (align_1 == "right") {
|
|
3325
|
+
midAngle = (maxAngle_1 - deltaAngle_1 / 2) * $math.DEGREES;
|
|
3397
3326
|
}
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
context.textAlign = "center";
|
|
3401
|
-
if (interactive) {
|
|
3402
|
-
ghostContext.textBaseline = "middle";
|
|
3403
|
-
ghostContext.textAlign = "center";
|
|
3327
|
+
else {
|
|
3328
|
+
midAngle = startAngle_1 * $math.DEGREES;
|
|
3404
3329
|
}
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3330
|
+
midAngle = $math.normalizeAngle(midAngle);
|
|
3331
|
+
inward_1 = (midAngle >= 270) || (midAngle <= 90);
|
|
3332
|
+
}
|
|
3333
|
+
if (inward_1 == true && shouldReverse_1) {
|
|
3334
|
+
this._textInfo.reverse();
|
|
3335
|
+
this._textReversed = true;
|
|
3336
|
+
}
|
|
3337
|
+
// if ((inward == false && align == "left") || (inward == true && align == "right")) {
|
|
3338
|
+
// clockwise *= -1;
|
|
3339
|
+
// }
|
|
3340
|
+
// Process text info produced by _measure()
|
|
3341
|
+
$array.each(this._textInfo, function (line, _index) {
|
|
3342
|
+
var textHeight = line.height;
|
|
3343
|
+
// Adjust radius (for `inside = false`)
|
|
3344
|
+
// Radius adjustment for `inside = false` is below the line calculation
|
|
3345
|
+
if (!inside_1) {
|
|
3346
|
+
radius_1 += textHeight;
|
|
3408
3347
|
}
|
|
3409
|
-
if
|
|
3410
|
-
|
|
3348
|
+
// Reverse letters if we're painting them counter-clockwise
|
|
3349
|
+
if (((clockwise_1 == -1 && inward_1) || (clockwise_1 == 1 && !inward_1)) && shouldReverse_1) {
|
|
3350
|
+
line.textChunks.reverse();
|
|
3411
3351
|
}
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3352
|
+
// Init angles
|
|
3353
|
+
var lineStartAngle = startAngle_1;
|
|
3354
|
+
deltaAngle_1 = 0;
|
|
3355
|
+
// Adjust for center-align
|
|
3356
|
+
if (align_1 == "center") {
|
|
3357
|
+
lineStartAngle += (line.width / (radius_1 - textHeight)) / 2 * -clockwise_1;
|
|
3358
|
+
deltaAngle_1 = lineStartAngle - startAngle_1;
|
|
3415
3359
|
}
|
|
3416
|
-
//
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3360
|
+
// if (inward == "auto") {
|
|
3361
|
+
// let midAngle;
|
|
3362
|
+
// if (align == "left") {
|
|
3363
|
+
// midAngle = (lineStartAngle + deltaAngle / 2) * $math.DEGREES;
|
|
3364
|
+
// }
|
|
3365
|
+
// else if () {
|
|
3366
|
+
// midAngle = (lineStartAngle - deltaAngle / 2) * $math.DEGREES;
|
|
3367
|
+
// }
|
|
3368
|
+
// inward = (midAngle >= 270) || (midAngle <= 90);
|
|
3369
|
+
// }
|
|
3370
|
+
// Rotate letters if they are facing outward
|
|
3371
|
+
lineStartAngle += (Math.PI * (inward_1 ? 0 : 1)); // Rotate 180 if outward
|
|
3372
|
+
// Savepoint
|
|
3373
|
+
context_3.save();
|
|
3374
|
+
if (interactive_2) {
|
|
3375
|
+
ghostContext_3.save();
|
|
3420
3376
|
}
|
|
3421
|
-
//
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3377
|
+
// Assume starting angle
|
|
3378
|
+
context_3.rotate(lineStartAngle);
|
|
3379
|
+
if (interactive_2) {
|
|
3380
|
+
ghostContext_3.rotate(lineStartAngle);
|
|
3381
|
+
}
|
|
3382
|
+
var angleShift = 0;
|
|
3383
|
+
$array.each(line.textChunks, function (chunk, _index) {
|
|
3384
|
+
// Draw the letter
|
|
3385
|
+
var char = chunk.text;
|
|
3386
|
+
var charWidth = chunk.width;
|
|
3387
|
+
// Rotate half a letter
|
|
3388
|
+
angleShift = (charWidth / 2) / (radius_1 - textHeight) * clockwise_1;
|
|
3389
|
+
context_3.rotate(angleShift);
|
|
3390
|
+
if (interactive_2) {
|
|
3391
|
+
ghostContext_3.rotate(angleShift);
|
|
3392
|
+
}
|
|
3393
|
+
// Set style
|
|
3394
|
+
if (chunk.style) {
|
|
3395
|
+
context_3.save();
|
|
3396
|
+
ghostContext_3.save();
|
|
3397
|
+
context_3.font = chunk.style;
|
|
3398
|
+
if (interactive_2) {
|
|
3399
|
+
ghostContext_3.font = chunk.style;
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
if (chunk.fill) {
|
|
3403
|
+
context_3.save();
|
|
3404
|
+
context_3.fillStyle = chunk.fill.toCSS();
|
|
3405
|
+
// Color does not affect ghostContext so we not set it
|
|
3406
|
+
}
|
|
3407
|
+
// Center letters
|
|
3408
|
+
context_3.textBaseline = "middle";
|
|
3409
|
+
context_3.textAlign = "center";
|
|
3410
|
+
if (interactive_2) {
|
|
3411
|
+
ghostContext_3.textBaseline = "middle";
|
|
3412
|
+
ghostContext_3.textAlign = "center";
|
|
3413
|
+
}
|
|
3414
|
+
// Plop the letter
|
|
3415
|
+
if (layerDirty_2) {
|
|
3416
|
+
context_3.fillText(char, 0, (inward_1 ? 1 : -1) * (0 - radius_1 + textHeight / 2));
|
|
3417
|
+
}
|
|
3418
|
+
if (interactive_2) {
|
|
3419
|
+
ghostContext_3.fillText(char, 0, (inward_1 ? 1 : -1) * (0 - radius_1 + textHeight / 2));
|
|
3420
|
+
}
|
|
3421
|
+
if (chunk.fill) {
|
|
3422
|
+
context_3.restore();
|
|
3423
|
+
// Color does not affect ghostContext so we not set it
|
|
3424
|
+
}
|
|
3425
|
+
// Reset style
|
|
3426
|
+
if (chunk.style) {
|
|
3427
|
+
context_3.restore();
|
|
3428
|
+
ghostContext_3.restore();
|
|
3429
|
+
}
|
|
3430
|
+
// Rotate half a letter and add spacing
|
|
3431
|
+
angleShift = (charWidth / 2 + kerning_1) / (radius_1 - textHeight) * clockwise_1;
|
|
3432
|
+
context_3.rotate(angleShift);
|
|
3433
|
+
if (interactive_2) {
|
|
3434
|
+
ghostContext_3.rotate(angleShift);
|
|
3435
|
+
}
|
|
3436
|
+
});
|
|
3437
|
+
// Restore angle
|
|
3438
|
+
context_3.restore();
|
|
3439
|
+
if (interactive_2) {
|
|
3440
|
+
ghostContext_3.restore();
|
|
3441
|
+
}
|
|
3442
|
+
// Adjust radius (for `inside = true`)
|
|
3443
|
+
if (inside_1) {
|
|
3444
|
+
radius_1 -= textHeight;
|
|
3426
3445
|
}
|
|
3427
3446
|
});
|
|
3428
|
-
// Restore
|
|
3429
|
-
|
|
3430
|
-
if (
|
|
3431
|
-
|
|
3432
|
-
}
|
|
3433
|
-
// Adjust radius (for `inside = true`)
|
|
3434
|
-
if (inside) {
|
|
3435
|
-
radius -= textHeight;
|
|
3447
|
+
// Restore
|
|
3448
|
+
context_3.restore();
|
|
3449
|
+
if (interactive_2) {
|
|
3450
|
+
ghostContext_3.restore();
|
|
3436
3451
|
}
|
|
3437
|
-
});
|
|
3438
|
-
// Restore
|
|
3439
|
-
context.restore();
|
|
3440
|
-
if (interactive) {
|
|
3441
|
-
ghostContext.restore();
|
|
3442
3452
|
}
|
|
3443
3453
|
}
|
|
3444
3454
|
});
|
|
@@ -3464,7 +3474,14 @@ var CanvasRadialText = /** @class */ (function (_super) {
|
|
|
3464
3474
|
var context = layer.context;
|
|
3465
3475
|
var ghostContext = this._renderer._ghostContext;
|
|
3466
3476
|
var rtl = this.style.direction == "rtl";
|
|
3477
|
+
var oversizedBehavior = this.style.oversizedBehavior;
|
|
3478
|
+
var maxWidth = this.style.maxWidth;
|
|
3479
|
+
var truncate = $type.isNumber(maxWidth) && oversizedBehavior == "truncate";
|
|
3480
|
+
var ellipsis = this.style.ellipsis || "";
|
|
3481
|
+
var ellipsisMetrics;
|
|
3482
|
+
//const wrap = $type.isNumber(maxWidth) && (oversizedBehavior == "wrap" || oversizedBehavior == "wrap-no-break");
|
|
3467
3483
|
// Reset text info
|
|
3484
|
+
this._textVisible = true;
|
|
3468
3485
|
this._textInfo = [];
|
|
3469
3486
|
this._textReversed = false;
|
|
3470
3487
|
// Pre-render
|
|
@@ -3474,6 +3491,7 @@ var CanvasRadialText = /** @class */ (function (_super) {
|
|
|
3474
3491
|
// Split up text into lines
|
|
3475
3492
|
var lines = this.text.toString().replace(/\r/g, "").split(/\n/);
|
|
3476
3493
|
var styleRestored = true;
|
|
3494
|
+
var totalWidth = 0;
|
|
3477
3495
|
// Iterate through the lines
|
|
3478
3496
|
var offsetY = 0;
|
|
3479
3497
|
$array.each(lines, function (line, _index) {
|
|
@@ -3521,6 +3539,9 @@ var CanvasRadialText = /** @class */ (function (_super) {
|
|
|
3521
3539
|
}
|
|
3522
3540
|
styleRestored = false;
|
|
3523
3541
|
}
|
|
3542
|
+
if (truncate) {
|
|
3543
|
+
ellipsisMetrics = _this._measureText(ellipsis, context);
|
|
3544
|
+
}
|
|
3524
3545
|
}
|
|
3525
3546
|
// Text format
|
|
3526
3547
|
else if (chunk.type == "value") {
|
|
@@ -3561,6 +3582,40 @@ var CanvasRadialText = /** @class */ (function (_super) {
|
|
|
3561
3582
|
offsetY: chunkHeight,
|
|
3562
3583
|
textDecoration: undefined
|
|
3563
3584
|
});
|
|
3585
|
+
totalWidth += chunkWidth;
|
|
3586
|
+
// Handle oversized behavior
|
|
3587
|
+
if (truncate) {
|
|
3588
|
+
// Measure ellipsis and check if it fits
|
|
3589
|
+
if (!ellipsisMetrics) {
|
|
3590
|
+
ellipsisMetrics = _this._measureText(ellipsis, context);
|
|
3591
|
+
}
|
|
3592
|
+
var ellipsisWidth = ellipsisMetrics.actualBoundingBoxLeft + ellipsisMetrics.actualBoundingBoxRight;
|
|
3593
|
+
totalWidth += ellipsisWidth;
|
|
3594
|
+
if ((totalWidth + ellipsisWidth) > maxWidth) {
|
|
3595
|
+
if (lineInfo.textChunks.length == 1) {
|
|
3596
|
+
_this._textVisible = false;
|
|
3597
|
+
}
|
|
3598
|
+
else {
|
|
3599
|
+
lineInfo.width += ellipsisWidth;
|
|
3600
|
+
lineInfo.left += ellipsisMetrics.actualBoundingBoxLeft;
|
|
3601
|
+
lineInfo.right += ellipsisMetrics.actualBoundingBoxRight;
|
|
3602
|
+
lineInfo.textChunks.push({
|
|
3603
|
+
style: currentStyle,
|
|
3604
|
+
fill: currentFill,
|
|
3605
|
+
text: ellipsis,
|
|
3606
|
+
width: ellipsisWidth,
|
|
3607
|
+
height: chunkHeight + ellipsisMetrics.actualBoundingBoxDescent,
|
|
3608
|
+
left: ellipsisMetrics.actualBoundingBoxLeft,
|
|
3609
|
+
right: ellipsisMetrics.actualBoundingBoxRight,
|
|
3610
|
+
ascent: ellipsisMetrics.actualBoundingBoxAscent,
|
|
3611
|
+
offsetX: 0,
|
|
3612
|
+
offsetY: chunkHeight,
|
|
3613
|
+
textDecoration: undefined
|
|
3614
|
+
});
|
|
3615
|
+
}
|
|
3616
|
+
break;
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3564
3619
|
if (rtl) {
|
|
3565
3620
|
break;
|
|
3566
3621
|
}
|
|
@@ -3581,6 +3636,9 @@ var CanvasRadialText = /** @class */ (function (_super) {
|
|
|
3581
3636
|
context.restore();
|
|
3582
3637
|
ghostContext.restore();
|
|
3583
3638
|
}
|
|
3639
|
+
if (oversizedBehavior == "hide" && (totalWidth > maxWidth)) {
|
|
3640
|
+
this._textVisible = false;
|
|
3641
|
+
}
|
|
3584
3642
|
// Adjust chunk internal offsets
|
|
3585
3643
|
$array.each(this._textInfo, function (lineInfo) {
|
|
3586
3644
|
$array.each(lineInfo.textChunks, function (chunk) {
|