125 const double rwidth = 10)
127 using id_size = a60::id_size;
133 const auto width = a._M_width;
134 const double hspace((width - (a60::k::metamargin * 2)) /
hdenom);
135 const uint xstart(a60::k::metamargin + hspace + hspace);
139 const auto height = a._M_height;
140 const double vcenter(height / 2);
149 const uint agesi = a60::k::find_id_index(
"ages");
150 const umids& ages = cumulative[agesi];
154 for (
const auto& val : ages)
156 auto [ id, count ] = val;
158 if (
id.find(a60::k::playing) != string::npos)
162 maxno = std::max(maxno, count);
164 const id_size maxn = maxno * 2;
165 std::cout <<
"max n is: " << maxn << std::endl;
181 for (
const auto& val : agesvp)
183 auto [ id, count ] = val;
188 split_playing_value(
id, ageso, agesplaying);
189 for (
const string& valso : ageso)
191 for (
const string& valsp : agesplaying)
193 const string splayings = k::space + a60::k::playing + k::space;
194 const string valpflat = valso + splayings + valsp;
195 if (agesvpflat.count(valpflat))
197 auto& val = agesvpflat.at(valpflat);
201 agesvpflat.insert(make_pair(valpflat, count));
208 sized_text(obj, typol,
lsz,
"age values", a60::k::metamargin, vcenter);
213 const uint ygraphdelta = std::round(yscale * ytotalgraphspace);
216 const uint ydelta(ygraphdelta / 2);
223 using vul = a60::vul;
224 vul vsum(a60::k::age_values.size(), 0);
225 for (
const auto& val : agesvo)
227 auto [ id, count ] = val;
232 double rystart = voffstart - (rheight / 2);
234 get_metadata_style(),
235 { rwidth, rheight });
242 const auto indx = a60::k::age_value_to_multiple(
id,
true);
254 vul vpsum(a60::k::age_values.size(), 0);
257 vul vpyoffsets(a60::k::age_values.size(), 0);
258 for (
const auto& val : agesvpflat)
260 auto [ idp, count ] = val;
265 split_playing_value(idp, ageso, agesplaying);
271 for (
const string& agepv : agesplaying)
273 const auto indxp = a60::k::age_value_to_multiple(agepv,
true);
276 const auto aend = ageso.end();
277 const bool agesamep = std::find(ageso.begin(), aend, agepv) != aend;
282 vsum[indxp] += count;
287 ulong& yoffset = vpyoffsets[indxp];
289 uint yoff = vpoffstart + yoffset;
293 double rheight = normalize_v_o_r(count, 1, maxn, 10, ydelta);
294 auto rectcp = std::make_tuple(xoff, yoff + (rheight / 2));
296 { rwidth, rheight });
307 for (
const string& agev : ageso)
310 style pstylage = pstyll;
311 auto klr = age_value_to_color_tint_shade(agepv);
316 const bool vback = agepv == a60::k::age_values.back();
317 const bool vfront = agepv == a60::k::age_values.front();
321 const bool strokewidenp =
false;
333 auto ln =
make_line(bstart, bend, pstylage, dashstr);
337 vpsum[indxp] += count;
339 const auto indx = a60::k::age_value_to_multiple(agev,
true);
347 for (
const auto& val : a60::k::age_values)
349 auto indx = a60::k::age_value_to_multiple(val,
true);
352 uint total = vsum[indx];
355 sized_text(obj, typov,
asz, std::to_string(total), xoff, yoff);
362 point_2t topstart(xoff - (rwidth / 2), ynotch);
363 point_2t topend(xoff + (rwidth / 2), ynotch);
368 auto ln =
make_line(topstart, topend, nstyl);
374 for (
const auto& val : a60::k::age_values)
376 auto indx = a60::k::age_value_to_multiple(val,
true);
379 uint total = vpsum[indx];
381 sized_text(obj, typov,
asz, std::to_string(total), xoff, yoff);
385 uint avocount = std::accumulate(vsum.begin(), vsum.end(),
uint(0));
386 uint avpcount = std::accumulate(vpsum.begin(), vpsum.end(),
uint(0));
387 double playingper = double(avpcount) / (avpcount + avocount);
388 uint playingperi =
static_cast<uint>(playingper * 100);
389 string playingperstr = std::to_string(playingperi) +
"% playing";
391 const uint xsumoff = width - a60::k::metamargin;
394 sized_text(obj, typol,
lsz,
"total values found", xsumoff, vcenter);
397 sized_text(obj, typol,
asz, std::to_string(avocount), xsumoff,
399 sized_text(obj, typol,
asz, std::to_string(avpcount), xsumoff,
411 const strings& namedkeyso,
const string aggname)
414 vsids idsranked(a60::k::id_dimensions.size());
415 for (
uint index(0); index < a60::k::id_dimensions.size(); ++index)
417 sids& csids = idsranked[index];
418 const umids& cumuids = cumulative[index];
419 for (
const auto& idp : cumuids)
421 auto [ name, count ] = idp;
422 csids.insert(make_tuple(count, name));
427 serialize_metadata_aggregate(idsranked, namedkeyso, aggname);
430 const string outname = mangle_aggregate(aggname);
435 typography typot = get_metadata_typo(tsz,
true,
false);
437 auto [ width, height ] = obj.
_M_area;
438 auto xpos = width - a60::k::metamargin;
439 auto ypos = height - a60::k::metamargin;
442 string title(
"ages");
443 if (!aggname.empty())
444 title += string(a60::k::space + aggname);
448 render_metadata_aggregate_namekeys(obj, namedkeyso, xpos);
457 const string field =
"",
const string match =
"",
458 const string wfield =
"",
const string wvalue =
"")
461 const string idir = a60::io::get_run_time_resources().metadata;
462 const strings files = field.empty() ?
463 a60::io::populate_files(idir,
".json") :
464 files_with_field_matching(field, match);
466 vumids cumulative = cache_metadata(files, wfield, wvalue);
471 namedkeys = files_with_field_matching(field, match,
true);
473 namedkeys = files_with_fields_matching(files, wfield, wvalue,
true);
476 const string outname1 = mangle_metadata_aggregate(outname, field, match);
477 const string outname2 = mangle_metadata_aggregate(outname1, wfield, wvalue);
486 const string aggname,
487 const string wfield =
"",
const string wvalue =
"")
489 string idir = a60::io::get_run_time_resources().metadata;
490 idir = a60::io::end_path(idir);
495 for (
const string& s: namedkeys)
496 files.push_back(idir + s +
".json");
498 vumids cumulative = cache_metadata(files, wfield, wvalue);
503 namedkeysedit = namedkeys;
506 strings namedkeys2 = files_with_fields_matching(files, wfield, wvalue,
true);
507 namedkeysedit = namedkeys2;
510 const string outname = mangle_metadata_aggregate(aggname, wfield, wvalue);