some fixes, make graph look nicer

This commit is contained in:
Volker Fischer 2009-06-09 20:06:24 +00:00
parent c0cf6a9acc
commit 5f9dc603a1
2 changed files with 12 additions and 10 deletions

View File

@ -37,8 +37,9 @@ CHistoryGraph::CHistoryGraph() :
iNumTicksY ( 5 ), iNumTicksY ( 5 ),
iGridFrameOffset ( 10 ), iGridFrameOffset ( 10 ),
iTextOffsetToGrid ( 3 ), iTextOffsetToGrid ( 3 ),
iYAxisTextHeight ( 20 ), iXAxisTextHeight ( 22 ),
iMarkerSize ( 9 ), iMarkerSizeNewCon ( 11 ),
iMarkerSizeServSt ( 9 ),
AxisFont ( "Arial", 12 ), AxisFont ( "Arial", 12 ),
iTextOffsetX ( 18 ), iTextOffsetX ( 18 ),
PlotBackgroundColor ( Qt::white ), // background PlotBackgroundColor ( Qt::white ), // background
@ -51,10 +52,10 @@ CHistoryGraph::CHistoryGraph() :
PlotPixmap ( 1, 1, QImage::Format_RGB32 ) PlotPixmap ( 1, 1, QImage::Format_RGB32 )
{ {
// generate plot grid frame rectangle // generate plot grid frame rectangle
PlotGridFrame.setCoords ( PlotCanvasRect.x() + iGridFrameOffset, PlotGridFrame.setRect ( PlotCanvasRect.x() + iGridFrameOffset,
PlotCanvasRect.y() + iGridFrameOffset, PlotCanvasRect.y() + iGridFrameOffset,
PlotCanvasRect.width() - 2 * iGridFrameOffset, PlotCanvasRect.width() - 2 * iGridFrameOffset,
PlotCanvasRect.height() - 2 * iGridFrameOffset - iYAxisTextHeight ); PlotCanvasRect.height() - 2 * iGridFrameOffset - iXAxisTextHeight );
// scale pixmap to correct size // scale pixmap to correct size
PlotPixmap = PlotPixmap.scaled ( PlotPixmap = PlotPixmap.scaled (
@ -125,7 +126,7 @@ void CHistoryGraph::DrawFrame ( const int iNewNumTicksX )
PlotPainter.setFont ( AxisFont ); PlotPainter.setFont ( AxisFont );
PlotPainter.drawText ( PlotPainter.drawText (
QPoint ( iCurX - iTextOffsetX, QPoint ( iCurX - iTextOffsetX,
PlotGridFrame.bottom() + iYAxisTextHeight + iTextOffsetToGrid ), PlotGridFrame.bottom() + iXAxisTextHeight + iTextOffsetToGrid ),
curDate.addDays ( i - iNumTicksX + 1 ).toString ( "dd.MM." ) ); curDate.addDays ( i - iNumTicksX + 1 ).toString ( "dd.MM." ) );
iBottomExtraTickLen = 5; iBottomExtraTickLen = 5;
@ -196,19 +197,19 @@ void CHistoryGraph::AddMarker ( const SHistoryData& curHistoryData )
case HIT_SERVER_STOP: case HIT_SERVER_STOP:
// filled circle marker // filled circle marker
PlotPainter.setPen ( QPen ( QBrush ( PlotMarkerStopColor ), PlotPainter.setPen ( QPen ( QBrush ( PlotMarkerStopColor ),
iMarkerSize, Qt::SolidLine, Qt::RoundCap ) ); iMarkerSizeServSt, Qt::SolidLine, Qt::RoundCap ) );
break; break;
case HIT_LOCAL_CONNECTION: case HIT_LOCAL_CONNECTION:
// filled square marker // filled square marker
PlotPainter.setPen ( QPen ( QBrush ( PlotMarkerNewLocalColor ), PlotPainter.setPen ( QPen ( QBrush ( PlotMarkerNewLocalColor ),
iMarkerSize ) ); iMarkerSizeNewCon ) );
break; break;
case HIT_REMOTE_CONNECTION: case HIT_REMOTE_CONNECTION:
// filled square marker // filled square marker
PlotPainter.setPen ( QPen ( QBrush ( PlotMarkerNewColor ), PlotPainter.setPen ( QPen ( QBrush ( PlotMarkerNewColor ),
iMarkerSize ) ); iMarkerSizeNewCon ) );
break; break;
} }
PlotPainter.drawPoint ( curPoint ); PlotPainter.drawPoint ( curPoint );

View File

@ -77,8 +77,9 @@ protected:
int iGridFrameOffset; int iGridFrameOffset;
int iTextOffsetToGrid; int iTextOffsetToGrid;
int iTextOffsetX; int iTextOffsetX;
int iYAxisTextHeight; int iXAxisTextHeight;
int iMarkerSize; int iMarkerSizeNewCon;
int iMarkerSizeServSt;
int iXSpace; int iXSpace;
int iYSpace; int iYSpace;
QFont AxisFont; QFont AxisFont;