I have implemented a line graph using QchartView. Capture.jpg
However, I would like to highlight a specific section of only the green line graph.
Any suggestions?
// Actual hit-ratio
QLineSeries *seriesData = new QLineSeries();
for(int i=0; i<timeWindowHR.size(); i++){
int xFirstPoint = timeWinXCoor[i];
int yFirstPoint = timeWindowHR[i];
seriesData->append(xFirstPoint, yFirstPoint);
int xSecondPoint = timeWinXCoor[i+1];
int ySecondPoint = timeWindowHR[i];
seriesData->append(xSecondPoint, ySecondPoint);
}
QPen pen
((Qt
::darkGreen));
pen.setWidth(2);
seriesData->setName("Actual Hit-Ratio");
seriesData->setPen(pen);
// Expected hit-ratio
QLineSeries *expectedSeries = new QLineSeries();
for(int i=0; i<expectedHR.size(); i++){
int xFirstPoint = timeWinXCoor[i];
int yFirstPoint = expectedHR[i];
expectedSeries->append(xFirstPoint, yFirstPoint);
int xSecondPoint = timeWinXCoor[i+1];
int ySecondPoint = expectedHR[i];
expectedSeries->append(xSecondPoint, ySecondPoint);
}
QPen expPen
((Qt
::darkGray));
expPen.setWidth(2);
expectedSeries->setName("Expected Hit-Ratio");
expectedSeries->setPen(expPen);
chartView->chart()->removeAllSeries();
chartView->chart()->addSeries(seriesData);
chartView->chart()->addSeries(expectedSeries);
// Actual hit-ratio
QLineSeries *seriesData = new QLineSeries();
for(int i=0; i<timeWindowHR.size(); i++){
int xFirstPoint = timeWinXCoor[i];
int yFirstPoint = timeWindowHR[i];
seriesData->append(xFirstPoint, yFirstPoint);
int xSecondPoint = timeWinXCoor[i+1];
int ySecondPoint = timeWindowHR[i];
seriesData->append(xSecondPoint, ySecondPoint);
}
QPen pen((Qt::darkGreen));
pen.setWidth(2);
seriesData->setName("Actual Hit-Ratio");
seriesData->setPen(pen);
// Expected hit-ratio
QLineSeries *expectedSeries = new QLineSeries();
for(int i=0; i<expectedHR.size(); i++){
int xFirstPoint = timeWinXCoor[i];
int yFirstPoint = expectedHR[i];
expectedSeries->append(xFirstPoint, yFirstPoint);
int xSecondPoint = timeWinXCoor[i+1];
int ySecondPoint = expectedHR[i];
expectedSeries->append(xSecondPoint, ySecondPoint);
}
QPen expPen((Qt::darkGray));
expPen.setWidth(2);
expectedSeries->setName("Expected Hit-Ratio");
expectedSeries->setPen(expPen);
chartView->chart()->removeAllSeries();
chartView->chart()->addSeries(seriesData);
chartView->chart()->addSeries(expectedSeries);
To copy to clipboard, switch view to plain text mode
Bookmarks