void QvisParallelCoordinatesWidget::redrawScene(QPainter *painter) { double sceneWidth = (double)width(); double sceneHeight = (double)height(); double leftAxisX = sceneWidth * AXIS_LEFT_MARGIN; double axisSpacing = (sceneWidth*(1.0-AXIS_LEFT_MARGIN-AXIS_RIGHT_MARGIN)) / (double)(axisCount-1); double tickSpacing = (sceneHeight*(1.0-AXIS_BOTTOM_MARGIN-AXIS_TOP_MARGIN)) / (double)(TICKS_PER_AXIS+1); QBrush backgroundBrush(QColor(255,255,255)); qDrawShadePanel(painter, 0, 0, width(), height(), palette(), true, 2, &backgroundBrush); axisBottomY = (int)(sceneHeight*(1.0-AXIS_BOTTOM_MARGIN) + 0.5); axisTopY = (int)(sceneHeight*AXIS_TOP_MARGIN + 0.5); axesXPos.clear(); for (int axisNum = 0; axisNum < axisCount; axisNum++) { axesXPos.push_back((int)(leftAxisX + (double)axisNum*axisSpacing + 0.5)); } ticksYPos.clear(); for (int tickNum = 1; tickNum <= TICKS_PER_AXIS; tickNum++) { ticksYPos.push_back((int)(axisTopY + (double)tickNum*tickSpacing + 0.5)); } double axisLen = (double)(axisBottomY - axisTopY); double dashAndGapLen = axisLen / ((double)DASHES_PER_AXIS - DASH_GAP_FRACTION); double dashTopYPos = (double)axisTopY; int dashLen = (int)(dashAndGapLen * (1.0-DASH_GAP_FRACTION)); dashesTopYPos.clear(); dashesBotYPos.clear(); for (int dashNum = 0; dashNum < DASHES_PER_AXIS; dashNum++) { dashesTopYPos.push_back((int)dashTopYPos); dashesBotYPos.push_back((int)dashTopYPos + dashLen); dashTopYPos += dashAndGapLen; } dashesBotYPos[DASHES_PER_AXIS-1] = axisBottomY; drawDataCurves(painter); drawAxes(painter); drawAxisTitles(painter); }
void scigraphics::plot::replot() { if ( getDrawer() == NULL ) throw std::runtime_error( "Drawer is not initialized" ); prepareForPainting(); clearPlotArea(); drawGraphicsUnderGrid(); drawGrid(); drawGraphicsOverGrid(); drawSelections(); clearBorders(); drawAxis(); drawAxisTicks(); drawAxisLabels(); drawAxisTitles(); drawFloatRectangles(); drawZoomRectangle(); flush(); }