MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ plot_legend()

MAYAFLUX_API LegendSpec MayaFlux::Portal::Forma::Plot::plot_legend ( glm::vec2  origin,
std::span< const std::string >  labels,
std::span< const glm::vec3 >  colors,
float  row_h,
float  swatch_w,
glm::vec4  text_color 
)

Create a construction-free legend spec from labels and colors.

Definition at line 318 of file PlotSpec.cpp.

325{
326 const size_t n = std::min(labels.size(), colors.size());
327
328 LegendSpec spec {
329 .origin = origin,
330 .row_h = row_h,
331 .swatch_w = swatch_w,
332 .text_color = text_color,
333 };
334 spec.entries.reserve(n);
335
336 for (size_t i = 0; i < n; ++i) {
337 spec.entries.push_back(LegendEntry {
338 .label = labels[i],
339 .color = colors[i],
340 });
341 }
342
343 return spec;
344}
Construction-free vertical legend configuration.
Definition PlotSpec.hpp:107

References MayaFlux::Portal::Forma::Plot::LegendEntry::label, and MayaFlux::Portal::Forma::Plot::LegendSpec::origin.