Skip to content

Commit

Permalink
🔨 remove duplicate type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Jan 13, 2025
1 parent 112a9c6 commit 73e796d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { select } from "d3-selection"
import { easeLinear } from "d3-ease"
import { DualAxisComponent } from "../axis/AxisViews"
import { DualAxis, HorizontalAxis, VerticalAxis } from "../axis/Axis"
import { LineLegend, LineLabelSeries } from "../lineLegend/LineLegend"
import { LineLegend } from "../lineLegend/LineLegend"
import { ComparisonLine } from "../scatterCharts/ComparisonLine"
import { TooltipFooterIcon } from "../tooltip/TooltipProps.js"
import {
Expand Down Expand Up @@ -115,6 +115,7 @@ import {
getSeriesName,
} from "./LineChartHelpers"
import { FocusArray } from "../focus/FocusArray.js"
import { LineLabelSeries } from "../lineLegend/LineLegendTypes"

const LINE_CHART_CLASS_NAME = "LineChart"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import { PartialBy } from "@ourworldindata/utils"
import { AxisConfig } from "../axis/AxisConfig"
import { LineLabelSeries, LineLegend } from "./LineLegend"
import { LineLegend } from "./LineLegend"
import { LEGEND_ITEM_MIN_SPACING } from "./LineLegendConstants"
import { LineLabelSeries } from "./LineLegendTypes"

const makeAxis = ({
min = 0,
Expand Down
32 changes: 1 addition & 31 deletions packages/@ourworldindata/grapher/src/lineLegend/LineLegend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ import { VerticalAxis } from "../axis/Axis"
import {
Color,
EntityName,
InteractionState,
SeriesName,
VerticalAlign,
} from "@ourworldindata/types"
import { BASE_FONT_SIZE, GRAPHER_FONT_SCALE_12 } from "../core/GrapherConstants"
import { ChartSeries } from "../chart/ChartInterface"
import { darkenColorForText } from "../color/ColorUtils"
import { AxisConfig } from "../axis/AxisConfig.js"
import { GRAPHER_BACKGROUND_DEFAULT, GRAY_30 } from "../color/ColorConstants"
Expand All @@ -40,35 +38,7 @@ import {
NON_FOCUSED_TEXT_COLOR,
} from "./LineLegendConstants.js"
import { getSeriesKey } from "./LineLegendHelpers"

export interface LineLabelSeries extends ChartSeries {
label: string
yValue: number
annotation?: string
formattedValue?: string
placeFormattedValueInNewLine?: boolean
yRange?: [number, number]
hover?: InteractionState
focus?: InteractionState
}

interface SizedSeries extends LineLabelSeries {
textWrap: TextWrap | MarkdownTextWrap
textWrapForRendering: TextWrap | MarkdownTextWrap
annotationTextWrap?: TextWrap
width: number
height: number
fontWeight?: number
}

interface PlacedSeries extends SizedSeries {
origBounds: Bounds
bounds: Bounds
repositions: number
level: number
totalLevels: number
midY: number
}
import { LineLabelSeries, PlacedSeries, SizedSeries } from "./LineLegendTypes"

function groupBounds(group: PlacedSeries[]): Bounds {
const first = group[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,7 @@ import { NoDataSection } from "../scatterCharts/NoDataSection"
import { CategoricalColorAssigner } from "../color/CategoricalColorAssigner"
import { ColorScheme } from "../color/ColorScheme"
import { ColorSchemes } from "../color/ColorSchemes"
import {
LineLabelSeries,
LineLegend,
LineLegendProps,
} from "../lineLegend/LineLegend"
import { LineLegend, LineLegendProps } from "../lineLegend/LineLegend"
import {
makeTooltipRoundingNotice,
makeTooltipToleranceNotice,
Expand All @@ -94,6 +90,7 @@ import {
GRAPHER_DARK_TEXT,
} from "../color/ColorConstants"
import { FocusArray } from "../focus/FocusArray"
import { LineLabelSeries } from "../lineLegend/LineLegendTypes"

type SVGMouseOrTouchEvent =
| React.MouseEvent<SVGGElement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
import { observer } from "mobx-react"
import { DualAxisComponent } from "../axis/AxisViews"
import { DualAxis } from "../axis/Axis"
import { LineLabelSeries, LineLegend } from "../lineLegend/LineLegend"
import { LineLegend } from "../lineLegend/LineLegend"
import { NoDataModal } from "../noDataModal/NoDataModal"
import { TooltipFooterIcon } from "../tooltip/TooltipProps.js"
import {
Expand Down Expand Up @@ -57,6 +57,7 @@ import {
} from "../chart/ChartUtils"
import { bind } from "decko"
import { AxisConfig } from "../axis/AxisConfig.js"
import { LineLabelSeries } from "../lineLegend/LineLegendTypes"

interface AreasProps extends React.SVGAttributes<SVGGElement> {
dualAxis: DualAxis
Expand Down

0 comments on commit 73e796d

Please sign in to comment.