mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Moved Box shape creator to QwtPlotTools for use in correlation matrix
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "qwt_plot.h"
|
||||
#include "qwt_plot_grid.h"
|
||||
#include "qwt_plot_layout.h"
|
||||
#include "qwt_plot_shapeitem.h"
|
||||
#include "qwt_scale_widget.h"
|
||||
|
||||
#include <QRegExp>
|
||||
@@ -66,7 +67,7 @@ void RiuQwtPlotTools::setCommonPlotBehaviour( QwtPlot* plot )
|
||||
plot->setAxisFont( QwtPlot::yRight, axisFont );
|
||||
|
||||
// Axis title font
|
||||
std::vector<QwtPlot::Axis> axes = {QwtPlot::xBottom, QwtPlot::xTop, QwtPlot::yLeft, QwtPlot::yRight};
|
||||
std::vector<QwtPlot::Axis> axes = { QwtPlot::xBottom, QwtPlot::xTop, QwtPlot::yLeft, QwtPlot::yRight };
|
||||
|
||||
for ( QwtPlot::Axis axis : axes )
|
||||
{
|
||||
@@ -130,14 +131,14 @@ void RiuQwtPlotTools::enableDateBasedBottomXAxis( QwtPlot*
|
||||
{
|
||||
QwtDateScaleDraw* scaleDraw = new QwtDateScaleDraw( Qt::UTC );
|
||||
|
||||
std::set<QwtDate::IntervalType> intervals = {QwtDate::Year,
|
||||
QwtDate::Month,
|
||||
QwtDate::Week,
|
||||
QwtDate::Day,
|
||||
QwtDate::Hour,
|
||||
QwtDate::Minute,
|
||||
QwtDate::Second,
|
||||
QwtDate::Millisecond};
|
||||
std::set<QwtDate::IntervalType> intervals = { QwtDate::Year,
|
||||
QwtDate::Month,
|
||||
QwtDate::Week,
|
||||
QwtDate::Day,
|
||||
QwtDate::Hour,
|
||||
QwtDate::Minute,
|
||||
QwtDate::Second,
|
||||
QwtDate::Millisecond };
|
||||
|
||||
for ( QwtDate::IntervalType interval : intervals )
|
||||
{
|
||||
@@ -208,3 +209,30 @@ QString RiuQwtPlotTools::dateTimeFormatForInterval( QwtDate::IntervalType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QwtPlotItem* RiuQwtPlotTools::createBoxShape( const QString& label,
|
||||
double startX,
|
||||
double endX,
|
||||
double startY,
|
||||
double endY,
|
||||
QColor color,
|
||||
Qt::BrushStyle brushStyle )
|
||||
{
|
||||
QwtPlotShapeItem* columnShape = new QwtPlotShapeItem( label );
|
||||
QPolygonF polygon;
|
||||
|
||||
polygon.push_back( QPointF( startX, startY ) );
|
||||
polygon.push_back( QPointF( endX, startY ) );
|
||||
polygon.push_back( QPointF( endX, endY ) );
|
||||
polygon.push_back( QPointF( startX, endY ) );
|
||||
polygon.push_back( QPointF( startX, startY ) );
|
||||
columnShape->setPolygon( polygon );
|
||||
columnShape->setXAxis( QwtPlot::xBottom );
|
||||
columnShape->setBrush( QBrush( color, brushStyle ) );
|
||||
columnShape->setLegendMode( QwtPlotShapeItem::LegendShape );
|
||||
columnShape->setLegendIconSize( QSize( 16, 16 ) );
|
||||
return columnShape;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user