@@ -41,7 +41,7 @@ const MARKER_MARGIN = 4
41
41
// Space between the label and the annotation
42
42
const ANNOTATION_PADDING = 1
43
43
44
- const DEFAULT_CONNECTOR_LINE_WIDTH = 35
44
+ const DEFAULT_CONNECTOR_LINE_WIDTH = 25
45
45
const DEFAULT_FONT_WEIGHT = 400
46
46
47
47
export interface LineLabelSeries extends ChartSeries {
@@ -103,7 +103,6 @@ class LineLabels extends React.Component<{
103
103
series : PlacedSeries [ ]
104
104
uniqueKey : string
105
105
needsConnectorLines : boolean
106
- connectorLineWidth ?: number
107
106
outlineColor ?: Color
108
107
anchor ?: "start" | "end"
109
108
isFocus ?: boolean
@@ -120,10 +119,6 @@ class LineLabels extends React.Component<{
120
119
return this . props . anchor ?? "start"
121
120
}
122
121
123
- @computed private get connectorLineWidth ( ) : number {
124
- return this . props . connectorLineWidth ?? DEFAULT_CONNECTOR_LINE_WIDTH
125
- }
126
-
127
122
@computed private get outlineColor ( ) : Color {
128
123
return this . props . outlineColor ?? GRAPHER_BACKGROUND_DEFAULT
129
124
}
@@ -136,7 +131,7 @@ class LineLabels extends React.Component<{
136
131
return this . props . series . map ( ( series ) => {
137
132
const direction = this . anchor === "start" ? 1 : - 1
138
133
const markerMargin = direction * MARKER_MARGIN
139
- const connectorLineWidth = direction * this . connectorLineWidth
134
+ const connectorLineWidth = direction * DEFAULT_CONNECTOR_LINE_WIDTH
140
135
141
136
const { x } = series . origBounds
142
137
const connectorLine = {
@@ -319,7 +314,6 @@ export interface LineLegendProps {
319
314
verticalAlign ?: VerticalAlign
320
315
321
316
// presentation
322
- connectorLineWidth ?: number
323
317
fontSize ?: number
324
318
fontWeight ?: number
325
319
outlineColor ?: Color // used for halos
@@ -346,7 +340,7 @@ export class LineLegend extends React.Component<LineLegendProps> {
346
340
*/
347
341
static width ( props : LineLegendProps ) : number {
348
342
const test = new LineLegend ( props )
349
- return test . maxLabelWidth + test . connectorLineWidth + MARKER_MARGIN
343
+ return test . maxLabelWidth + DEFAULT_CONNECTOR_LINE_WIDTH + MARKER_MARGIN
350
344
}
351
345
352
346
static fontSize ( props : Partial < LineLegendProps > ) : number {
@@ -365,10 +359,7 @@ export class LineLegend extends React.Component<LineLegendProps> {
365
359
}
366
360
367
361
@computed private get fontSize ( ) : number {
368
- return Math . max (
369
- GRAPHER_FONT_SCALE_12 * ( this . props . fontSize ?? BASE_FONT_SIZE ) ,
370
- 11.5
371
- )
362
+ return GRAPHER_FONT_SCALE_12 * ( this . props . fontSize ?? BASE_FONT_SIZE )
372
363
}
373
364
374
365
@computed private get fontWeight ( ) : number {
@@ -383,17 +374,13 @@ export class LineLegend extends React.Component<LineLegendProps> {
383
374
return this . props . yAxis ?? new VerticalAxis ( new AxisConfig ( ) )
384
375
}
385
376
386
- @computed private get connectorLineWidth ( ) : number {
387
- return this . props . connectorLineWidth ?? DEFAULT_CONNECTOR_LINE_WIDTH
388
- }
389
-
390
377
@computed private get verticalAlign ( ) : VerticalAlign {
391
378
return this . props . verticalAlign ?? VerticalAlign . middle
392
379
}
393
380
394
381
@computed . struct get sizedLabels ( ) : SizedSeries [ ] {
395
382
const { fontSize, fontWeight, maxWidth } = this
396
- const maxTextWidth = maxWidth - this . connectorLineWidth
383
+ const maxTextWidth = maxWidth - DEFAULT_CONNECTOR_LINE_WIDTH
397
384
const maxAnnotationWidth = Math . min ( maxTextWidth , 150 )
398
385
399
386
return this . props . labelSeries . map ( ( label ) => {
@@ -492,7 +479,7 @@ export class LineLegend extends React.Component<LineLegendProps> {
492
479
493
480
return this . sizedLabels . map ( ( label ) => {
494
481
const labelHeight = label . height
495
- const labelWidth = label . width + this . connectorLineWidth
482
+ const labelWidth = label . width + DEFAULT_CONNECTOR_LINE_WIDTH
496
483
497
484
const midY = yAxis . place ( label . yValue )
498
485
const origBounds = new Bounds (
@@ -785,7 +772,6 @@ export class LineLegend extends React.Component<LineLegendProps> {
785
772
uniqueKey = "background"
786
773
series = { this . backgroundSeries }
787
774
needsConnectorLines = { this . needsLines }
788
- connectorLineWidth = { this . connectorLineWidth }
789
775
outlineColor = { this . props . outlineColor }
790
776
isFocus = { false }
791
777
anchor = { this . props . xAnchor }
@@ -805,7 +791,6 @@ export class LineLegend extends React.Component<LineLegendProps> {
805
791
uniqueKey = "focus"
806
792
series = { this . focusedSeries }
807
793
needsConnectorLines = { this . needsLines }
808
- connectorLineWidth = { this . connectorLineWidth }
809
794
outlineColor = { this . props . outlineColor }
810
795
isFocus = { true }
811
796
anchor = { this . props . xAnchor }
0 commit comments