##// END OF EJS Templates
Handles log scales for y-axis and color scale
Alexandre Leroux -
r928:42fd5c9b7ed8
parent child
Show More
@@ -17,7 +17,7 const auto DATETIME_TICKER_FORMAT = QStringLiteral("yyyy/MM/dd \nhh:mm:ss");
17 17
18 18 /// Generates the appropriate ticker for an axis, depending on whether the axis displays time or
19 19 /// non-time data
20 QSharedPointer<QCPAxisTicker> axisTicker(bool isTimeAxis)
20 QSharedPointer<QCPAxisTicker> axisTicker(bool isTimeAxis, QCPAxis::ScaleType scaleType)
21 21 {
22 22 if (isTimeAxis) {
23 23 auto dateTicker = QSharedPointer<QCPAxisTickerDateTime>::create();
@@ -26,6 +26,9 QSharedPointer<QCPAxisTicker> axisTicker(bool isTimeAxis)
26 26
27 27 return dateTicker;
28 28 }
29 else if (scaleType == QCPAxis::stLogarithmic) {
30 return QSharedPointer<QCPAxisTickerLog>::create();
31 }
29 32 else {
30 33 // default ticker
31 34 return QSharedPointer<QCPAxisTicker>::create();
@@ -46,9 +49,14 void setAxisProperties(QCPAxis &axis, const Unit &unit,
46 49
47 50 // scale type
48 51 axis.setScaleType(scaleType);
52 if (scaleType == QCPAxis::stLogarithmic) {
53 // Scientific notation
54 axis.setNumberPrecision(0);
55 axis.setNumberFormat("eb");
56 }
49 57
50 58 // ticker (depending on the type of unit)
51 axis.setTicker(axisTicker(unit.m_TimeUnit));
59 axis.setTicker(axisTicker(unit.m_TimeUnit, scaleType));
52 60 }
53 61
54 62 /**
@@ -99,7 +107,7 struct AxisSetter<T, typename std::enable_if_t<std::is_base_of<SpectrogramSeries
99 107 dataSeries.unlock();
100 108
101 109 setAxisProperties(*plot.xAxis, xAxisUnit);
102 setAxisProperties(*plot.yAxis, yAxisUnit);
110 setAxisProperties(*plot.yAxis, yAxisUnit, QCPAxis::stLogarithmic);
103 111
104 112 // Displays color scale in plot
105 113 plot.plotLayout()->insertRow(0);
@@ -114,8 +122,7 struct AxisSetter<T, typename std::enable_if_t<std::is_base_of<SpectrogramSeries
114 122 }
115 123
116 124 // Set color scale properties
117 colorScale.setLabel(valuesUnit.m_Name);
118 colorScale.setDataScaleType(QCPAxis::stLogarithmic); // Logarithmic scale
125 setAxisProperties(*colorScale.axis(), valuesUnit, QCPAxis::stLogarithmic);
119 126 }
120 127 };
121 128
General Comments 1
Under Review
author

Auto status change to "Under Review"

You need to be logged in to leave comments. Login now