123 const uint rwidth = 10)
125 using id_size = a60::id_size;
131 const auto width = a._M_width;
132 const double hspace((width - (a60::k::metamargin * 2)) /
hdenom);
133 const uint xstart(a60::k::metamargin + hspace + hspace);
137 const auto height = a._M_height;
138 const double vcenter(height / 2);
147 const uint agesi = a60::k::find_id_index(
"ages");
148 const umids& ages = cumulative[agesi];
152 for (
const auto& val : ages)
154 auto [ id, count ] = val;
156 if (
id.find(a60::k::playing) != string::npos)
160 maxno = std::max(maxno, count);
162 const id_size maxn = maxno * 2;
163 std::cout <<
"max n is: " << maxn << std::endl;
179 for (
const auto& val : agesvp)
181 auto [ id, count ] = val;
186 split_playing_value(
id, ageso, agesplaying);
187 for (
const string& valso : ageso)
189 for (
const string& valsp : agesplaying)
191 const string splayings = k::space + a60::k::playing + k::space;
192 const string valpflat = valso + splayings + valsp;
193 if (agesvpflat.count(valpflat))
195 auto& val = agesvpflat.at(valpflat);
199 agesvpflat.insert(make_pair(valpflat, count));
206 sized_text(obj, typol,
lsz,
"age values", a60::k::metamargin, vcenter);
211 const uint ygraphdelta = std::round(yscale * ytotalgraphspace);
214 const uint ydelta(ygraphdelta / 2);
221 using vul = a60::vul;
222 vul vsum(a60::k::age_values.size(), 0);
223 for (
const auto& val : agesvo)
225 auto [ id, count ] = val;
230 double rystart = voffstart - (rheight / 2);
232 get_metadata_style(), rwidth, rheight);
238 const auto indx = a60::k::age_value_to_multiple(
id,
true);
250 vul vpsum(a60::k::age_values.size(), 0);
253 vul vpyoffsets(a60::k::age_values.size(), 0);
254 for (
const auto& val : agesvpflat)
256 auto [ idp, count ] = val;
261 split_playing_value(idp, ageso, agesplaying);
267 for (
const string& agepv : agesplaying)
269 const auto indxp = a60::k::age_value_to_multiple(agepv,
true);
272 const auto aend = ageso.end();
273 const bool agesamep = std::find(ageso.begin(), aend, agepv) != aend;
278 vsum[indxp] += count;
283 ulong& yoffset = vpyoffsets[indxp];
285 uint yoff = vpoffstart + yoffset;
289 double rheight = normalize_v_o_r(count, 1, maxn, 10, ydelta);
290 auto rectcp = std::make_tuple(xoff, yoff + (rheight / 2));
301 for (
const string& agev : ageso)
304 style pstylage = pstyll;
305 auto klr = age_value_to_color_tint_shade(agepv);
310 const bool vback = agepv == a60::k::age_values.back();
311 const bool vfront = agepv == a60::k::age_values.front();
315 const bool strokewidenp =
false;
330 vpsum[indxp] += count;
332 const auto indx = a60::k::age_value_to_multiple(agev,
true);
340 for (
const auto& val : a60::k::age_values)
342 auto indx = a60::k::age_value_to_multiple(val,
true);
345 uint total = vsum[indx];
348 sized_text(obj, typov,
asz, std::to_string(total), xoff, yoff);
355 point_2t topstart(xoff - (rwidth / 2), ynotch);
356 point_2t topend(xoff + (rwidth / 2), ynotch);
366 for (
const auto& val : a60::k::age_values)
368 auto indx = a60::k::age_value_to_multiple(val,
true);
371 uint total = vpsum[indx];
373 sized_text(obj, typov,
asz, std::to_string(total), xoff, yoff);
377 uint avocount = std::accumulate(vsum.begin(), vsum.end(),
uint(0));
378 uint avpcount = std::accumulate(vpsum.begin(), vpsum.end(),
uint(0));
379 double playingper = double(avpcount) / (avpcount + avocount);
380 uint playingperi =
static_cast<uint>(playingper * 100);
381 string playingperstr = std::to_string(playingperi) +
"% playing";
383 const uint xsumoff = width - a60::k::metamargin;
386 sized_text(obj, typol,
lsz,
"total values found", xsumoff, vcenter);
389 sized_text(obj, typol,
asz, std::to_string(avocount), xsumoff,
391 sized_text(obj, typol,
asz, std::to_string(avpcount), xsumoff,
403 const strings& namedkeyso,
const string aggname)
406 vsids idsranked(a60::k::id_dimensions.size());
407 for (
uint index(0); index < a60::k::id_dimensions.size(); ++index)
409 sids& csids = idsranked[index];
410 const umids& cumuids = cumulative[index];
411 for (
const auto& idp : cumuids)
413 auto [ name, count ] = idp;
414 csids.insert(make_tuple(count, name));
419 serialize_metadata_aggregate(idsranked, namedkeyso, aggname);
422 const string outname = mangle_aggregate(aggname);
427 typography typot = get_metadata_typo(tsz,
true,
false);
429 auto [ width, height ] = obj.
_M_area;
430 auto xpos = width - a60::k::metamargin;
431 auto ypos = height - a60::k::metamargin;
434 string title(
"ages");
435 if (!aggname.empty())
436 title += string(a60::k::space + aggname);
440 render_metadata_aggregate_namekeys(obj, namedkeyso, xpos);
449 const string field =
"",
const string match =
"",
450 const string wfield =
"",
const string wvalue =
"")
453 const string idir = a60::io::get_run_time_resources().metadata;
454 const strings files = field.empty() ?
455 a60::io::populate_files(idir,
".json") :
456 files_with_field_matching(field, match);
458 vumids cumulative = cache_metadata(files, wfield, wvalue);
463 namedkeys = files_with_field_matching(field, match,
true);
465 namedkeys = files_with_fields_matching(files, wfield, wvalue,
true);
468 const string outname1 = mangle_metadata_aggregate(outname, field, match);
469 const string outname2 = mangle_metadata_aggregate(outname1, wfield, wvalue);