Skip to content

Commit

Permalink
fix(legacy-plugin-chart-histogram): fixes legend overflow (#863)
Browse files Browse the repository at this point in the history
* fix(legacy-plugin-chart-histogram): fixes legend onverflow

* Update plugins/legacy-plugin-chart-histogram/src/WithLegend.jsx

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>

Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com>
  • Loading branch information
2 people authored and zhaoyongjie committed Nov 26, 2021
1 parent 286255d commit e4ebd82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ class CustomHistogram extends React.PureComponent {
width={width}
height={height}
position="top"
renderLegend={({ direction }) => (
renderLegend={({ direction, style }) => (
<LegendOrdinal
style={style}
scale={colorScale}
direction={direction}
shape="rect"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,18 @@ class WithLegend extends React.Component {
flexDirection: legendDirection,
justifyContent: this.getLegendJustifyContent(),
};

const legendContainerStyle = {
flexWrap: 'wrap',
display: 'flex',
flexDirection: legendDirection,
};
return (
<div className={`with-legend ${className}`} style={style}>
<div className="legend-container" style={legendStyle}>
{renderLegend({
// Pass flexDirection for @vx/legend to arrange legend items
direction: legendDirection,
style: legendContainerStyle,
})}
</div>
<div className="main-container" style={chartStyle}>
Expand Down

0 comments on commit e4ebd82

Please sign in to comment.