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

[FLAG-844] Add tree cover density to analysis #4683

Merged
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
12 changes: 10 additions & 2 deletions components/charts/composed-chart/axis-label.jsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';

const AxisLabel = ({ label, direction }) => (
const AxisLabel = ({ label, direction, isSimple = false }) => (
<>
<foreignObject
width="100%"
height="100%"
className={`${direction}-label-container`}
>
<div className={`${direction}-label`}>
<span>{label}</span>
<span
className={cx({
'simple-mode-label': isSimple,
})}
>
{label}
</span>
</div>
</foreignObject>
</>
Expand All @@ -18,6 +25,7 @@ const AxisLabel = ({ label, direction }) => (
AxisLabel.propTypes = {
label: PropTypes.string,
direction: PropTypes.string,
isSimple: PropTypes.bool,
};

export default AxisLabel;
9 changes: 8 additions & 1 deletion components/charts/composed-chart/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ class CustomComposedChart extends PureComponent {
<div
className={cx('c-composed-chart', className, {
'overflow-x-visible': hasLabels,
'no-padding': simple,
})}
style={{
height: simple ? 110 : height || 250,
Expand Down Expand Up @@ -237,7 +238,13 @@ class CustomComposedChart extends PureComponent {
interval="preserveStartEnd"
{...xAxis}
{...(config?.xAxis?.label && {
label: <AxisLabel label={config?.xAxis?.label} direction="x" />,
label: (
<AxisLabel
label={config?.xAxis?.label}
direction="x"
isSimple={simple}
/>
),
})}
/>
{(!simple || simpleNeedsAxis) && (
Expand Down
8 changes: 8 additions & 0 deletions components/charts/composed-chart/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ $layout-breakpoint-3xl: 1536px;
overflow-x: visible !important;
}

.no-padding {
padding: 0 !important;
}

.x-label-container,
.y-label-container {
position: relative;
Expand All @@ -58,6 +62,10 @@ $layout-breakpoint-3xl: 1536px;

span {
font-size: 0.8125rem;

&.simple-mode-label {
font-size: 0.625rem !important;
}
}
}

Expand Down
1 change: 1 addition & 0 deletions components/widget/components/widget-footer/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
}

&.simple {
margin-top: 1.25rem;
font-size: rem(10px);

p {
Expand Down
2 changes: 1 addition & 1 deletion components/widgets/land-cover/tree-cover-density/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default {
types: ['country', 'wdpa', 'aoi'],
admins: ['adm0', 'adm1', 'adm2'],
large: true,
visible: ['dashboard'],
visible: ['dashboard', 'analysis'],
chartType: 'composedChart',
colors: 'density',
settingsConfig: [
Expand Down
Loading