Esempio n. 1
0
PlotCurve::PlotCurve(const QString& name): QwtPlotCurve(name),
d_type(0),
d_plot_style(0),
d_x_offset(0.0),
d_y_offset(0.0)
{
    setPaintAttribute(PaintFiltered);
    setPaintAttribute(ClipPolygons);
	setCurveAttribute(QwtPlotCurve::Fitted, false);
}
Esempio n. 2
0
    Curve3()
    {
        setStyle( QwtPlotCurve::Lines );
        setPen( QColor( 100, 200, 150 ), 2 );

        QwtSplineCurveFitter* curveFitter = new QwtSplineCurveFitter();
        curveFitter->setFitMode( QwtSplineCurveFitter::ParametricSpline );
        curveFitter->setSplineSize( 200 );
        setCurveFitter( curveFitter );

        setCurveAttribute( QwtPlotCurve::Fitted, true );

        // somewhere in the top right corner
        QTransform transform;
        transform.translate( 7.0, 7.5 );
        transform.scale( 2.0, 2.0 );

        setTransformation( transform );
    }   
Esempio n. 3
0
    Curve1()
    {
        setPen( QColor( 150, 150, 200 ), 2 );
        setStyle( QwtPlotCurve::Lines );

        QwtSplineCurveFitter *curveFitter = new QwtSplineCurveFitter();
        curveFitter->setSplineSize( 150 );
        setCurveFitter( curveFitter );

        setCurveAttribute( QwtPlotCurve::Fitted, true );

        QwtSymbol *symbol = new QwtSymbol( QwtSymbol::XCross );
        symbol->setPen( Qt::yellow );
        symbol->setSize( 7 );

        setSymbol( symbol );

        // somewhere to the left
        QTransform transform;
        transform.scale( 1.5, 1.0 );
        transform.translate( 1.5, 3.0 );

        setTransformation( transform );
    }
Esempio n. 4
0
//--------------------------------------------------------------------------------------------------
/// 
//--------------------------------------------------------------------------------------------------
void RicGridStatisticsDialog::setHistogramData(RimGridView* view)
{
    deletePlotItems(m_historgramPlot);
    deletePlotItems(m_aggregatedPlot);

    if (view && view->overlayInfoConfig())
    {
        Rim3dOverlayInfoConfig* overlayInfo = view->overlayInfoConfig();

        auto hist = new QwtPlotHistogram("Histogram");
        auto aggr = new QwtPlotCurve("Aggregated");

        hist->setBrush(QBrush(QColor(Qt::darkCyan)));
        hist->setZ(-1);
        aggr->setStyle(QwtPlotCurve::Steps);
        aggr->setCurveAttribute(QwtPlotCurve::Inverted);

        Rim3dOverlayInfoConfig::HistogramData histogramData = overlayInfo->histogramData();

        if (histogramData.isValid())
        {
            QVector<QwtIntervalSample> histSamples;
            QVector<QPointF> aggrSamples;
            double xStep = (histogramData.max - histogramData.min) / (*histogramData.histogram).size();
            double xCurr = histogramData.min;
            double aggrValue = 0.0;
            for (size_t value : *histogramData.histogram)
            {
                double xNext = xCurr + xStep;
                histSamples.push_back(QwtIntervalSample(value, xCurr, xNext));

                aggrValue += value;
                aggrSamples.push_back(QPointF(xCurr, aggrValue));

                xCurr = xNext;
            }

            // Axis
            double xAxisSize = histogramData.max - histogramData.min;
            double xAxisExtension = xAxisSize * 0.02;
            m_historgramPlot->setAxisScale(QwtPlot::xBottom, histogramData.min - xAxisExtension, histogramData.max + xAxisExtension);
            m_aggregatedPlot->setAxisScale(QwtPlot::xBottom, histogramData.min - xAxisExtension, histogramData.max + xAxisExtension);

            // Set y axis label area width
            m_historgramPlot->axisScaleDraw(QwtPlot::yLeft)->setMinimumExtent(60);
            m_aggregatedPlot->axisScaleDraw(QwtPlot::yLeft)->setMinimumExtent(60);

            // Samples
            hist->setSamples(histSamples);
            aggr->setSamples(aggrSamples);
            hist->attach(m_historgramPlot);
            aggr->attach(m_aggregatedPlot);

            // Markers
            setMarkers(histogramData, m_historgramPlot);
            setMarkers(histogramData, m_aggregatedPlot);
        }
    }

    // Refresh plot
    m_historgramPlot->replot();
    m_aggregatedPlot->replot();
}