mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-12-25 10:01:38 +08:00
code styling improvements
This commit is contained in:
parent
696ce11514
commit
5ad9ebdcbb
@ -51,6 +51,17 @@
|
|||||||
#define JKQTPSTATISTICS_SQRT_2PI 2.50662827463
|
#define JKQTPSTATISTICS_SQRT_2PI 2.50662827463
|
||||||
|
|
||||||
|
|
||||||
|
/*! \brief \f$ \mbox{ln}(10)=2.30258509299404568402... \f$
|
||||||
|
\ingroup jkqtptools_math_basic
|
||||||
|
|
||||||
|
*/
|
||||||
|
#ifdef M_LN10
|
||||||
|
# define JKQTPSTATISTICS_LN10 M_LN10
|
||||||
|
#else
|
||||||
|
# define JKQTPSTATISTICS_LN10 2.30258509299404568402
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/** \brief double-value NotANumber
|
/** \brief double-value NotANumber
|
||||||
* \ingroup jkqtptools_math_basic
|
* \ingroup jkqtptools_math_basic
|
||||||
*/
|
*/
|
||||||
|
@ -22,6 +22,7 @@ Copyright (c) 2008-2019 Jan W. Krieger (<jan@jkrieger.de>)
|
|||||||
|
|
||||||
|
|
||||||
#include "jkqtcommon/jkqtpstringtools.h"
|
#include "jkqtcommon/jkqtpstringtools.h"
|
||||||
|
#include "jkqtcommon/jkqtpmathtools.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
@ -216,7 +217,7 @@ std::string jkqtp_tolower(const std::string& s){
|
|||||||
double adata=fabs(data);
|
double adata=fabs(data);
|
||||||
std::string res=jkqtp_floattostr(data, past_comma, remove_trail0);
|
std::string res=jkqtp_floattostr(data, past_comma, remove_trail0);
|
||||||
|
|
||||||
long exp=static_cast<long>(floor(log(adata)/log(10.0)));
|
long exp=static_cast<long>(floor(log(adata)/JKQTPSTATISTICS_LN10));
|
||||||
if ((minNoExponent>fabs(data)) || (fabs(data)>maxNoExponent)) {
|
if ((minNoExponent>fabs(data)) || (fabs(data)>maxNoExponent)) {
|
||||||
std::string v=jkqtp_floattostr(data/pow(10.0, static_cast<double>(exp)), past_comma, remove_trail0);
|
std::string v=jkqtp_floattostr(data/pow(10.0, static_cast<double>(exp)), past_comma, remove_trail0);
|
||||||
if (v!="1" && v!="10") {
|
if (v!="1" && v!="10") {
|
||||||
@ -242,7 +243,7 @@ std::string jkqtp_tolower(const std::string& s){
|
|||||||
double adata=fabs(data);
|
double adata=fabs(data);
|
||||||
std::string res=jkqtp_floattostr(data, past_comma, remove_trail0);
|
std::string res=jkqtp_floattostr(data, past_comma, remove_trail0);
|
||||||
|
|
||||||
long exp=static_cast<long>(floor(log(adata)/log(10.0)));
|
long exp=static_cast<long>(floor(log(adata)/JKQTPSTATISTICS_LN10));
|
||||||
if ((minNoExponent<=fabs(data)) && (fabs(data)<maxNoExponent)) return res;
|
if ((minNoExponent<=fabs(data)) && (fabs(data)<maxNoExponent)) return res;
|
||||||
//if ((-past_comma<exp) && (exp<past_comma)) result= res;
|
//if ((-past_comma<exp) && (exp<past_comma)) result= res;
|
||||||
else {
|
else {
|
||||||
|
@ -397,8 +397,8 @@ class JKQTFASTPLOTTER_LIB_EXPORT JKQTFastPlotter : public QGLWidget {
|
|||||||
/** \brief return x-pixel coordinate from x coordinate */
|
/** \brief return x-pixel coordinate from x coordinate */
|
||||||
inline double x2p(double x) {
|
inline double x2p(double x) {
|
||||||
if (xAxisLog) {
|
if (xAxisLog) {
|
||||||
if (x<0) return xOffset+log(xMin/10.0)/log(10.0)*xScale;
|
if (x<0) return xOffset+log(xMin/10.0)/JKQTPSTATISTICS_LN10*xScale;
|
||||||
return xOffset+log(x)/log(10.0)*xScale;
|
return xOffset+log(x)/JKQTPSTATISTICS_LN10*xScale;
|
||||||
} else {
|
} else {
|
||||||
return xOffset+x*xScale;
|
return xOffset+x*xScale;
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@ class JKQTFASTPLOTTER_LIB_EXPORT JKQTFastPlotter : public QGLWidget {
|
|||||||
/** \brief return x coordinate coordinate from x-pixel */
|
/** \brief return x coordinate coordinate from x-pixel */
|
||||||
inline double p2x(long x) {
|
inline double p2x(long x) {
|
||||||
if (xAxisLog) {
|
if (xAxisLog) {
|
||||||
return exp(log(10.0)*(static_cast<double>(x)-xOffset)/(xScale));
|
return exp(JKQTPSTATISTICS_LN10*(static_cast<double>(x)-xOffset)/(xScale));
|
||||||
} else {
|
} else {
|
||||||
return (static_cast<double>(x)-xOffset)/(xScale);
|
return (static_cast<double>(x)-xOffset)/(xScale);
|
||||||
}
|
}
|
||||||
@ -416,8 +416,8 @@ class JKQTFASTPLOTTER_LIB_EXPORT JKQTFastPlotter : public QGLWidget {
|
|||||||
/** \brief return y-pixel coordinate from y coordinate */
|
/** \brief return y-pixel coordinate from y coordinate */
|
||||||
inline double y2p(double y) {
|
inline double y2p(double y) {
|
||||||
if (yAxisLog) {
|
if (yAxisLog) {
|
||||||
if (y<0) return yOffset-log(yMin/10.0)/log(10.0)*yScale;
|
if (y<0) return yOffset-log(yMin/10.0)/JKQTPSTATISTICS_LN10*yScale;
|
||||||
return yOffset-log(y)/log(10.0)*yScale;
|
return yOffset-log(y)/JKQTPSTATISTICS_LN10*yScale;
|
||||||
} else {
|
} else {
|
||||||
return yOffset-y*yScale;
|
return yOffset-y*yScale;
|
||||||
}
|
}
|
||||||
@ -426,7 +426,7 @@ class JKQTFASTPLOTTER_LIB_EXPORT JKQTFastPlotter : public QGLWidget {
|
|||||||
/** \brief return y coordinate coordinate from y-pixel */
|
/** \brief return y coordinate coordinate from y-pixel */
|
||||||
inline double p2y(long y) {
|
inline double p2y(long y) {
|
||||||
if (yAxisLog) {
|
if (yAxisLog) {
|
||||||
return exp(log(10.0)*(static_cast<double>(y)-yOffset)/(-1.0*yScale));
|
return exp(JKQTPSTATISTICS_LN10*(static_cast<double>(y)-yOffset)/(-1.0*yScale));
|
||||||
} else {
|
} else {
|
||||||
return (static_cast<double>(y)-yOffset)/(-1.0*yScale);
|
return (static_cast<double>(y)-yOffset)/(-1.0*yScale);
|
||||||
}
|
}
|
||||||
|
@ -479,7 +479,7 @@ void JKQTPXFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
|||||||
d=d->next;
|
d=d->next;
|
||||||
}
|
}
|
||||||
if (drawErrorPolygons) {
|
if (drawErrorPolygons) {
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpainterrpoly=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setBrush(eb);
|
painter.setBrush(eb);
|
||||||
painter.setPen(np);
|
painter.setPen(np);
|
||||||
QPolygonF poly;
|
QPolygonF poly;
|
||||||
@ -494,21 +494,21 @@ void JKQTPXFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
if (fillCurve) {
|
if (fillCurve) {
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintfillc=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setBrush(b);
|
painter.setBrush(b);
|
||||||
painter.setPen(np);
|
painter.setPen(np);
|
||||||
painter.drawPolygon(filledPolygon, Qt::OddEvenFill);
|
painter.drawPolygon(filledPolygon, Qt::OddEvenFill);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (drawLine) {
|
if (drawLine) {
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintline=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setPen(p);
|
painter.setPen(p);
|
||||||
painter.drawPolyline(linePolygon);
|
painter.drawPolyline(linePolygon);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drawErrorLines && (static_cast<bool>(errorPlotFunction))) {
|
if (drawErrorLines && (static_cast<bool>(errorPlotFunction))) {
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpainterrline=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setPen(ep);
|
painter.setPen(ep);
|
||||||
painter.drawPolyline(errorLineTop);
|
painter.drawPolyline(errorLineTop);
|
||||||
painter.drawPolyline(errorLineBottom);
|
painter.drawPolyline(errorLineBottom);
|
||||||
@ -521,7 +521,7 @@ void JKQTPXFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
|||||||
c.setHsv(fmod(c.hue()+90, 360), c.saturation(), c.value());
|
c.setHsv(fmod(c.hue()+90, 360), c.saturation(), c.value());
|
||||||
d=data;
|
d=data;
|
||||||
if (displaySamplePoints) {
|
if (displaySamplePoints) {
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintsamplepoints=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
while (d!=nullptr) {
|
while (d!=nullptr) {
|
||||||
double xv=d->x;
|
double xv=d->x;
|
||||||
double yv=d->f;
|
double yv=d->f;
|
||||||
@ -554,19 +554,43 @@ void JKQTPXFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
JKQTPYFunctionLineGraph::JKQTPYFunctionLineGraph(JKQTBasePlotter *parent):JKQTPXFunctionLineGraph(parent) {}
|
JKQTPYFunctionLineGraph::JKQTPYFunctionLineGraph(JKQTBasePlotter *parent):
|
||||||
|
JKQTPXFunctionLineGraph(parent)
|
||||||
|
{
|
||||||
|
|
||||||
JKQTPYFunctionLineGraph::JKQTPYFunctionLineGraph(JKQTPlotter *parent):JKQTPYFunctionLineGraph(parent->getPlotter()) {}
|
}
|
||||||
|
|
||||||
JKQTPYFunctionLineGraph::JKQTPYFunctionLineGraph(const jkqtpSimplePlotFunctionType &f, const QString &title, JKQTBasePlotter *parent):JKQTPXFunctionLineGraph(f, title, parent) {}
|
JKQTPYFunctionLineGraph::JKQTPYFunctionLineGraph(JKQTPlotter *parent):
|
||||||
|
JKQTPYFunctionLineGraph(parent->getPlotter())
|
||||||
|
{
|
||||||
|
|
||||||
JKQTPYFunctionLineGraph::JKQTPYFunctionLineGraph(const jkqtpSimplePlotFunctionType &f, const QString &title, JKQTPlotter *parent):JKQTPXFunctionLineGraph(f, title, parent) {}
|
}
|
||||||
|
|
||||||
|
JKQTPYFunctionLineGraph::JKQTPYFunctionLineGraph(const jkqtpSimplePlotFunctionType &f, const QString &title, JKQTBasePlotter *parent):
|
||||||
|
JKQTPXFunctionLineGraph(f, title, parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
JKQTPYFunctionLineGraph::JKQTPYFunctionLineGraph(const jkqtpSimplePlotFunctionType &f, const QString &title, JKQTPlotter *parent):
|
||||||
|
JKQTPXFunctionLineGraph(f, title, parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
JKQTPYFunctionLineGraph::JKQTPYFunctionLineGraph(jkqtpSimplePlotFunctionType &&f, const QString &title, JKQTBasePlotter *parent):JKQTPXFunctionLineGraph(std::move(f), title, parent) {}
|
JKQTPYFunctionLineGraph::JKQTPYFunctionLineGraph(jkqtpSimplePlotFunctionType &&f, const QString &title, JKQTBasePlotter *parent):
|
||||||
|
JKQTPXFunctionLineGraph(std::move(f), title, parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
JKQTPYFunctionLineGraph::JKQTPYFunctionLineGraph(jkqtpSimplePlotFunctionType &&f, const QString &title, JKQTPlotter *parent):JKQTPXFunctionLineGraph(std::move(f), title, parent) {}
|
JKQTPYFunctionLineGraph::JKQTPYFunctionLineGraph(jkqtpSimplePlotFunctionType &&f, const QString &title, JKQTPlotter *parent):
|
||||||
|
JKQTPXFunctionLineGraph(std::move(f), title, parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void JKQTPYFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
void JKQTPYFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||||
#ifdef JKQTBP_AUTOTIMER
|
#ifdef JKQTBP_AUTOTIMER
|
||||||
@ -633,7 +657,7 @@ void JKQTPYFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
|||||||
double yl2=y;
|
double yl2=y;
|
||||||
|
|
||||||
if (fillCurve) {
|
if (fillCurve) {
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintfillcurve=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setBrush(b);
|
painter.setBrush(b);
|
||||||
painter.setPen(np);
|
painter.setPen(np);
|
||||||
QPolygonF poly;
|
QPolygonF poly;
|
||||||
@ -647,7 +671,7 @@ void JKQTPYFunctionLineGraph::draw(JKQTPEnhancedPainter& painter) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (drawErrorPolygons && (static_cast<bool>(errorPlotFunction))) {
|
if (drawErrorPolygons && (static_cast<bool>(errorPlotFunction))) {
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpainterrorpoly=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setBrush(eb);
|
painter.setBrush(eb);
|
||||||
painter.setPen(np);
|
painter.setPen(np);
|
||||||
QPolygonF poly;
|
QPolygonF poly;
|
||||||
|
@ -246,7 +246,7 @@ void JKQTPFilledVerticalRangeGraph::draw(JKQTPEnhancedPainter &painter)
|
|||||||
|
|
||||||
|
|
||||||
if (drawLine) {
|
if (drawLine) {
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintline=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
|
|
||||||
if (isHighlighted()) {
|
if (isHighlighted()) {
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ void JKQTPXYParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
|
|||||||
double specSymbSize=0;
|
double specSymbSize=0;
|
||||||
bool hasSpecSymbSize=false;
|
bool hasSpecSymbSize=false;
|
||||||
{
|
{
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintinner=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
for (int iii=imin; iii<imax; iii++) {
|
for (int iii=imin; iii<imax; iii++) {
|
||||||
int i=qBound(imin, getDataIndex(iii), imax);
|
int i=qBound(imin, getDataIndex(iii), imax);
|
||||||
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
|
double xv=datastore->get(static_cast<size_t>(xColumn),static_cast<size_t>(i));
|
||||||
@ -451,7 +451,7 @@ void JKQTPXYParametrizedScatterGraph::draw(JKQTPEnhancedPainter &painter)
|
|||||||
|
|
||||||
|
|
||||||
if (lines.size()>0) {
|
if (lines.size()>0) {
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintinner=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
if (isHighlighted()) {
|
if (isHighlighted()) {
|
||||||
QPen pp=penSelection;
|
QPen pp=penSelection;
|
||||||
if (colorColumn>=0) {
|
if (colorColumn>=0) {
|
||||||
|
@ -590,7 +590,7 @@ void JKQTPGraphViolinplotStyleMixin::plotVerticalViolinplot(JKQTBasePlotter *par
|
|||||||
const double freqFactorl=1.0/fmax*fabs(xpleft-xp);
|
const double freqFactorl=1.0/fmax*fabs(xpleft-xp);
|
||||||
|
|
||||||
if (m_violinStyle==ViolinStyle::BoxViolin && NViol>1) {
|
if (m_violinStyle==ViolinStyle::BoxViolin && NViol>1) {
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintboxvio=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setPen(getLinePen(painter, parent));
|
painter.setPen(getLinePen(painter, parent));
|
||||||
painter.setBrush(getFillBrush(painter, parent));
|
painter.setBrush(getFillBrush(painter, parent));
|
||||||
|
|
||||||
@ -639,7 +639,7 @@ void JKQTPGraphViolinplotStyleMixin::plotVerticalViolinplot(JKQTBasePlotter *par
|
|||||||
pright<<QPointF(xp, violin_cat.first());
|
pright<<QPointF(xp, violin_cat.first());
|
||||||
|
|
||||||
|
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintsmoothvio=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setPen(getLinePen(painter, parent));
|
painter.setPen(getLinePen(painter, parent));
|
||||||
painter.setBrush(getFillBrush(painter, parent));
|
painter.setBrush(getFillBrush(painter, parent));
|
||||||
if (m_violinPositionMode==ViolinBoth) {
|
if (m_violinPositionMode==ViolinBoth) {
|
||||||
@ -686,7 +686,7 @@ void JKQTPGraphViolinplotStyleMixin::plotVerticalViolinplot(JKQTBasePlotter *par
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintstepvio=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setPen(getLinePen(painter, parent));
|
painter.setPen(getLinePen(painter, parent));
|
||||||
painter.setBrush(getFillBrush(painter, parent));
|
painter.setBrush(getFillBrush(painter, parent));
|
||||||
if (m_violinPositionMode==ViolinBoth) {
|
if (m_violinPositionMode==ViolinBoth) {
|
||||||
@ -773,7 +773,7 @@ void JKQTPGraphViolinplotStyleMixin::plotHorizontalViolinplot(JKQTBasePlotter *p
|
|||||||
const double freqFactorl=1.0/fmax*fabs(ypbottom-yp);
|
const double freqFactorl=1.0/fmax*fabs(ypbottom-yp);
|
||||||
|
|
||||||
if (m_violinStyle==ViolinStyle::BoxViolin && NViol>1) {
|
if (m_violinStyle==ViolinStyle::BoxViolin && NViol>1) {
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintboxvio=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setPen(getLinePen(painter, parent));
|
painter.setPen(getLinePen(painter, parent));
|
||||||
painter.setBrush(getFillBrush(painter, parent));
|
painter.setBrush(getFillBrush(painter, parent));
|
||||||
|
|
||||||
@ -822,7 +822,7 @@ void JKQTPGraphViolinplotStyleMixin::plotHorizontalViolinplot(JKQTBasePlotter *p
|
|||||||
pright<<QPointF(violin_cat.first(), yp);
|
pright<<QPointF(violin_cat.first(), yp);
|
||||||
|
|
||||||
|
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintsmoothvio=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setPen(getLinePen(painter, parent));
|
painter.setPen(getLinePen(painter, parent));
|
||||||
painter.setBrush(getFillBrush(painter, parent));
|
painter.setBrush(getFillBrush(painter, parent));
|
||||||
if (m_violinPositionMode==ViolinBoth) {
|
if (m_violinPositionMode==ViolinBoth) {
|
||||||
@ -869,7 +869,7 @@ void JKQTPGraphViolinplotStyleMixin::plotHorizontalViolinplot(JKQTBasePlotter *p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintstepvio=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setPen(getLinePen(painter, parent));
|
painter.setPen(getLinePen(painter, parent));
|
||||||
painter.setBrush(getFillBrush(painter, parent));
|
painter.setBrush(getFillBrush(painter, parent));
|
||||||
if (m_violinPositionMode==ViolinBoth) {
|
if (m_violinPositionMode==ViolinBoth) {
|
||||||
@ -955,7 +955,7 @@ void JKQTPGraphViolinplotStyleMixin::plotVerticalKeyMarker(JKQTBasePlotter *pare
|
|||||||
|
|
||||||
painter.setPen(p);
|
painter.setPen(p);
|
||||||
{
|
{
|
||||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
painter.save(); auto __finalpaintinner=JKQTPFinally([&painter]() {painter.restore();});
|
||||||
painter.setBrush(b);
|
painter.setBrush(b);
|
||||||
painter.drawPath(path);
|
painter.drawPath(path);
|
||||||
}
|
}
|
||||||
|
@ -676,8 +676,8 @@ void JKQTPCoordinateAxis::setLogAxis(bool __value)
|
|||||||
this->logAxis = __value;
|
this->logAxis = __value;
|
||||||
this->paramsChanged=true;
|
this->paramsChanged=true;
|
||||||
if (this->isLogAxis()) {
|
if (this->isLogAxis()) {
|
||||||
if (axismin<0) axismin=pow(10.0, floor(log(axismax-axismin)/log(10.0)-1.0));
|
if (axismin<0) axismin=pow(10.0, floor(log(axismax-axismin)/JKQTPSTATISTICS_LN10-1.0));
|
||||||
if (axismax<0) axismax=pow(10.0, floor(log(axismax-axismin)/log(10.0)+1.0));
|
if (axismax<0) axismax=pow(10.0, floor(log(axismax-axismin)/JKQTPSTATISTICS_LN10+1.0));
|
||||||
}
|
}
|
||||||
redrawPlot();
|
redrawPlot();
|
||||||
}
|
}
|
||||||
|
@ -729,8 +729,8 @@ size_t JKQTPDatastore::addLinearColumn(size_t rows, double start, double end, co
|
|||||||
size_t JKQTPDatastore::addLogColumn(size_t rows, double start, double end, const QString &name)
|
size_t JKQTPDatastore::addLogColumn(size_t rows, double start, double end, const QString &name)
|
||||||
{
|
{
|
||||||
JKQTPDatastoreItem* it=new JKQTPDatastoreItem(1, rows);
|
JKQTPDatastoreItem* it=new JKQTPDatastoreItem(1, rows);
|
||||||
const double x0=log(start)/log(10.0);
|
const double x0=log(start)/JKQTPSTATISTICS_LN10;
|
||||||
const double x1=log(end)/log(10.0);
|
const double x1=log(end)/JKQTPSTATISTICS_LN10;
|
||||||
for (size_t i=0; i<rows; i++) {
|
for (size_t i=0; i<rows; i++) {
|
||||||
it->set(0, i, pow(10.0, x0+static_cast<double>(i)/static_cast<double>(rows-1)*(x1-x0)));
|
it->set(0, i, pow(10.0, x0+static_cast<double>(i)/static_cast<double>(rows-1)*(x1-x0)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user