Hi,
Iam using ScrollZoomer class to zoom/out.but the problem is that when i zooom in by selecting some part of the plot the zoomer does not reflect the whole graph .The part which is below 0 does not get shown.Please help.
Hi,
Iam using ScrollZoomer class to zoom/out.but the problem is that when i zooom in by selecting some part of the plot the zoomer does not reflect the whole graph .The part which is below 0 does not get shown.Please help.
This is the code for my plotting the curves.Iam using the scrollbar .h and .cpp and scrollzoomer .h and .cpp as it is with Qwt version 5.2.0.What wrong iam doing?
plotWidget:lotWidget ( char *FileName,QWidget* parent, Qt::WFlags fl )
: QWidget ( parent, fl ), Ui::GraphPlot(){
setupUi ( this );
UploadFileSize = 0;
int i = 0;
this->posMarker = 0;
QString tStr;
grid = new QwtPlotGrid;
UploadFileSize = strlen(FileName);
this->Upload_FileName = (char *) malloc((UploadFileSize + 1)* sizeof(char));
strncpy(this->Upload_FileName,FileName,UploadFileSize);
this->Upload_FileName[UploadFileSize] = 0;
this->CurrentSelectedGraph = -1;
listWidget = new QListWidget(this);
ListItem = new QListWidgetItem;
listWidget->hide();
QString filename(this->Upload_FileName);
FileYear = filename.mid(10,4);
FileMonth =filename.mid(14,2);
FileDay = filename.mid(16,2);
FileHour = filename.mid(18,2);
FileMins = filename.mid(20,2);
FileSec = filename.mid(22,2);
FormTitle = FileYear + "-" + FileMonth + "-" + FileDay + " " + FileHour + ":" + FileMins + ":" + FileSec;
this->setWindowTitle(FormTitle);
while(i<MaxPlotCurve){
Scale[i] = 1;
OffSet[i] = 0;
indexToGraphNum[i] = -1;
ToBeDeletedTotalCurvesPlotted[i] = -1;
i++;
}
InsertItemsInListWidget();
connect(this->listWidget,SIGNAL( itemClicked( QListWidgetItem* )),this,SLOT(Slot_for_Item_Changed( QListWidgetItem*)));
connect(this->listWidget_PlotMemebers,SIGNAL( itemClicked( QListWidgetItem* )),this,SLOT(Slot_For_ItemChanged(QListWidgetItem* )));
connect(this->comboBox_DataMarker,SIGNAL(currentIndexChanged(in t)),this,SLOT(Slot_for_ComboBoxItemChanged(int)));
ZoomRectangle = NULL;
scrollzoomer = NULL;
zoomedOut = false;
marker = new QwtPlotMarker;
MarkerBrush = new QBrush(Qt::black);
PenMarker = new QPen(Qt::black,3);
size = new QSize(10,10);
sym = new QwtSymbol(QwtSymbol::Cross,*MarkerBrush,*PenMarker ,*size);
MapMarker = new QwtPlotMarker;
MapMarkerBrush = new QBrush(Qt::blue);
MapPenMarker = new QPen(Qt::blue,2);
MapMarkerSize = new QSize(10,10);
Mapsym = new QwtSymbol(QwtSymbol::Cross,*MapMarkerBrush,*MapPen Marker,*MapMarkerSize);
VerGraphMarker = new QwtPlotMarker;
this->masterCopy = ProcessFile(this->Upload_FileName);
this->displayCopy = ProcessFile(this->Upload_FileName);
this->Home_lat = this->masterCopy->Home_Lat;
this->Home_long = this->masterCopy->Home_Long;
this->attachStates = false;
this->displayStates = false;
this->setAllaDataForPlot();
connect(this->pH,SIGNAL(SendMouseEvent(QMouseEvent *)),this,SLOT(CatchMouseEventSignalFromPlot(QMouse Event *)));
PlotLatandLong();
comboBox_DataMarker->insertItem(0, "--");
}
void plotWidget:isplay_Graph(){
this->myPlot->replot();
if(scrollzoomer == NULL) {
scrollzoomer = new ScrollZoomer(this->myPlot->canvas());
scrollzoomer->setRubberBandPen(QPen(Qt::red, 2, Qt:otLine));
scrollzoomer->setTrackerPen(QPen(Qt::black));
scrollzoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::LeftButton, Qt::ControlModifier);
connect(this->scrollzoomer,SIGNAL(zoomed(const QwtDoubleRect &)),this,SLOT(IsZoomed(const QwtDoubleRect &)));
ZoomRectangle = new QwtDoubleRect(this->scrollzoomer->zoomRect());
}
this->myPlot->insertLegend(this->legend,QwtPlot::RightLegend,-1.0);
}
void plotWidget::IsZoomed(const QwtDoubleRect & rect) {
QwtPlot::Axis axID = (QwtPlot::Axis) 0;
QwtPlot::Axis axIDx = (QwtPlot::Axis) 2;
if(zoomedOut) {
this->tmpStack.pop();
this->tmpStack = scrollzoomer->zoomStack();
zoomedOut = false;
}
else {
this->tmpStack.push(rect);
this->tmpStack = scrollzoomer->zoomStack();
}
scrollzoomer->rescale();
this->myPlot->setAxisAutoScale(axID);
this->myPlot->setAxisAutoScale(axIDx);
this->myPlot->setAutoReplot(true);
}
Bookmarks