mirror of
https://github.com/wolfpld/tracy
synced 2025-05-03 14:03:52 +00:00
Add lousy plot values tooltip.
This commit is contained in:
parent
f32114cb35
commit
b217e6ab30
@ -1563,7 +1563,7 @@ void View::DrawZones()
|
|||||||
|
|
||||||
if( m_drawPlots )
|
if( m_drawPlots )
|
||||||
{
|
{
|
||||||
offset = DrawPlots( offset, pxns, wpos );
|
offset = DrawPlots( offset, pxns, wpos, hover );
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto scrollPos = ImGui::GetScrollY();
|
const auto scrollPos = ImGui::GetScrollY();
|
||||||
@ -2073,10 +2073,10 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
|
|||||||
return cnt;
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
int View::DrawPlots( int offset, double pxns, const ImVec2& wpos )
|
enum { PlotHeight = 100 };
|
||||||
{
|
|
||||||
enum { PlotHeight = 100 };
|
|
||||||
|
|
||||||
|
int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover )
|
||||||
|
{
|
||||||
const auto w = ImGui::GetWindowContentRegionWidth() - 1;
|
const auto w = ImGui::GetWindowContentRegionWidth() - 1;
|
||||||
const auto ty = ImGui::GetFontSize();
|
const auto ty = ImGui::GetFontSize();
|
||||||
auto draw = ImGui::GetWindowDrawList();
|
auto draw = ImGui::GetWindowDrawList();
|
||||||
@ -2121,7 +2121,7 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos )
|
|||||||
{
|
{
|
||||||
const auto x = ( it->time - m_zvStart ) * pxns;
|
const auto x = ( it->time - m_zvStart ) * pxns;
|
||||||
const auto y = PlotHeight - ( it->val - min ) * revrange * PlotHeight;
|
const auto y = PlotHeight - ( it->val - min ) * revrange * PlotHeight;
|
||||||
DrawPlotPoint( wpos, x, y, offset, 0xFF44DDDD );
|
DrawPlotPoint( wpos, x, y, offset, 0xFF44DDDD, hover, false, it->val, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
auto prev = it;
|
auto prev = it;
|
||||||
@ -2134,7 +2134,7 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos )
|
|||||||
const auto y1 = PlotHeight - ( it->val - min ) * revrange * PlotHeight;
|
const auto y1 = PlotHeight - ( it->val - min ) * revrange * PlotHeight;
|
||||||
|
|
||||||
draw->AddLine( wpos + ImVec2( x0, offset + y0 ), wpos + ImVec2( x1, offset + y1 ), 0xFF44DDDD );
|
draw->AddLine( wpos + ImVec2( x0, offset + y0 ), wpos + ImVec2( x1, offset + y1 ), 0xFF44DDDD );
|
||||||
DrawPlotPoint( wpos, x1, y1, offset, 0xFF44DDDD );
|
DrawPlotPoint( wpos, x1, y1, offset, 0xFF44DDDD, hover, true, it->val, prev->val );
|
||||||
|
|
||||||
prev = it;
|
prev = it;
|
||||||
++it;
|
++it;
|
||||||
@ -2153,10 +2153,21 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos )
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::DrawPlotPoint( const ImVec2& wpos, float x, float y, int offset, uint32_t color )
|
void View::DrawPlotPoint( const ImVec2& wpos, float x, float y, int offset, uint32_t color, bool hover, bool hasPrev, double val, double prev )
|
||||||
{
|
{
|
||||||
auto draw = ImGui::GetWindowDrawList();
|
auto draw = ImGui::GetWindowDrawList();
|
||||||
draw->AddRect( wpos + ImVec2( x - 1.5f, offset + y - 1.5f ), wpos + ImVec2( x + 2.5f, offset + y + 2.5f ), color );
|
draw->AddRect( wpos + ImVec2( x - 1.5f, offset + y - 1.5f ), wpos + ImVec2( x + 2.5f, offset + y + 2.5f ), color );
|
||||||
|
|
||||||
|
if( ImGui::IsMouseHoveringRect( wpos + ImVec2( x - 1, offset ), wpos + ImVec2( x + 1, offset + PlotHeight ) ) )
|
||||||
|
{
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
ImGui::Text( "Value: %f", val );
|
||||||
|
if( hasPrev )
|
||||||
|
{
|
||||||
|
ImGui::Text( "Change: %f", val - prev );
|
||||||
|
}
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::DrawZoneInfoWindow()
|
void View::DrawZoneInfoWindow()
|
||||||
|
@ -133,8 +133,8 @@ private:
|
|||||||
int DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth );
|
int DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth );
|
||||||
int DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, int offset, LockHighlight& highlight );
|
int DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, int offset, LockHighlight& highlight );
|
||||||
void DrawZoneInfoWindow();
|
void DrawZoneInfoWindow();
|
||||||
int DrawPlots( int offset, double pxns, const ImVec2& wpos );
|
int DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover );
|
||||||
void DrawPlotPoint( const ImVec2& wpos, float x, float y, int offset, uint32_t color );
|
void DrawPlotPoint( const ImVec2& wpos, float x, float y, int offset, uint32_t color, bool hover, bool hasPrev, double val, double prev );
|
||||||
void DrawOptions();
|
void DrawOptions();
|
||||||
|
|
||||||
void HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns );
|
void HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user