ResInsight/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.h
Magne Sjaastad 9a6e37a2f9
Adjustments for release
* #9681 Disable auto plot title check box when typing a custom name
The Auto Plot Title check box is not possible to click on using the mouse. A useful workaround is to disable the check box when the user enter a custom name in the name field.

* #10361 Make sure all objects change color when selecting curve color
Add support for direct change of all selected curve objects when changing color

* Use title as first field in group to avoid Qt checkbox not reacting to mouse click

* #9681 Disable auto name when name is changed in sub plot

* #10344 Surfaces: Add option to exclude inactive cells

* #10369 Use one color for bars in tornado plot

* Update license info
2023-06-09 14:09:08 +02:00

95 lines
3.1 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2020 Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <QColor>
#include <QPointF>
#include <QString>
#include <QVector>
#include <limits>
#include <map>
#include <set>
class QwtPlot;
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
class RiuGroupedBarChartBuilder
{
public:
RiuGroupedBarChartBuilder( bool sortGroupsByMaxValueInGroup = true );
void addBarEntry( const QString& majorTickText,
const QString& midTickText,
const QString& minTickText,
const double sortValue,
const QString& legendText,
const QString& barText,
const double value );
void setBarColor( const QColor& color );
void addBarChartToPlot( QwtPlot* plot, Qt::Orientation orientation, int maxBarCount = -1 );
void setLabelFontSize( int labelPointSize );
private:
double midPoint( double v1, double v2 ) { return v1 + 0.5 * ( v2 - 1.0 - v1 ); }
void addQwtBarChart( QwtPlot* plot,
const QVector<QPointF>& posAndValue,
const QString& legendText,
const QColor& barColor,
Qt::Orientation orientation );
struct BarEntry
{
BarEntry();
BarEntry( const QString& majorTickText,
const QString& midTickText,
const QString& minTickText,
const double sortValue,
const QString& legendText,
const QString& barText,
const double value );
QString m_majTickText;
double m_majorSortValue = std::numeric_limits<double>::infinity();
QString m_midTickText;
double m_midSortValue = std::numeric_limits<double>::infinity();
QString m_minTickText;
double m_sortValue;
QString m_legendText;
QString m_barText;
double m_value;
bool operator<( const BarEntry& other ) const;
};
std::multiset<BarEntry> m_sortedBarEntries;
bool m_isSortingByMaxValueInGroups;
int m_labelPointSize;
bool m_useBarColor = false;
QColor m_barColor;
};