#8611 QtChart : Improve time axis grid intervals

Use QCatetoryAxis to display date labels
Use Qwt label formatting and scale dividing tools to produce text labels
This commit is contained in:
Magne Sjaastad 2022-03-09 10:20:55 +01:00 committed by Kristian Bendiksen
parent 721ba508de
commit ceecf2e54c
6 changed files with 283 additions and 67 deletions

View File

@ -99,6 +99,7 @@ set(SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RiuFileDialogTools.h
${CMAKE_CURRENT_LIST_DIR}/RiuGuiTheme.h
${CMAKE_CURRENT_LIST_DIR}/RiuQssSyntaxHighlighter.h
${CMAKE_CURRENT_LIST_DIR}/RiuQwtDateScaleWrapper.h
)
set(SOURCE_GROUP_SOURCE_FILES
@ -199,6 +200,7 @@ set(SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RiuQssSyntaxHighlighter.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuTextEditWithCompletion.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuTextContentFrame.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuQwtDateScaleWrapper.cpp
)
if(RESINSIGHT_USE_QT_CHARTS)

View File

@ -31,12 +31,13 @@
#include "RiuPlotWidget.h"
#include "RiuQtChartView.h"
#include "RiuQtChartsPlotCurve.h"
#include "RiuQwtDateScaleWrapper.h"
#include "cafAssert.h"
#include "cvfTrace.h"
#include <QDateTimeAxis>
#include <QCategoryAxis>
#include <QGraphicsLayout>
#include <QLogValueAxis>
#include <QVBoxLayout>
@ -52,6 +53,7 @@ using namespace QtCharts;
//--------------------------------------------------------------------------------------------------
RiuQtChartsPlotWidget::RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget* parent )
: RiuPlotWidget( plotDefinition, parent )
, m_dateScaleWrapper( new RiuQwtDateScaleWrapper() )
{
CAF_ASSERT( m_plotDefinition );
@ -59,7 +61,7 @@ RiuQtChartsPlotWidget::RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget*
layout->setContentsMargins( 0, 0, 0, 0 );
setLayout( layout );
QtCharts::QChart* chart = new QtCharts::QChart();
QChart* chart = new QChart();
chart->layout()->setContentsMargins( 0, 0, 0, 0 );
chart->setBackgroundRoundness( 0 );
chart->setAcceptDrops( true );
@ -90,6 +92,9 @@ RiuQtChartsPlotWidget::~RiuQtChartsPlotWidget()
{
m_plotDefinition->detachAllCurves();
}
delete m_dateScaleWrapper;
m_dateScaleWrapper = nullptr;
}
//--------------------------------------------------------------------------------------------------
@ -97,6 +102,25 @@ RiuQtChartsPlotWidget::~RiuQtChartsPlotWidget()
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::axisRangeChanged()
{
auto catAxis = categoryAxis();
if ( catAxis )
{
auto min = catAxis->min();
auto max = catAxis->max();
auto existingLabels = catAxis->categoriesLabels();
for ( const auto& l : existingLabels )
{
catAxis->remove( l );
}
auto positionLabel = m_dateScaleWrapper->positionsAndLabels( min, max );
for ( auto [pos, label] : positionLabel )
{
catAxis->append( label, pos );
}
}
if ( qtChart()->isZoomed() ) emit plotZoomed();
}
@ -158,7 +182,7 @@ void RiuQtChartsPlotWidget::setAxisFontsAndAlignment( RiuPlotAxis axis,
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::setAxesFontsAndAlignment( int titleFontSize, int valueFontSize, bool titleBold, int alignment )
{
for ( auto axisTitlePair : m_axisTitles )
for ( const auto& axisTitlePair : m_axisTitles )
{
setAxisFontsAndAlignment( axisTitlePair.first, titleFontSize, valueFontSize, titleBold, alignment );
}
@ -194,9 +218,6 @@ void RiuQtChartsPlotWidget::setAxisFormat( RiuPlotAxis axis, const QString& form
auto logAxis = dynamic_cast<QLogValueAxis*>( ax );
if ( logAxis ) logAxis->setLabelFormat( format );
auto dateAxis = dynamic_cast<QDateTimeAxis*>( ax );
if ( dateAxis ) dateAxis->setFormat( format );
}
//--------------------------------------------------------------------------------------------------
@ -319,9 +340,6 @@ std::pair<double, double> RiuQtChartsPlotWidget::axisRange( RiuPlotAxis axis ) c
auto logAxis = dynamic_cast<QLogValueAxis*>( ax );
if ( logAxis ) return std::make_pair( logAxis->min(), logAxis->max() );
auto dateAxis = dynamic_cast<QDateTimeAxis*>( ax );
if ( dateAxis ) return std::make_pair( dateAxis->min().toMSecsSinceEpoch(), dateAxis->max().toMSecsSinceEpoch() );
return std::make_pair( 0.0, 1.0 );
}
@ -612,6 +630,20 @@ void RiuQtChartsPlotWidget::replot()
qtChart()->update();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QCategoryAxis* RiuQtChartsPlotWidget::categoryAxis()
{
for ( const auto& a : m_axes )
{
auto catAxis = dynamic_cast<QCategoryAxis*>( a.second );
if ( catAxis ) return catAxis;
}
return nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -624,6 +656,17 @@ void RiuQtChartsPlotWidget::updateZoomDependentCurveProperties()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::setFormatStrings( const QString& dateFormat,
const QString& timeFormat,
RiaQDateTimeTools::DateFormatComponents dateComponents,
RiaQDateTimeTools::TimeFormatComponents timeComponents )
{
m_dateScaleWrapper->setFormatStrings( dateFormat, timeFormat, dateComponents, timeComponents );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -671,8 +714,7 @@ void RiuQtChartsPlotWidget::setAxisMaxMajor( RiuPlotAxis axis, int maxMajor )
}
else
{
QDateTimeAxis* dateAxis = dynamic_cast<QDateTimeAxis*>( ax );
if ( dateAxis ) dateAxis->setTickCount( maxMajor );
m_dateScaleWrapper->setMaxMajorTicks( maxMajor );
}
}
@ -704,14 +746,7 @@ void RiuQtChartsPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale )
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::setAxisScale( RiuPlotAxis axis, double min, double max )
{
if ( axisScaleType( axis ) == RiuPlotWidget::AxisScaleType::DATE )
{
plotAxis( axis )->setRange( QDateTime::fromMSecsSinceEpoch( min ), QDateTime::fromMSecsSinceEpoch( max ) );
}
else
{
plotAxis( axis )->setRange( min, max );
}
plotAxis( axis )->setRange( min, max );
}
//--------------------------------------------------------------------------------------------------
@ -738,7 +773,9 @@ void RiuQtChartsPlotWidget::setAxisScaleType( RiuPlotAxis axis, RiuQtChartsPlotW
}
else if ( axisScaleType == AxisScaleType::DATE )
{
insertaxis = new QDateTimeAxis;
auto categoryAxis = new QCategoryAxis;
categoryAxis->setLabelsPosition( QCategoryAxis::AxisLabelsPosition::AxisLabelsPositionOnValue );
insertaxis = categoryAxis;
}
else if ( axisScaleType == AxisScaleType::LINEAR )
{
@ -780,7 +817,7 @@ RiuPlotCurve* RiuQtChartsPlotWidget::createPlotCurve( RimPlotCurve* ownerRimCurv
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QtCharts::QChart* RiuQtChartsPlotWidget::qtChart()
QChart* RiuQtChartsPlotWidget::qtChart()
{
return m_viewer->chart();
}
@ -788,18 +825,18 @@ QtCharts::QChart* RiuQtChartsPlotWidget::qtChart()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve,
QtCharts::QAbstractSeries* lineSeries,
QtCharts::QAbstractSeries* scatterSeries,
RiuPlotAxis xAxis,
RiuPlotAxis yAxis )
void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve,
QAbstractSeries* lineSeries,
QAbstractSeries* scatterSeries,
RiuPlotAxis xAxis,
RiuPlotAxis yAxis )
{
auto addToChart = [this]( std::map<RiuPlotCurve*, QtCharts::QAbstractSeries*>& curveSeriesMap,
auto plotCurve,
auto series,
auto xAxis,
auto yAxis,
RiuQtChartsPlotCurve* qtChartsPlotCurve ) {
auto addToChart = [this]( std::map<RiuPlotCurve*, QAbstractSeries*>& curveSeriesMap,
auto plotCurve,
auto series,
auto xAxis,
auto yAxis,
RiuQtChartsPlotCurve* qtChartsPlotCurve ) {
if ( !series->chart() )
{
curveSeriesMap[plotCurve] = series;
@ -826,7 +863,7 @@ void RiuQtChartsPlotWidget::detach( RiuPlotCurve* plotCurve )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QtCharts::QAbstractSeries* RiuQtChartsPlotWidget::getLineSeries( const RiuPlotCurve* plotCurve ) const
QAbstractSeries* RiuQtChartsPlotWidget::getLineSeries( const RiuPlotCurve* plotCurve ) const
{
auto series = m_lineSeriesMap.find( const_cast<RiuPlotCurve*>( plotCurve ) );
if ( series != m_lineSeriesMap.end() )
@ -838,7 +875,7 @@ QtCharts::QAbstractSeries* RiuQtChartsPlotWidget::getLineSeries( const RiuPlotCu
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QtCharts::QAbstractSeries* RiuQtChartsPlotWidget::getScatterSeries( const RiuPlotCurve* plotCurve ) const
QAbstractSeries* RiuQtChartsPlotWidget::getScatterSeries( const RiuPlotCurve* plotCurve ) const
{
auto series = m_scatterSeriesMap.find( const_cast<RiuPlotCurve*>( plotCurve ) );
if ( series != m_scatterSeriesMap.end() )
@ -869,7 +906,7 @@ void RiuQtChartsPlotWidget::detachItems( RiuPlotWidget::PlotItemType plotItemTyp
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve )
void RiuQtChartsPlotWidget::setXAxis( RiuPlotAxis axis, QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve )
{
attachSeriesToAxis( axis, series, plotCurve );
}
@ -877,7 +914,7 @@ void RiuQtChartsPlotWidget::setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSerie
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve )
void RiuQtChartsPlotWidget::setYAxis( RiuPlotAxis axis, QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve )
{
attachSeriesToAxis( axis, series, plotCurve );
}
@ -896,9 +933,7 @@ void RiuQtChartsPlotWidget::ensureAxisIsCreated( RiuPlotAxis axis )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::attachSeriesToAxis( RiuPlotAxis axis,
QtCharts::QAbstractSeries* series,
RiuQtChartsPlotCurve* plotCurve )
void RiuQtChartsPlotWidget::attachSeriesToAxis( RiuPlotAxis axis, QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve )
{
// Make sure the axis we are about to set exists.
ensureAxisIsCreated( axis );
@ -930,22 +965,6 @@ void RiuQtChartsPlotWidget::attachSeriesToAxis( RiuPlotAxis axis,
Qt::UniqueConnection );
}
}
else if ( qobject_cast<QDateTimeAxis*>( newAxis ) )
{
connect( newAxis,
SIGNAL( rangeChanged( QDateTime, QDateTime ) ),
this,
SLOT( axisRangeChanged() ),
Qt::UniqueConnection );
if ( plotCurve )
{
connect( newAxis,
SIGNAL( rangeChanged( QDateTime, QDateTime ) ),
plotCurve,
SLOT( axisRangeChanged() ),
Qt::UniqueConnection );
}
}
}
}
@ -954,7 +973,7 @@ void RiuQtChartsPlotWidget::attachSeriesToAxis( RiuPlotAxis axis,
//--------------------------------------------------------------------------------------------------
void RiuQtChartsPlotWidget::addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool isAutoScale )
{
QValueAxis* axis = new QValueAxis();
auto* axis = new QValueAxis();
qtChart()->addAxis( axis, mapPlotAxisToQtAlignment( plotAxis.axis() ) );
m_axes[plotAxis] = axis;
m_axesEnabled[plotAxis] = isEnabled;
@ -967,7 +986,7 @@ void RiuQtChartsPlotWidget::addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool
RiuPlotAxis RiuQtChartsPlotWidget::createNextPlotAxis( RiaDefines::PlotAxis axis )
{
int minIdx = -1;
for ( auto a : m_axes )
for ( const auto& a : m_axes )
{
if ( a.first.axis() == axis )
{
@ -1009,18 +1028,12 @@ void RiuQtChartsPlotWidget::rescaleAxis( RiuPlotAxis axis )
QVector<QPointF> points;
for ( auto attachedAxis : attachedAxes )
{
QValueAxis* valueAxis = dynamic_cast<QValueAxis*>( attachedAxis );
auto* valueAxis = dynamic_cast<QValueAxis*>( attachedAxis );
if ( valueAxis && valueAxis->orientation() == orr && dynamic_cast<QLineSeries*>( series ) )
{
points = dynamic_cast<QLineSeries*>( series )->pointsVector();
}
QDateTimeAxis* dateTimeAxis = dynamic_cast<QDateTimeAxis*>( attachedAxis );
if ( dateTimeAxis && dateTimeAxis->orientation() == orr && dynamic_cast<QLineSeries*>( series ) )
{
points = dynamic_cast<QLineSeries*>( series )->pointsVector();
}
for ( auto p : points )
{
if ( orr == Qt::Orientation::Horizontal )
@ -1041,9 +1054,26 @@ void RiuQtChartsPlotWidget::rescaleAxis( RiuPlotAxis axis )
// Block signals to avoid triggering RimSummaryPlot::onPlotZoomed
pAxis->blockSignals( true );
if ( axisScaleType( axis ) == RiuPlotWidget::AxisScaleType::DATE )
if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
{
pAxis->setRange( QDateTime::fromMSecsSinceEpoch( min ), QDateTime::fromMSecsSinceEpoch( max ) );
auto catAxis = categoryAxis();
if ( catAxis )
{
auto existingLabels = catAxis->categoriesLabels();
for ( const auto& l : existingLabels )
{
catAxis->remove( l );
}
auto [adjustedMin, adjustedMax, tickCount] = m_dateScaleWrapper->adjustedRange( min, max );
catAxis->setRange( adjustedMin, adjustedMax );
auto positionLabel = m_dateScaleWrapper->positionsAndLabels( adjustedMin, adjustedMax );
for ( auto [pos, label] : positionLabel )
{
catAxis->append( label, pos );
}
}
}
else
{

View File

@ -21,6 +21,7 @@
#include "RiaDefines.h"
#include "RiaPlotDefines.h"
#include "RiaQDateTimeTools.h"
#include "RiuPlotWidget.h"
@ -41,6 +42,7 @@ class QLabel;
class QPainter;
class QPaintDevice;
class QWheelEvent;
class RiuQwtDateScaleWrapper;
namespace QtCharts
{
@ -49,6 +51,7 @@ class QChart;
class QAbstractSeries;
class QAbstractAxis;
class QChartView;
class QCategoryAxis;
}; // namespace QtCharts
//==================================================================================================
@ -178,6 +181,11 @@ public:
void updateZoomDependentCurveProperties() override;
void setFormatStrings( const QString& dateFormat,
const QString& timeFormat,
RiaQDateTimeTools::DateFormatComponents dateComponents,
RiaQDateTimeTools::TimeFormatComponents timeComponents );
protected:
void attachSeriesToAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve );
@ -215,6 +223,9 @@ private:
static int defaultMinimumWidth();
void replot() override;
QtCharts::QCategoryAxis* categoryAxis();
private:
QPointer<QtCharts::QChartView> m_viewer;
std::map<RiuPlotAxis, QtCharts::QAbstractAxis*> m_axes;
@ -223,4 +234,6 @@ private:
std::map<RiuPlotCurve*, QtCharts::QAbstractSeries*> m_lineSeriesMap;
std::map<RiuPlotCurve*, QtCharts::QAbstractSeries*> m_scatterSeriesMap;
RiuQwtDateScaleWrapper* m_dateScaleWrapper;
};

View File

@ -0,0 +1,126 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RiuQwtDateScaleWrapper.h"
#include "RiuQwtPlotTools.h"
#include <set>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuQwtDateScaleWrapper::RiuQwtDateScaleWrapper()
: m_scaleEngine( Qt::UTC )
, m_maxMajorTicks( 7 )
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtDateScaleWrapper::setFormatStrings( const QString& dateFormat,
const QString& timeFormat,
RiaQDateTimeTools::DateFormatComponents dateComponents,
RiaQDateTimeTools::TimeFormatComponents timeComponents )
{
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 )
{
m_scaleDraw.setDateFormat( interval,
RiuQwtPlotTools::dateTimeFormatForInterval( interval,
dateFormat,
timeFormat,
dateComponents,
timeComponents ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtDateScaleWrapper::setMaxMajorTicks( int tickCount )
{
m_maxMajorTicks = tickCount;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::tuple<double, double, int> RiuQwtDateScaleWrapper::adjustedRange( const double& min, const double& max ) const
{
double stepSize = 0.0;
double adjustedMin = min;
double adjustedMax = max;
m_scaleEngine.autoScale( m_maxMajorTicks, adjustedMin, adjustedMax, stepSize );
auto scaleDiv = m_scaleEngine.divideScale( adjustedMin, adjustedMax, m_maxMajorTicks, 0 );
auto ticks = scaleDiv.ticks( QwtScaleDiv::MajorTick );
return { adjustedMin, adjustedMax, ticks.size() - 1 };
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiuQwtDateScaleWrapper::formatStringForRange( const QDateTime& min, const QDateTime& max )
{
auto intervalType = m_scaleEngine.intervalType( min, max, m_maxMajorTicks );
auto dateFormat = m_scaleDraw.dateFormat( intervalType );
return dateFormat;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<std::pair<double, QString>> RiuQwtDateScaleWrapper::positionsAndLabels( const double& min, const double& max )
{
double stepSize = 0.0;
double adjustedMin = min;
double adjustedMax = max;
m_scaleEngine.autoScale( m_maxMajorTicks, adjustedMin, adjustedMax, stepSize );
auto scaleDiv = m_scaleEngine.divideScale( adjustedMin, adjustedMax, m_maxMajorTicks, 0 );
auto ticks = scaleDiv.ticks( QwtScaleDiv::MajorTick );
m_scaleDraw.setScaleDiv( scaleDiv );
auto formatString =
formatStringForRange( QDateTime::fromMSecsSinceEpoch( min ), QDateTime::fromMSecsSinceEpoch( max ) );
std::vector<std::pair<double, QString>> valueAndLabel;
for ( auto t : ticks )
{
auto qwtLabel = m_scaleDraw.label( t );
auto labelText = QDateTime::fromMSecsSinceEpoch( t ).toString( formatString );
valueAndLabel.emplace_back( t, labelText );
}
return valueAndLabel;
}

View File

@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2022 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 "RiaQDateTimeTools.h"
#include <qwt_date_scale_draw.h>
#include <qwt_date_scale_engine.h>
class RiuQwtDateScaleWrapper
{
public:
RiuQwtDateScaleWrapper();
void setFormatStrings( const QString& dateFormat,
const QString& timeFormat,
RiaQDateTimeTools::DateFormatComponents dateComponents,
RiaQDateTimeTools::TimeFormatComponents timeComponents );
void setMaxMajorTicks( int tickCount );
QString formatStringForRange( const QDateTime& min, const QDateTime& max );
std::tuple<double, double, int> adjustedRange( const double& min, const double& max ) const;
std::vector<std::pair<double, QString>> positionsAndLabels( const double& min, const double& max );
private:
QwtDateScaleDraw m_scaleDraw;
QwtDateScaleEngine m_scaleEngine;
int m_maxMajorTicks;
};

View File

@ -62,7 +62,7 @@ void RiuSummaryQtChartsPlot::useDateBasedTimeAxis( const QString&
RiaQDateTimeTools::TimeFormatComponents timeComponents )
{
m_plotWidget->setAxisScaleType( RiuPlotAxis::defaultBottom(), RiuPlotWidget::AxisScaleType::DATE );
RiuQtChartsPlotTools::enableDateBasedBottomXAxis( m_plotWidget, dateFormat, timeFormat, dateComponents, timeComponents );
m_plotWidget->setFormatStrings( dateFormat, timeFormat, dateComponents, timeComponents );
}
//--------------------------------------------------------------------------------------------------