Skip to content

Commit 0f735a3

Browse files
authored
fix: handle text overflow for long legend item labels (#92)
1 parent 4f0535a commit 0f735a3

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

pages/03-core/core-line-chart.page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ const dataC = baseline.map(({ x, y }) => ({ x, y: y === null ? null : y + random
6060

6161
const series: Highcharts.SeriesOptionsType[] = [
6262
{
63-
name: "A",
63+
name: "Very Long Series Name for Network Traffic Analysis Data Points",
6464
type: "line",
6565
data: dataA,
6666
},
6767
{
68-
name: "B",
68+
name: "Extremely Detailed Performance Metrics for Cloud Infrastructure",
6969
type: "line",
7070
data: dataB,
7171
},
7272
{
73-
name: "C",
73+
name: "Comprehensive System Resource Utilization Measurements Over Time",
7474
type: "line",
7575
data: dataC,
7676
},

src/internal/components/chart-legend/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ const LegendItemTrigger = forwardRef(
421421
onKeyDown={onKeyDown}
422422
>
423423
{marker}
424-
<span>{label}</span>
424+
<span className={styles["item-label"]}>{label}</span>
425425
</button>
426426
);
427427
},

src/internal/components/chart-legend/styles.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
background-color: transparent;
7474
cursor: pointer;
7575
opacity: 1;
76+
max-inline-size: 100%;
7677

7778
&:focus {
7879
outline: none;
@@ -94,6 +95,14 @@
9495
}
9596
}
9697

98+
.item-label {
99+
overflow: hidden;
100+
display: -webkit-box;
101+
line-clamp: 1;
102+
-webkit-line-clamp: 1;
103+
-webkit-box-orient: vertical;
104+
}
105+
97106
.actions {
98107
display: flex;
99108
align-items: center;

0 commit comments

Comments
 (0)