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

fix: show feature count in brackets for thematic layers #265

Merged
merged 7 commits into from
Nov 20, 2019
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
10 changes: 7 additions & 3 deletions src/components/classification/NumericLegendStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,18 @@ export class NumericLegendStyle extends Component {

if (dataItem !== prevDataItem) {
if (dataItem.legendSet) {
setClassification(Number(CLASSIFICATION_PREDEFINED));
setClassification(CLASSIFICATION_PREDEFINED);
setLegendSet(dataItem.legendSet);
} else {
setClassification(Number(CLASSIFICATION_EQUAL_INTERVALS));
setClassification(CLASSIFICATION_EQUAL_INTERVALS);
}
}

if (method !== prevMethod && method === CLASSIFICATION_PREDEFINED) {
if (
method !== prevMethod &&
method === CLASSIFICATION_PREDEFINED &&
dataItem
) {
setLegendSet(dataItem.legendSet);
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/edit/thematic/ThematicDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export class ThematicDialog extends Component {
setEndDate(DEFAULT_END_DATE);
}

// Set default org unit level
if (!getOrgUnitLevelsFromRows(rows).length) {
setOrgUnitLevels([DEFAULT_ORG_UNIT_LEVEL]);
}
Expand All @@ -203,7 +204,7 @@ export class ThematicDialog extends Component {
onLayerValidation,
} = this.props;

if (rows) {
if (rows !== prev.rows) {
const orgUnits = getOrgUnitNodesFromRows(rows);

// Load organisation unit tree path (temporary solution, as favorites don't include paths)
Expand Down
2 changes: 1 addition & 1 deletion src/components/map/ThematicLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ThematicLayer extends Layer {
labelFontWeight,
labelFontColor,
valuesByPeriod,
renderingStrategy,
renderingStrategy = 'SINGLE',
} = this.props;
const { period } = this.state;
let periodData = data;
Expand Down
12 changes: 8 additions & 4 deletions src/loaders/thematicLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ import {
} from '../util/analytics';
import { createAlert } from '../util/alerts';
import { formatLocaleDate } from '../util/time';
import { DEFAULT_RADIUS_LOW, DEFAULT_RADIUS_HIGH } from '../constants/layers';
import {
DEFAULT_RADIUS_LOW,
DEFAULT_RADIUS_HIGH,
CLASSIFICATION_PREDEFINED,
} from '../constants/layers';

const thematicLoader = async config => {
let error;
Expand Down Expand Up @@ -50,7 +54,7 @@ const thematicLoader = async config => {
radiusHigh = DEFAULT_RADIUS_HIGH,
classes,
colorScale,
renderingStrategy,
renderingStrategy = 'SINGLE',
} = config;

const isSingle = renderingStrategy === 'SINGLE';
Expand All @@ -69,7 +73,7 @@ const thematicLoader = async config => {
const dataItem = getDataItemFromColumns(columns);
const name = names[dataItem.id];
let legendSet = config.legendSet;
let method = legendSet ? 1 : config.method; // Favorites often have wrong method
let method = legendSet ? CLASSIFICATION_PREDEFINED : config.method; // Favorites often have wrong method
let alert;

if (legendSet) {
Expand Down Expand Up @@ -241,7 +245,7 @@ const loadData = async config => {
valueType,
relativePeriodDate,
aggregationType,
renderingStrategy,
renderingStrategy = 'SINGLE',
} = config;
const orgUnits = getOrgUnitsFromRows(rows);
const period = getPeriodFromFilters(filters);
Expand Down