132 QPainter painter(
this);
133 painter.setRenderHint(QPainter::Antialiasing,
true);
134 painter.setRenderHint(QPainter::TextAntialiasing,
true);
135 painter.fillRect(rect(), QColor(15, 18, 23));
137 const QRectF plotRect(58.0, 24.0,
138 std::max(10.0, width() - 78.0),
139 std::max(10.0, height() - 62.0));
141 painter.setPen(QPen(QColor(78, 86, 96), 1.0));
142 for (
int i = 0; i <= 4; ++i) {
143 const double tx =
static_cast<double>(i) / 4.0;
144 const double x = plotRect.left() + tx * plotRect.width();
145 painter.drawLine(QPointF(x, plotRect.top()), QPointF(x, plotRect.bottom()));
146 const double y = plotRect.top() + tx * plotRect.height();
147 painter.drawLine(QPointF(plotRect.left(), y), QPointF(plotRect.right(), y));
150 painter.setPen(QPen(QColor(170, 180, 190), 1.0));
151 painter.drawRect(plotRect);
154 painter.setPen(QColor(190, 195, 205));
155 painter.drawText(plotRect, Qt::AlignCenter, QStringLiteral(
"No cross-section data"));
170 const auto mapX = [plotRect, xMin, xMax](
double x) {
171 const double t = (x - xMin) / std::max(1.0e-30, xMax - xMin);
172 return plotRect.left() + t * plotRect.width();
174 const auto mapY = [plotRect, yMin, yMax](
double y) {
175 const double t = (y - yMin) / std::max(1.0e-30, yMax - yMin);
176 return plotRect.bottom() - t * plotRect.height();
179 if (yMin < 0.0 && yMax > 0.0) {
180 painter.setPen(QPen(QColor(125, 130, 138), 1.0, Qt::DashLine));
181 const double y0 = mapY(0.0);
182 painter.drawLine(QPointF(plotRect.left(), y0), QPointF(plotRect.right(), y0));
187 for (std::size_t i = 1u; i < values.size(); ++i) {
190 painter.setPen(QPen(QColor(255, 200, 70), 2.0));
191 painter.drawPath(path);
193 painter.setPen(QColor(210, 215, 222));
194 painter.drawText(QRectF(plotRect.left(), 2.0, plotRect.width(), 20.0),
196 QStringLiteral(
"%1 section=%2")
200 painter.setPen(QColor(160, 168, 178));
201 painter.drawText(QRectF(2.0, plotRect.top() - 8.0, 52.0, 18.0),
202 Qt::AlignRight | Qt::AlignVCenter,
203 QString::number(yMax,
'g', 4));
204 painter.drawText(QRectF(2.0, plotRect.bottom() - 10.0, 52.0, 18.0),
205 Qt::AlignRight | Qt::AlignVCenter,
206 QString::number(yMin,
'g', 4));
207 painter.drawText(QRectF(plotRect.left(), plotRect.bottom() + 6.0, 80.0, 20.0),
209 QString::number(xMin,
'f', 2));
210 painter.drawText(QRectF(plotRect.right() - 80.0, plotRect.bottom() + 6.0, 80.0, 20.0),
212 QString::number(xMax,
'f', 2));
217 ? QStringLiteral(
"p_x") : QStringLiteral(
"p_y");
220 ? QStringLiteral(
"x") : QStringLiteral(
"y");
222 painter.drawText(QRectF(plotRect.left(), plotRect.bottom() + 4.0,
223 plotRect.width(), 24.0),