@opendata-ai/openchart-core 6.18.0 → 6.19.1
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/dist/index.d.ts +3 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/layout/text-measure.ts +2 -2
- package/src/types/layout.ts +2 -0
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Inter is slightly wider than Helvetica, narrower than Courier.
|
|
13
13
|
* This is a reasonable middle ground.
|
|
14
14
|
*/
|
|
15
|
-
const AVG_CHAR_WIDTH_RATIO = 0.
|
|
15
|
+
const AVG_CHAR_WIDTH_RATIO = 0.57;
|
|
16
16
|
|
|
17
17
|
/** Narrower characters (i, l, t, etc.) bring the average down. */
|
|
18
18
|
const WEIGHT_ADJUSTMENT: Record<number, number> = {
|
|
@@ -65,7 +65,7 @@ export function estimateTextWidth(text: string, fontSize: number, fontWeight = 4
|
|
|
65
65
|
* so adjacent text doesn't crowd it. Used by chrome and legend layout to avoid
|
|
66
66
|
* overlapping the brand.
|
|
67
67
|
*/
|
|
68
|
-
export const BRAND_RESERVE_WIDTH =
|
|
68
|
+
export const BRAND_RESERVE_WIDTH = 130;
|
|
69
69
|
|
|
70
70
|
/** Font size of the brand watermark (px). Shared between layout and renderer. */
|
|
71
71
|
export const BRAND_FONT_SIZE = 12;
|
package/src/types/layout.ts
CHANGED
|
@@ -490,6 +490,8 @@ export interface ResolvedLabel {
|
|
|
490
490
|
style: TextStyle;
|
|
491
491
|
/** Whether this label is visible or was demoted to tooltip-only by collision detection. */
|
|
492
492
|
visible: boolean;
|
|
493
|
+
/** Maximum available width for the label text. When set, the renderer should wrap or truncate. */
|
|
494
|
+
maxWidth?: number;
|
|
493
495
|
/** If not at the anchor point, draw a connector line from label to anchor. */
|
|
494
496
|
connector?: {
|
|
495
497
|
/** Connector start (at the label). */
|