Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grapher redesign updates (iv) #2716

Merged
merged 4 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/@ourworldindata/grapher/src/controls/ChartIcons.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from "react"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome/index.js"
import {
faChartBar,
faChartLine,
faChartColumn,
faEarthAmericas,
Expand All @@ -14,9 +15,7 @@ export const chartIcons: Record<ChartTypeName, JSX.Element> = {
// bar charts
[ChartTypeName.DiscreteBar]: <FontAwesomeIcon icon={faChartColumn} />,
[ChartTypeName.StackedBar]: <FontAwesomeIcon icon={faChartColumn} />,
[ChartTypeName.StackedDiscreteBar]: (
<FontAwesomeIcon icon={faChartColumn} />
),
[ChartTypeName.StackedDiscreteBar]: <FontAwesomeIcon icon={faChartBar} />,

// world map
[ChartTypeName.WorldMap]: <FontAwesomeIcon icon={faEarthAmericas} />,
Expand Down
10 changes: 6 additions & 4 deletions packages/@ourworldindata/grapher/src/controls/Checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,20 @@
content: " ";
width: $checkbox-size;
height: $checkbox-size;

background: white;
pointer-events: none;
border-radius: 2px;
border: 1px solid $light-stroke;
color: $dark-text;

display: flex;
align-items: center;
justify-content: center;

svg {
font-size: 10px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding-left: 1px;
color: $active-text;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,24 @@ export class FacetYDomainToggle extends React.Component<{
manager: FacetYDomainToggleManager
}> {
@action.bound onToggle(): void {
this.props.manager.yAxis!.facetDomain = this.isYDomainShared
? FacetAxisDomain.independent
: FacetAxisDomain.shared
const { yAxis } = this.props.manager
if (yAxis) {
yAxis.facetDomain = this.isYDomainShared
? FacetAxisDomain.independent
: FacetAxisDomain.shared
}
}

@computed get isYDomainShared(): boolean {
const facetDomain =
this.props.manager.yAxis!.facetDomain || FacetAxisDomain.shared
const { yAxis } = this.props.manager
const facetDomain = yAxis?.facetDomain || FacetAxisDomain.shared
return facetDomain === FacetAxisDomain.shared
}

render(): JSX.Element | null {
if (this.props.manager.facetStrategy === "none") return null
const { yAxis, facetStrategy } = this.props.manager
if (!yAxis || facetStrategy === "none") return null

return (
<LabeledSwitch
label="Align axis scales"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ZoomToggle extends React.Component<{
return (
<LabeledSwitch
label="Zoom to selection"
tooltip="Scale axes to show only the currently highlighted data points."
tooltip="Scale axes to focus on the currently highlighted data points."
value={this.props.manager.zoomToSelection}
onToggle={this.onToggle}
/>
Expand Down
Loading