Skip to content

Commit

Permalink
✨ (discrete bar) hide horizontal axis
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Jan 2, 2025
1 parent 9319dae commit 42f4c02
Showing 1 changed file with 3 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,9 @@ import {
BASE_FONT_SIZE,
GRAPHER_AXIS_LINE_WIDTH_THICK,
GRAPHER_AXIS_LINE_WIDTH_DEFAULT,
GRAPHER_AREA_OPACITY_DEFAULT,
GRAPHER_FONT_SCALE_12,
} from "../core/GrapherConstants"
import {
HorizontalAxisComponent,
HorizontalAxisGridLines,
HorizontalAxisZeroLine,
} from "../axis/AxisViews"
import { HorizontalAxisZeroLine } from "../axis/AxisViews"
import { NoDataModal } from "../noDataModal/NoDataModal"
import { AxisConfig, AxisManager } from "../axis/AxisConfig"
import { ColorSchemes } from "../color/ColorSchemes"
Expand Down Expand Up @@ -305,7 +300,6 @@ export class DiscreteBarChart
@computed private get innerBounds(): Bounds {
return this.boundsWithoutColorLegend
.padLeft(Math.max(this.seriesLegendWidth, this.leftValueLabelWidth))
.padBottom(this.showHorizontalAxis ? this.yAxis.height : 0)
.padRight(this.rightValueLabelWidth)
}

Expand Down Expand Up @@ -350,10 +344,6 @@ export class DiscreteBarChart
return this.barPlacements.map((b) => b.width)
}

@computed private get showHorizontalAxis(): boolean | undefined {
return this.manager.isRelativeMode
}

private d3Bars(): Selection<
BaseType,
unknown,
Expand Down Expand Up @@ -475,7 +465,6 @@ export class DiscreteBarChart
width={series.barWidth}
height={this.barHeight}
fill={barColor}
opacity={GRAPHER_AREA_OPACITY_DEFAULT}
style={{ transition: "height 200ms ease" }}
/>
)
Expand Down Expand Up @@ -504,7 +493,7 @@ export class DiscreteBarChart
}

renderChartArea(): React.ReactElement {
const { manager, boundsWithoutColorLegend, yAxis, innerBounds } = this
const { manager, yAxis, innerBounds } = this

const axisLineWidth = manager.isStaticAndSmall
? GRAPHER_AXIS_LINE_WIDTH_THICK
Expand All @@ -516,27 +505,12 @@ export class DiscreteBarChart
{this.showColorLegend && (
<HorizontalNumericColorLegend manager={this} />
)}
{this.showHorizontalAxis && (
<>
<HorizontalAxisComponent
bounds={boundsWithoutColorLegend}
axis={yAxis}
preferredAxisPosition={innerBounds.bottom}
labelColor={manager.secondaryColorInStaticCharts}
tickMarkWidth={axisLineWidth}
/>
<HorizontalAxisGridLines
horizontalAxis={yAxis}
bounds={innerBounds}
strokeWidth={axisLineWidth}
/>
</>
)}
{!this.isLogScale && (
<HorizontalAxisZeroLine
horizontalAxis={yAxis}
bounds={innerBounds}
strokeWidth={axisLineWidth}
align={HorizontalAlign.right}
/>
)}
{this.renderBars()}
Expand Down

0 comments on commit 42f4c02

Please sign in to comment.