38 namespace population {
45 std::string
const& label,
49 std::pair<utils::SvgGradientLinear, utils::SvgGroup> color_bar
51 using namespace utils;
54 auto txt = text_template_;
58 if( ! label.empty() ) {
59 switch( text_position_ ) {
61 txt.position = SvgPoint{ 0.0, current_y_ };
63 current_y_ += text_template_.font.size + 5.0;
67 txt.position = SvgPoint{ -100.0, current_y_ };
72 auto const r =
static_cast<double>( heatmap.
cols() ) * h_scaling_;
73 txt.position = SvgPoint{ r + 10.0, current_y_ };
88 std::string matrix_bmp;
92 SvgPoint{ 0.0, current_y_ },
94 static_cast<double>( heatmap.
cols() ) * h_scaling_,
95 static_cast<double>( heatmap.
rows() ) * v_scaling_
98 img.rendering = SvgImage::ImageRendering::kPixelated;
99 document_ << std::move( img );
102 if( color_bar.second ) {
103 auto const xpos = 30.0 +
static_cast<double>( heatmap.
cols() ) * h_scaling_;
104 color_bar.second.transform.append( SvgTransform::Translate( xpos, current_y_ ));
105 document_ << std::move( color_bar.second );
106 document_.defs.push_back( color_bar.first );
109 auto const ypos = current_y_ +
static_cast<double>( heatmap.
rows() ) * v_scaling_;
111 document_ << std::move( y_axis );
116 auto const ypos = current_y_ +
static_cast<double>( heatmap.
rows() ) * v_scaling_;
119 document_ << std::move( x_axis );
123 current_y_ +=
static_cast<double>( heatmap.
rows() ) * v_scaling_;
127 current_y_ += text_template_.font.size + 5.0;
128 txt.position = SvgPoint{ 0.0, current_y_ };
136 document_.
write( target->ostream() );