mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-11 21:08:36 +03:00
Display category labels
This commit is contained in:
@@ -227,8 +227,8 @@ Stop and start the development process in terminal after you have added your tok
|
||||
// categories.sort((a, b) => {
|
||||
// return (+a.slice(-2) > +b.slice(-2));
|
||||
// });
|
||||
categories.forEach(group => {
|
||||
eventCount[group] = 0
|
||||
categories.forEach(cat => {
|
||||
eventCount[cat.category] = 0
|
||||
});
|
||||
|
||||
location.events.forEach((event) => {;
|
||||
@@ -239,9 +239,9 @@ Stop and start the development process in terminal after you have added your tok
|
||||
const events = [];
|
||||
|
||||
while (i < categories.length) {
|
||||
let _eventsCount = eventCount[categories[i]];
|
||||
let _eventsCount = eventCount[categories[i].category];
|
||||
for (let j = i + 1; j < categories.length; j++) {
|
||||
_eventsCount += eventCount[categories[j]];
|
||||
_eventsCount += eventCount[categories[j].category];
|
||||
}
|
||||
events.push(_eventsCount);
|
||||
i++;
|
||||
|
||||
@@ -513,7 +513,7 @@ export default function(app, ui, methods) {
|
||||
|
||||
axis.y =
|
||||
d3.axisLeft(scale.y)
|
||||
.tickValues(categories);
|
||||
.tickValues(categories.map(c => c.category));
|
||||
}
|
||||
|
||||
function update(domain, app) {
|
||||
|
||||
@@ -155,26 +155,9 @@ export const selectLocations = createSelector(
|
||||
*/
|
||||
export const selectCategories = createSelector(
|
||||
[getCategories],
|
||||
(categories) => {
|
||||
return Object.values(categories);
|
||||
}
|
||||
(categories) => categories
|
||||
);
|
||||
|
||||
/**
|
||||
* Return categories by group
|
||||
*/
|
||||
export const selectCategoryGroups = createSelector(
|
||||
[selectCategories],
|
||||
(categories) => {
|
||||
const groups = {};
|
||||
categories.forEach((cat) => {
|
||||
if (cat.group && !groups[cat.group]) {
|
||||
groups[cat.group] = cat.group_label;
|
||||
}
|
||||
});
|
||||
return Object.keys(groups).concat(['other']);
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Given a tree of tags, return those tags as a list
|
||||
|
||||
Reference in New Issue
Block a user