server logging: use thicker grid lines for weekends in history graph
This commit is contained in:
parent
ecc270036d
commit
f4427db93e
2 changed files with 24 additions and 7 deletions
|
@ -36,6 +36,7 @@ CHistoryGraph::CHistoryGraph() :
|
|||
iYAxisEnd ( 24 ),
|
||||
iNumTicksY ( 5 ),
|
||||
iGridFrameOffset ( 10 ),
|
||||
iGridWidthWeekend ( 4 ), // should be even
|
||||
iTextOffsetToGrid ( 3 ),
|
||||
iXAxisTextHeight ( 22 ),
|
||||
iMarkerSizeNewCon ( 11 ),
|
||||
|
@ -118,6 +119,7 @@ void CHistoryGraph::DrawFrame ( const int iNewNumTicksX )
|
|||
{
|
||||
int iBottomExtraTickLen = 0;
|
||||
const int iCurX = PlotGridFrame.x() + iXSpace * ( i + 1 );
|
||||
const QDate curXAxisDate = curDate.addDays ( i - iNumTicksX + 1 );
|
||||
|
||||
// text (print only every "iXAxisTickStep" tick)
|
||||
if ( !( i % iXAxisTickStep ) )
|
||||
|
@ -127,16 +129,30 @@ void CHistoryGraph::DrawFrame ( const int iNewNumTicksX )
|
|||
PlotPainter.drawText (
|
||||
QPoint ( iCurX - iTextOffsetX,
|
||||
PlotGridFrame.bottom() + iXAxisTextHeight + iTextOffsetToGrid ),
|
||||
curDate.addDays ( i - iNumTicksX + 1 ).toString ( "dd.MM." ) );
|
||||
curXAxisDate.toString ( "dd.MM." ) );
|
||||
|
||||
iBottomExtraTickLen = 5;
|
||||
}
|
||||
|
||||
// grid
|
||||
// grid (different grid width for weekends)
|
||||
if ( ( curXAxisDate.dayOfWeek() == 6 ) ||
|
||||
( curXAxisDate.dayOfWeek() == 7 ) )
|
||||
{
|
||||
const int iGridWidthWeekendHalf = iGridWidthWeekend / 2;
|
||||
|
||||
PlotPainter.setPen ( QPen ( PlotGridColor, iGridWidthWeekend ) );
|
||||
PlotPainter.drawLine ( iCurX, 1 + PlotGridFrame.y() + iGridWidthWeekendHalf,
|
||||
iCurX, PlotGridFrame.bottom() - iGridWidthWeekendHalf + 1 +
|
||||
iBottomExtraTickLen );
|
||||
}
|
||||
else
|
||||
{
|
||||
// regular grid
|
||||
PlotPainter.setPen ( PlotGridColor );
|
||||
PlotPainter.drawLine ( iCurX, PlotGridFrame.y(),
|
||||
PlotPainter.drawLine ( iCurX, 1 + PlotGridFrame.y(),
|
||||
iCurX, PlotGridFrame.bottom() + iBottomExtraTickLen );
|
||||
}
|
||||
}
|
||||
|
||||
// grid (ticks) for y-axis, draw iNumTicksY - 2 grid lines and
|
||||
// iNumTicksY - 1 text labels (the lowest grid line is the grid frame)
|
||||
|
|
|
@ -76,6 +76,7 @@ protected:
|
|||
int iNumTicksX;
|
||||
int iNumTicksY;
|
||||
int iGridFrameOffset;
|
||||
int iGridWidthWeekend;
|
||||
int iTextOffsetToGrid;
|
||||
int iTextOffsetX;
|
||||
int iXAxisTextHeight;
|
||||
|
|
Loading…
Reference in a new issue