#4323 Avoid time step legend showing up unexpectedly in grid cross plots

This commit is contained in:
Gaute Lindkvist 2019-04-12 18:31:57 +02:00
parent 25d5120190
commit 1caed321b0
3 changed files with 22 additions and 20 deletions

View File

@ -58,6 +58,6 @@ void RicCreateGridCrossPlotDataSetFeature::onActionTriggered(bool isChecked)
//--------------------------------------------------------------------------------------------------
void RicCreateGridCrossPlotDataSetFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("New Data Set");
actionToSetup->setText("Create Data Set");
actionToSetup->setIcon(QIcon(":/WellLogCurve16x16.png"));
}

View File

@ -88,7 +88,7 @@ void RicCreateGridCrossPlotFeature::setupActionLook(QAction* actionToSetup)
}
else
{
actionToSetup->setText("New Grid Cross Plot");
actionToSetup->setText("Create Grid Cross Plot");
}
actionToSetup->setIcon(QIcon(":/SummaryXPlotsLight16x16.png"));
}

View File

@ -285,29 +285,31 @@ void RiuGridCrossQwtPlot::updateLegendLayout()
for (RimGridCrossPlotDataSet* dataSet : crossPlot->dataSets())
{
if (!dataSet->isChecked() || !dataSet->legendConfig()->showLegend()) continue;
auto pairIt = m_legendWidgets.find(dataSet);
if (pairIt != m_legendWidgets.end())
if (dataSet->isChecked() && dataSet->groupingEnabled() && dataSet->legendConfig()->showLegend())
{
RiuCvfOverlayItemWidget* overlayWidget = pairIt->second;
// Show only one copy of each legend type
if (!legendTypes.count(dataSet->groupParameter()))
auto pairIt = m_legendWidgets.find(dataSet);
if (pairIt != m_legendWidgets.end())
{
if (ypos + overlayWidget->height() + spacing > this->canvas()->height())
RiuCvfOverlayItemWidget* overlayWidget = pairIt->second;
// Show only one copy of each legend type
if (!legendTypes.count(dataSet->groupParameter()))
{
xpos += spacing + maxColumnWidth;
ypos = startMarginY;
maxColumnWidth = 0;
if (ypos + overlayWidget->height() + spacing > this->canvas()->height())
{
xpos += spacing + maxColumnWidth;
ypos = startMarginY;
maxColumnWidth = 0;
}
overlayWidget->show();
overlayWidget->move(xpos, ypos);
ypos += pairIt->second->height() + spacing;
maxColumnWidth = std::max(maxColumnWidth, pairIt->second->width());
legendTypes.insert(dataSet->groupParameter());
}
overlayWidget->show();
overlayWidget->move(xpos, ypos);
ypos += pairIt->second->height() + spacing;
maxColumnWidth = std::max(maxColumnWidth, pairIt->second->width());
legendTypes.insert(dataSet->groupParameter());
}
}
}