Fill area under plots.

This commit is contained in:
Bartosz Taudul 2022-07-24 12:28:47 +02:00
parent b0f484d593
commit f8115168a6
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -176,6 +176,7 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, fl
const auto color = GetPlotColor( v ); const auto color = GetPlotColor( v );
const auto bg = 0x22000000 | ( DarkenColorMore( color ) & 0xFFFFFF ); const auto bg = 0x22000000 | ( DarkenColorMore( color ) & 0xFFFFFF );
const auto fill = 0x22000000 | ( DarkenColor( color ) & 0xFFFFFF );
draw->AddRectFilled( ImVec2( 0, yPos ), ImVec2( w, yPos + PlotHeight ), bg ); draw->AddRectFilled( ImVec2( 0, yPos ), ImVec2( w, yPos + PlotHeight ), bg );
@ -258,6 +259,7 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, fl
const auto y0 = PlotHeight - ( prevy->val - min ) * revrange * PlotHeight; const auto y0 = PlotHeight - ( prevy->val - min ) * revrange * PlotHeight;
const auto y1 = PlotHeight - ( it->val - min ) * revrange * PlotHeight; const auto y1 = PlotHeight - ( it->val - min ) * revrange * PlotHeight;
draw->AddQuadFilled( dpos + ImVec2( x0, offset + PlotHeight ), dpos + ImVec2( x0, offset + y0 ), dpos + ImVec2( x1, offset + y1 ), dpos + ImVec2( x1, offset + PlotHeight ), fill );
DrawLine( draw, dpos + ImVec2( x0, offset + y0 ), dpos + ImVec2( x1, offset + y1 ), color ); DrawLine( draw, dpos + ImVec2( x0, offset + y0 ), dpos + ImVec2( x1, offset + y1 ), color );
const auto rx = skip == 0 ? 2.0 : ( skip == 1 ? 2.5 : 4.0 ); const auto rx = skip == 0 ? 2.0 : ( skip == 1 ? 2.5 : 4.0 );