Display category labels

This commit is contained in:
Franc Camps-Febrer
2018-12-04 10:35:56 +00:00
parent 3e38a0b94b
commit 9c60dfee03
3 changed files with 6 additions and 23 deletions

View File

@@ -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++;

View File

@@ -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) {

View File

@@ -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