mirror of
https://github.com/jkriege2/JKQtPlotter.git
synced 2024-11-15 18:15:52 +08:00
added Styling-Mix-In for boxplots
This commit is contained in:
parent
a67975e680
commit
62fc116296
@ -178,7 +178,7 @@ TestWidgetGraphs::TestWidgetGraphs(QWidget *parent) :
|
||||
plot->getPlotter()->addGraph(r2);
|
||||
|
||||
JKQTPBoxplotVerticalGraph* box=new JKQTPBoxplotVerticalGraph(plotBot2->getPlotter());
|
||||
box->setPosColumn(cbxbox);
|
||||
box->setPositionColumn(cbxbox);
|
||||
box->setMedianColumn(cbmed);
|
||||
box->setMeanColumn(cbmean);
|
||||
box->setMinColumn(cbmin);
|
||||
|
@ -32,7 +32,7 @@ After adding all necessary data to the JKQTDatastore:
|
||||
```.cpp
|
||||
// 4. create a graph of vertical boxplots:
|
||||
JKQTPBoxplotVerticalGraph* graph=new JKQTPBoxplotVerticalGraph(&plot);
|
||||
graph->setPosColumn(columnPOS);
|
||||
graph->setPositionColumn(columnPOS);
|
||||
graph->setMinColumn(columnMIN);
|
||||
graph->setPercentile25Column(columnQ25);
|
||||
graph->setMedianColumn(columnMEDIAN);
|
||||
@ -48,9 +48,9 @@ You can further style the plot by e.g. setting:
|
||||
// 4.1 make fill collor a lighter shade of the outline color
|
||||
graph->setFillColor(graphh->getColor().lighter());
|
||||
// 4.2 make whiskers dashed
|
||||
graph->setWhiskerStyle(Qt::DashLine);
|
||||
graph->setWhiskerLineStyle(Qt::DashLine);
|
||||
// 4.3 change mean symbol
|
||||
graph->setMeanSymbol(JKQTPstar);
|
||||
graph->setSymbolType(JKQTPstar);
|
||||
```
|
||||
|
||||
The result looks like this:
|
||||
|
@ -48,7 +48,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
// 4. create a graph of vertical boxplots:
|
||||
JKQTPBoxplotVerticalGraph* graph=new JKQTPBoxplotVerticalGraph(&plot);
|
||||
graph->setPosColumn(columnPOS);
|
||||
graph->setPositionColumn(columnPOS);
|
||||
graph->setMinColumn(columnMIN);
|
||||
graph->setPercentile25Column(columnQ25);
|
||||
graph->setMedianColumn(columnMEDIAN);
|
||||
@ -63,7 +63,7 @@ int main(int argc, char* argv[])
|
||||
graphOutliers->setYColumn(columnOUTLIERSY);
|
||||
graphOutliers->setTitle("outliers");
|
||||
// make the color a darker shade of the color of graph
|
||||
graphOutliers->setColor(graph->getColor().darker());
|
||||
graphOutliers->setColor(graph->getLineColor().darker());
|
||||
graphOutliers->setSymbolFillColor(QColor("white"));
|
||||
// draw outliers as small circles, without lines
|
||||
graphOutliers->setSymbolType(JKQTPCircle);
|
||||
@ -72,7 +72,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
// 6. create a graph of horizontal boxplots:
|
||||
JKQTPBoxplotHorizontalGraph* graphh=new JKQTPBoxplotHorizontalGraph(&plot);
|
||||
graphh->setPosColumn(columnPOSY);
|
||||
graphh->setPositionColumn(columnPOSY);
|
||||
graphh->setMinColumn(columnMIN);
|
||||
graphh->setPercentile25Column(columnQ25);
|
||||
graphh->setMedianColumn(columnMEDIAN);
|
||||
@ -81,11 +81,11 @@ int main(int argc, char* argv[])
|
||||
graphh->setMaxColumn(columnMAX);
|
||||
graphh->setTitle("horizontal Boxplots");
|
||||
// 6.1 make fill collor a lighter shade of the outline color
|
||||
graphh->setFillColor(graphh->getColor().lighter());
|
||||
graphh->setFillColor(graphh->getLineColor().lighter());
|
||||
// 6.2 make whiskers dashed
|
||||
graphh->setWhiskerStyle(Qt::DashLine);
|
||||
graphh->setWhiskerLineStyle(Qt::DashLine);
|
||||
// 6.3 change mean symbol
|
||||
graphh->setMeanSymbol(JKQTPstar);
|
||||
graphh->setSymbolType(JKQTPstar);
|
||||
|
||||
|
||||
// 7. add the graphs to the plot, so it is actually displayed
|
||||
|
@ -102,14 +102,14 @@ After adding all necessary data to the JKQTDatastore:
|
||||
graphBoxPlot->setPercentile75(rndQ75);
|
||||
graphBoxPlot->setMax(rndMax);
|
||||
graphBoxPlot->setBoxWidth(24);
|
||||
graphBoxPlot->setMeanSymbolSize(16);
|
||||
graphBoxPlot->setMeanSymbolWidth(2);
|
||||
graphBoxPlot->setSymbolTypeSize(16);
|
||||
graphBoxPlot->setSymbolTypeWidth(2);
|
||||
graphBoxPlot->setTitle("Statistical Properties");
|
||||
graphBoxPlot->setColor(QColor("blue"));
|
||||
// make fill collor a lighter shade of the outline color
|
||||
graphBoxPlot->setFillColor(graphBoxPlot->getColor().lighter(180));
|
||||
// make whiskers dashed
|
||||
graphBoxPlot->setWhiskerStyle(Qt::DashLine);
|
||||
graphBoxPlot->setWhiskerLineStyle(Qt::DashLine);
|
||||
|
||||
|
||||
// 8. add the graphs to the plot, so it is actually displayed
|
||||
|
@ -115,14 +115,14 @@ int main(int argc, char* argv[])
|
||||
graphBoxPlot->setPercentile75(rndQ75);
|
||||
graphBoxPlot->setMax(rndMax);
|
||||
graphBoxPlot->setBoxWidth(24);
|
||||
graphBoxPlot->setMeanSymbolSize(16);
|
||||
graphBoxPlot->setMeanSymbolWidth(2);
|
||||
graphBoxPlot->setSymbolTypeSize(16);
|
||||
graphBoxPlot->setSymbolTypeWidth(2);
|
||||
graphBoxPlot->setTitle("Statistical Properties");
|
||||
graphBoxPlot->setColor(QColor("blue"));
|
||||
// make fill collor a lighter shade of the outline color
|
||||
graphBoxPlot->setFillColor(graphBoxPlot->getColor().lighter(180));
|
||||
// make whiskers dashed
|
||||
graphBoxPlot->setWhiskerStyle(Qt::DashLine);
|
||||
graphBoxPlot->setWhiskerLineStyle(Qt::DashLine);
|
||||
|
||||
|
||||
// 8. add the graphs to the plot, so it is actually displayed
|
||||
|
@ -4071,7 +4071,7 @@ size_t JKQTBasePlotter::addGraph(size_t xColumn, size_t yColumn, const QString&
|
||||
|
||||
size_t JKQTBasePlotter::addHorizontalBoxplot(QString title, int posColumn, int medianColumn, int minColumn, int maxColumn, int percentile25Column, int percentile75Column, int meanColumn) {
|
||||
JKQTPBoxplotHorizontalGraph* box=new JKQTPBoxplotHorizontalGraph(this);
|
||||
box->setPosColumn(posColumn);
|
||||
box->setPositionColumn(posColumn);
|
||||
box->setMedianColumn(medianColumn);
|
||||
box->setMeanColumn(meanColumn);
|
||||
box->setMinColumn(minColumn);
|
||||
@ -4084,7 +4084,7 @@ size_t JKQTBasePlotter::addHorizontalBoxplot(QString title, int posColumn, int m
|
||||
|
||||
size_t JKQTBasePlotter::addVerticalBoxplot(QString title, int posColumn, int medianColumn, int minColumn, int maxColumn, int percentile25Column, int percentile75Column, int meanColumn) {
|
||||
JKQTPBoxplotVerticalGraph* box=new JKQTPBoxplotVerticalGraph(this);
|
||||
box->setPosColumn(posColumn);
|
||||
box->setPositionColumn(posColumn);
|
||||
box->setMedianColumn(medianColumn);
|
||||
box->setMeanColumn(meanColumn);
|
||||
box->setMinColumn(minColumn);
|
||||
|
@ -331,9 +331,11 @@ int JKQTPSingleColumnGraph::getDataColumn() const
|
||||
return this->dataColumn;
|
||||
}
|
||||
|
||||
void JKQTPSingleColumnGraph::setDataColumn(size_t __value) { this->dataColumn = static_cast<int>(__value); }
|
||||
void JKQTPSingleColumnGraph::setDataColumn(size_t __value) {
|
||||
this->dataColumn = static_cast<int>(__value);
|
||||
}
|
||||
|
||||
void JKQTPSingleColumnGraph::setDataSortOrder(const JKQTPSingleColumnGraph::DataSortOrder &__value)
|
||||
void JKQTPSingleColumnGraph::setDataSortOrder(JKQTPSingleColumnGraph::DataSortOrder __value)
|
||||
{
|
||||
this->sortData = __value;
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ class JKQTP_LIB_EXPORT JKQTPXYGraph: public JKQTPGraph {
|
||||
inline virtual void setYColumn (size_t __value) { this->yColumn = static_cast<int>(__value); }
|
||||
/*! \copydoc sortData
|
||||
\see see sortData for details */
|
||||
inline virtual void setDataSortOrder(const DataSortOrder & __value)
|
||||
inline virtual void setDataSortOrder(DataSortOrder __value)
|
||||
{
|
||||
this->sortData = __value;
|
||||
}
|
||||
@ -455,7 +455,7 @@ class JKQTP_LIB_EXPORT JKQTPSingleColumnGraph: public JKQTPGraph {
|
||||
|
||||
/*! \copydoc sortData
|
||||
\see see sortData for details */
|
||||
void setDataSortOrder(const DataSortOrder & __value);
|
||||
void setDataSortOrder(DataSortOrder __value);
|
||||
/*! \copydoc sortData
|
||||
\see see sortData for details */
|
||||
DataSortOrder getDataSortOrder() const;
|
||||
|
@ -32,6 +32,102 @@
|
||||
|
||||
|
||||
|
||||
JKQTPGraphBoxplotStyleMixin::JKQTPGraphBoxplotStyleMixin()
|
||||
{
|
||||
|
||||
boxWidth=0.4;
|
||||
|
||||
whiskerLineColor=getLineColor();
|
||||
whiskerLineStyle=getLineStyle();
|
||||
whiskerLineWidth=getLineWidth();
|
||||
|
||||
}
|
||||
|
||||
|
||||
void JKQTPGraphBoxplotStyleMixin::initBoxplotStyle(JKQTBasePlotter *parent, int &parentPlotStyle)
|
||||
{
|
||||
initFillStyle(parent, parentPlotStyle);
|
||||
initLineStyle(parent, parentPlotStyle);
|
||||
initSymbolStyle(parent, parentPlotStyle);
|
||||
if (parent && parentPlotStyle>=0) { // get style settings from parent object
|
||||
parentPlotStyle=parent->getNextStyle();
|
||||
whiskerLineStyle=parent->getPlotStyle(parentPlotStyle).style();
|
||||
whiskerLineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
}
|
||||
|
||||
whiskerLineColor=getLineColor();
|
||||
|
||||
}
|
||||
|
||||
void JKQTPGraphBoxplotStyleMixin::setBoxplotColor(QColor c, JKQTBasePlotter *parent)
|
||||
{
|
||||
setLineColor(c);
|
||||
setFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, c));
|
||||
c.setAlphaF(0.5);
|
||||
setHighlightingLineColor(c);
|
||||
setSymbolColor(c);
|
||||
setSymbolFillColor(JKQTPGetDerivedColor(parent->getCurrentPlotterStyle().graphFillColorDerivationMode, c));
|
||||
whiskerLineColor=getLineColor();
|
||||
}
|
||||
|
||||
void JKQTPGraphBoxplotStyleMixin::setWhiskerLineStyle(const Qt::PenStyle &__value)
|
||||
{
|
||||
this->whiskerLineStyle = __value;
|
||||
}
|
||||
|
||||
Qt::PenStyle JKQTPGraphBoxplotStyleMixin::getWhiskerLineStyle() const
|
||||
{
|
||||
return this->whiskerLineStyle;
|
||||
}
|
||||
|
||||
void JKQTPGraphBoxplotStyleMixin::setBoxWidth(double __value)
|
||||
{
|
||||
this->boxWidth = __value;
|
||||
}
|
||||
|
||||
double JKQTPGraphBoxplotStyleMixin::getBoxWidth() const
|
||||
{
|
||||
return this->boxWidth;
|
||||
}
|
||||
|
||||
void JKQTPGraphBoxplotStyleMixin::setWhiskerLineWidth(double __value)
|
||||
{
|
||||
whiskerLineWidth=__value;
|
||||
}
|
||||
|
||||
double JKQTPGraphBoxplotStyleMixin::getWhiskerLineWidth() const
|
||||
{
|
||||
return whiskerLineWidth;
|
||||
}
|
||||
|
||||
void JKQTPGraphBoxplotStyleMixin::setWhiskerLineColor(QColor __value)
|
||||
{
|
||||
whiskerLineColor=__value;
|
||||
}
|
||||
|
||||
QColor JKQTPGraphBoxplotStyleMixin::getWhiskerLineColor() const
|
||||
{
|
||||
return whiskerLineColor;
|
||||
}
|
||||
|
||||
QPen JKQTPGraphBoxplotStyleMixin::getWhiskerPen(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const
|
||||
{
|
||||
QPen pw=getLinePenForRects(painter, parent);
|
||||
pw.setStyle(whiskerLineStyle);
|
||||
pw.setWidthF(whiskerLineWidth);
|
||||
pw.setColor(whiskerLineColor);
|
||||
return pw;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -47,62 +143,16 @@ JKQTPBoxplotVerticalGraph::JKQTPBoxplotVerticalGraph(JKQTBasePlotter* parent):
|
||||
maxColumn=-1;
|
||||
percentile25Column=-1;
|
||||
percentile75Column=-1;
|
||||
color=QColor("red");
|
||||
fillColor=QColor("white");
|
||||
fillStyle=Qt::SolidPattern;
|
||||
whiskerStyle=Qt::SolidLine;
|
||||
lineWidth=1;
|
||||
boxWidth=0.4;
|
||||
meanSymbol=JKQTPPlus;
|
||||
meanSymbolWidth=1;
|
||||
meanSymbolSize=12;
|
||||
|
||||
sortData=Unsorted;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
parentPlotStyle=parent->getNextStyle();
|
||||
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
|
||||
color=parent->getPlotStyle(parentPlotStyle).color();
|
||||
fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
|
||||
whiskerStyle=parent->getPlotStyle(parentPlotStyle).style();
|
||||
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
meanSymbolSize=parent->getPlotStyle(parentPlotStyle).symbolSize();
|
||||
meanSymbolWidth=parent->getPlotStyle(parentPlotStyle).symbolLineWidthF();
|
||||
}
|
||||
|
||||
initBoxplotStyle(parent, parentPlotStyle);
|
||||
}
|
||||
|
||||
|
||||
JKQTPBoxplotVerticalGraph::JKQTPBoxplotVerticalGraph(JKQTPlotter* parent):
|
||||
JKQTPGraph(parent)
|
||||
JKQTPBoxplotVerticalGraph(parent->getPlotter())
|
||||
{
|
||||
posColumn=-1;
|
||||
medianColumn=-1;
|
||||
meanColumn=-1;
|
||||
minColumn=-1;
|
||||
maxColumn=-1;
|
||||
percentile25Column=-1;
|
||||
percentile75Column=-1;
|
||||
color=QColor("red");
|
||||
fillColor=QColor("white");
|
||||
fillStyle=Qt::SolidPattern;
|
||||
whiskerStyle=Qt::SolidLine;
|
||||
lineWidth=1;
|
||||
boxWidth=0.4;
|
||||
meanSymbol=JKQTPPlus;
|
||||
meanSymbolWidth=1;
|
||||
meanSymbolSize=12;
|
||||
sortData=Unsorted;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
parentPlotStyle=parent->getNextStyle();
|
||||
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
|
||||
color=parent->getPlotStyle(parentPlotStyle).color();
|
||||
fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
|
||||
whiskerStyle=parent->getPlotStyle(parentPlotStyle).style();
|
||||
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
meanSymbolSize=parent->getPlotStyle(parentPlotStyle).symbolSize();
|
||||
meanSymbolWidth=parent->getPlotStyle(parentPlotStyle).symbolLineWidthF();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -118,19 +168,10 @@ void JKQTPBoxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
drawErrorsBefore(painter);
|
||||
|
||||
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
QPen pw=p;
|
||||
pw.setStyle(whiskerStyle);
|
||||
QPen p=getLinePenForRects(painter, parent);
|
||||
QPen pw=getWhiskerPen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
|
||||
int imax=datastore->getColumn(posColumn).getRows();
|
||||
int imin=0;
|
||||
@ -199,7 +240,7 @@ void JKQTPBoxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
else xn=x+1;
|
||||
|
||||
|
||||
double w=((boxwidth_real>0)?boxwidth_real:(fabs(xn-x)))*boxWidth;
|
||||
double w=((boxwidth_real>0)?boxwidth_real:(fabs(xn-x)))*getBoxWidth();
|
||||
double minstop=p25;
|
||||
double maxstop=p75;
|
||||
if (percentile25Column<0 && medianColumn>=0) minstop=median;
|
||||
@ -214,10 +255,10 @@ void JKQTPBoxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
double xmi4=x-w/4.0;
|
||||
|
||||
if (imax<=0) {
|
||||
xma=transformX(xv+boxWidth/2.0);
|
||||
xmi=transformX(xv-boxWidth/2.0);
|
||||
xma4=transformX(xv+boxWidth/4.0);
|
||||
xmi4=transformX(xv-boxWidth/4.0);
|
||||
xma=transformX(xv+getBoxWidth()/2.0);
|
||||
xmi=transformX(xv-getBoxWidth()/2.0);
|
||||
xma4=transformX(xv+getBoxWidth()/4.0);
|
||||
xmi4=transformX(xv-getBoxWidth()/4.0);
|
||||
}
|
||||
|
||||
if (minColumn>=0) {
|
||||
@ -232,7 +273,7 @@ void JKQTPBoxplotVerticalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
if (percentile25Column>=0 && percentile75Column>=0) painter.drawRect(QRectF(xmi, p75, fabs(xma-xmi), fabs(p75-p25)));
|
||||
if (medianColumn>=0) lines_p.append(QLineF(xmi+p.widthF()/2.0, median, xma-p.widthF()/2.0, median));
|
||||
if (meanColumn>=0 && JKQTPIsOKFloat(mean)) {
|
||||
JKQTPPlotSymbol(painter, x, mean, meanSymbol, parent->pt2px(painter, meanSymbolSize), parent->pt2px(painter, meanSymbolWidth*parent->getLineWidthMultiplier()), color, fillColor);
|
||||
plotStyledSymbol(parent, painter,x,mean);
|
||||
}
|
||||
|
||||
|
||||
@ -280,7 +321,7 @@ bool JKQTPBoxplotVerticalGraph::getXMinMax(double& minx, double& maxx, double& s
|
||||
else if (i-1>=0) xn=datastore->get(posColumn,i-1);
|
||||
else xn=xv+1;
|
||||
double delta=fabs(xn-xv);
|
||||
double w=delta*boxWidth;
|
||||
double w=delta*getBoxWidth();
|
||||
double xma=xv+w;
|
||||
double xmi=xv-w;
|
||||
if (start || xma>maxx) maxx=xma;
|
||||
@ -350,26 +391,129 @@ bool JKQTPBoxplotVerticalGraph::usesColumn(int c) const
|
||||
return (c==meanColumn)||(c==posColumn)||(c==medianColumn)||(c==minColumn)||(c==maxColumn)||(c==percentile25Column)||(c==percentile75Column);
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setDataSortOrder(JKQTPBoxplotVerticalGraph::DataSortOrder __value)
|
||||
{
|
||||
this->sortData = __value;
|
||||
}
|
||||
|
||||
JKQTPBoxplotVerticalGraph::DataSortOrder JKQTPBoxplotVerticalGraph::getDataSortOrder() const
|
||||
{
|
||||
return this->sortData;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setDataSortOrder(int __value) {
|
||||
sortData=(DataSortOrder)__value;
|
||||
if (__value>0) sortData=Sorted;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setPositionColumn(int __value)
|
||||
{
|
||||
this->posColumn = __value;
|
||||
}
|
||||
|
||||
int JKQTPBoxplotVerticalGraph::getPositionColumn() const
|
||||
{
|
||||
return this->posColumn;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setPositionColumn(size_t __value) {
|
||||
this->posColumn = static_cast<int>(__value);
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setMedianColumn(int __value)
|
||||
{
|
||||
this->medianColumn = __value;
|
||||
}
|
||||
|
||||
int JKQTPBoxplotVerticalGraph::getMedianColumn() const
|
||||
{
|
||||
return this->medianColumn;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setMedianColumn(size_t __value) {
|
||||
this->medianColumn = static_cast<int>(__value);
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setMeanColumn(int __value)
|
||||
{
|
||||
this->meanColumn = __value;
|
||||
}
|
||||
|
||||
int JKQTPBoxplotVerticalGraph::getMeanColumn() const
|
||||
{
|
||||
return this->meanColumn;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setMeanColumn(size_t __value) {
|
||||
this->meanColumn = static_cast<int>(__value);
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setMinColumn(int __value)
|
||||
{
|
||||
this->minColumn = __value;
|
||||
}
|
||||
|
||||
int JKQTPBoxplotVerticalGraph::getMinColumn() const
|
||||
{
|
||||
return this->minColumn;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setMinColumn(size_t __value) {
|
||||
this->minColumn = static_cast<int>(__value);
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setMaxColumn(int __value)
|
||||
{
|
||||
this->maxColumn = __value;
|
||||
}
|
||||
|
||||
int JKQTPBoxplotVerticalGraph::getMaxColumn() const
|
||||
{
|
||||
return this->maxColumn;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setMaxColumn(size_t __value) {
|
||||
this->maxColumn = static_cast<int>(__value);
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setPercentile25Column(int __value)
|
||||
{
|
||||
this->percentile25Column = __value;
|
||||
}
|
||||
|
||||
int JKQTPBoxplotVerticalGraph::getPercentile25Column() const
|
||||
{
|
||||
return this->percentile25Column;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setPercentile25Column(size_t __value) {
|
||||
this->percentile25Column = static_cast<int>(__value);
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setPercentile75Column(int __value)
|
||||
{
|
||||
this->percentile75Column = __value;
|
||||
}
|
||||
|
||||
int JKQTPBoxplotVerticalGraph::getPercentile75Column() const
|
||||
{
|
||||
return this->percentile75Column;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setPercentile75Column(size_t __value) {
|
||||
this->percentile75Column = static_cast<int>(__value);
|
||||
}
|
||||
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=painter.pen();
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap); p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
QPen pw=p;
|
||||
pw.setStyle(whiskerStyle);
|
||||
QPen p=getLinePenForRects(painter, parent);
|
||||
QPen pw=getWhiskerPen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
p.setWidthF(qMin(1.0, p.widthF()));
|
||||
pw.setWidthF(qMin(1.0, pw.widthF()));
|
||||
|
||||
double x=rect.left()+rect.width()/2.0;
|
||||
double xma=x+rect.width()/2.5;
|
||||
@ -398,7 +542,12 @@ void JKQTPBoxplotVerticalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRe
|
||||
}
|
||||
|
||||
QColor JKQTPBoxplotVerticalGraph::getKeyLabelColor() const {
|
||||
return color;
|
||||
return getLineColor();
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::setColor(QColor c)
|
||||
{
|
||||
setBoxplotColor(c, getParent());
|
||||
}
|
||||
|
||||
|
||||
@ -406,19 +555,13 @@ QColor JKQTPBoxplotVerticalGraph::getKeyLabelColor() const {
|
||||
|
||||
void JKQTPBoxplotHorizontalGraph::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
QPen pw=p;
|
||||
pw.setStyle(whiskerStyle);
|
||||
QPen p=getLinePenForRects(painter, parent);
|
||||
QPen pw=getWhiskerPen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
p.setWidthF(qMin(1.0, p.widthF()));
|
||||
pw.setWidthF(qMin(1.0, pw.widthF()));
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
|
||||
double y=rect.top()+rect.height()/2.0;
|
||||
double yma=y+rect.height()/2.5;
|
||||
@ -523,7 +666,7 @@ bool JKQTPBoxplotHorizontalGraph::getYMinMax(double& minx, double& maxx, double&
|
||||
else if (i-1>=0) xn=datastore->get(posColumn,i-1);
|
||||
else xn=xv+1;
|
||||
double delta=fabs(xn-xv);
|
||||
double w=delta*boxWidth;
|
||||
double w=delta*getBoxWidth();
|
||||
double xma=xv+w;
|
||||
double xmi=xv-w;
|
||||
if (JKQTPIsOKFloat(xma) && JKQTPIsOKFloat(xmi) ) {
|
||||
@ -544,7 +687,7 @@ JKQTPBoxplotHorizontalGraph::JKQTPBoxplotHorizontalGraph(JKQTBasePlotter *parent
|
||||
}
|
||||
|
||||
JKQTPBoxplotHorizontalGraph::JKQTPBoxplotHorizontalGraph(JKQTPlotter *parent):
|
||||
JKQTPBoxplotVerticalGraph(parent)
|
||||
JKQTPBoxplotHorizontalGraph(parent->getPlotter())
|
||||
{
|
||||
}
|
||||
|
||||
@ -558,20 +701,11 @@ void JKQTPBoxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
drawErrorsBefore(painter);
|
||||
|
||||
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
QPen pw=p;
|
||||
pw.setStyle(whiskerStyle);
|
||||
QPen p=getLinePenForRects(painter, parent);
|
||||
QPen pw=getWhiskerPen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
|
||||
int imax=datastore->getColumn(posColumn).getRows();
|
||||
int imin=0;
|
||||
@ -651,17 +785,17 @@ void JKQTPBoxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
else if (i-1>=0) yn=transformY(datastore->get(posColumn,i-1));
|
||||
else yn=y+1;
|
||||
double delta=fabs(yn-y);
|
||||
double w=((boxwidth_real>0)?boxwidth_real:(delta))*boxWidth;
|
||||
double w=((boxwidth_real>0)?boxwidth_real:(delta))*getBoxWidth();
|
||||
double yma=y-w/2.0;
|
||||
double ymi=y+w/2.0;
|
||||
double yma4=y+w/4.0;
|
||||
double ymi4=y-w/4.0;
|
||||
|
||||
if (imax<=1) {
|
||||
ymi=transformY(yv+boxWidth/2.0);
|
||||
yma=transformY(yv-boxWidth/2.0);
|
||||
yma4=transformY(yv+boxWidth/4.0);
|
||||
ymi4=transformY(yv-boxWidth/4.0);
|
||||
ymi=transformY(yv+getBoxWidth()/2.0);
|
||||
yma=transformY(yv-getBoxWidth()/2.0);
|
||||
yma4=transformY(yv+getBoxWidth()/4.0);
|
||||
ymi4=transformY(yv-getBoxWidth()/4.0);
|
||||
}
|
||||
if (minColumn>=0) {
|
||||
lines_p.append(QLineF(min, ymi4, min, yma4));
|
||||
@ -675,7 +809,7 @@ void JKQTPBoxplotHorizontalGraph::draw(JKQTPEnhancedPainter& painter) {
|
||||
if (medianColumn>=0) lines_p.append(QLineF(median, ymi-p.widthF()/2.0, median, yma+p.widthF()/2.0));
|
||||
|
||||
if (meanColumn>=0 && JKQTPIsOKFloat(mean)) {
|
||||
JKQTPPlotSymbol(painter, mean, y, meanSymbol, parent->pt2px(painter, meanSymbolSize), parent->pt2px(painter, meanSymbolWidth*parent->getLineWidthMultiplier()), color, fillColor);
|
||||
plotStyledSymbol(parent, painter, mean, y);
|
||||
}
|
||||
|
||||
//first=true;
|
||||
@ -725,63 +859,16 @@ JKQTPBoxplotVerticalElement::JKQTPBoxplotVerticalElement(JKQTBasePlotter* parent
|
||||
drawMinMax=true;
|
||||
percentile25=-0.75;
|
||||
percentile75=0.75;
|
||||
color=QColor("red");
|
||||
fillColor=QColor("white");
|
||||
fillStyle=Qt::SolidPattern;
|
||||
whiskerStyle=Qt::SolidLine;
|
||||
lineWidth=1;
|
||||
boxWidth=16;
|
||||
meanSymbol=JKQTPPlus;
|
||||
meanSymbolWidth=1;
|
||||
meanSymbolSize=12;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
parentPlotStyle=parent->getNextStyle();
|
||||
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
|
||||
color=parent->getPlotStyle(parentPlotStyle).color();
|
||||
fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
|
||||
whiskerStyle=parent->getPlotStyle(parentPlotStyle).style();
|
||||
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
meanSymbolSize=parent->getPlotStyle(parentPlotStyle).symbolSize();
|
||||
meanSymbolWidth=parent->getPlotStyle(parentPlotStyle).symbolLineWidthF();
|
||||
}
|
||||
initBoxplotStyle(parent, parentPlotStyle);
|
||||
|
||||
}
|
||||
|
||||
JKQTPBoxplotVerticalElement::JKQTPBoxplotVerticalElement(JKQTPlotter* parent):
|
||||
JKQTPPlotObject(parent)
|
||||
JKQTPBoxplotVerticalElement(parent->getPlotter())
|
||||
{
|
||||
pos=0;
|
||||
median=0;
|
||||
mean=0;
|
||||
min=-1;
|
||||
max=1;
|
||||
drawMean=true;
|
||||
drawMinMax=true;
|
||||
percentile25=-0.75;
|
||||
percentile75=0.75;
|
||||
color=QColor("red");
|
||||
fillColor=QColor("white");
|
||||
fillStyle=Qt::SolidPattern;
|
||||
whiskerStyle=Qt::SolidLine;
|
||||
lineWidth=1;
|
||||
boxWidth=16;
|
||||
meanSymbol=JKQTPPlus;
|
||||
meanSymbolWidth=1;
|
||||
meanSymbolSize=12;
|
||||
|
||||
if (parent) { // get style settings from parent object
|
||||
parentPlotStyle=parent->getNextStyle();
|
||||
//std::cout<<"got style settings from parent: "<<parentPlotStyle<<std::endl;
|
||||
color=parent->getPlotStyle(parentPlotStyle).color();
|
||||
fillColor=parent->getPlotStyle(parentPlotStyle).fillColor();
|
||||
whiskerStyle=parent->getPlotStyle(parentPlotStyle).style();
|
||||
lineWidth=parent->getPlotStyle(parentPlotStyle).widthF();
|
||||
meanSymbolSize=parent->getPlotStyle(parentPlotStyle).symbolSize();
|
||||
meanSymbolWidth=parent->getPlotStyle(parentPlotStyle).symbolLineWidthF();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalElement::draw(JKQTPEnhancedPainter& painter) {
|
||||
#ifdef JKQTBP_AUTOTIMER
|
||||
JKQTPAutoOutputTimer jkaaot("JKQTPBoxplotVerticalElement::draw");
|
||||
@ -792,19 +879,11 @@ void JKQTPBoxplotVerticalElement::draw(JKQTPEnhancedPainter& painter) {
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
QPen pw=p;
|
||||
pw.setStyle(whiskerStyle);
|
||||
QPen p=getLinePenForRects(painter, parent);
|
||||
QPen pw=getWhiskerPen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
|
||||
|
||||
double xv=pos;
|
||||
@ -827,7 +906,7 @@ void JKQTPBoxplotVerticalElement::draw(JKQTPEnhancedPainter& painter) {
|
||||
double max=transformY(maxv);
|
||||
double median=transformY(medianv);
|
||||
|
||||
double w=boxWidth;
|
||||
double w=getBoxWidth();
|
||||
double xma=x+w/2.0;
|
||||
double xmi=x-w/2.0;
|
||||
|
||||
@ -853,7 +932,7 @@ void JKQTPBoxplotVerticalElement::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
if (drawMean) {
|
||||
double mean=transformY(this->mean);
|
||||
JKQTPPlotSymbol(painter, x, mean, meanSymbol, parent->pt2px(painter, meanSymbolSize), parent->pt2px(painter, meanSymbolWidth*parent->getLineWidthMultiplier()), color, fillColor);
|
||||
plotStyledSymbol(parent, painter, x, mean);
|
||||
}
|
||||
|
||||
|
||||
@ -918,22 +997,128 @@ bool JKQTPBoxplotVerticalElement::getYMinMax(double& miny, double& maxy, double&
|
||||
return true;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalElement::setPos(double __value)
|
||||
{
|
||||
this->pos = __value;
|
||||
}
|
||||
|
||||
double JKQTPBoxplotVerticalElement::getPos() const
|
||||
{
|
||||
return this->pos;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalElement::setMedian(double __value)
|
||||
{
|
||||
if (this->median != __value) {
|
||||
this->median = __value;
|
||||
drawMedian=true;
|
||||
}
|
||||
}
|
||||
|
||||
double JKQTPBoxplotVerticalElement::getMedian() const
|
||||
{
|
||||
return this->median;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalElement::setMean(double __value)
|
||||
{
|
||||
if (this->mean != __value) {
|
||||
this->mean = __value;
|
||||
drawMean=true;
|
||||
}
|
||||
}
|
||||
|
||||
double JKQTPBoxplotVerticalElement::getMean() const
|
||||
{
|
||||
return this->mean;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalElement::setMin(double __value)
|
||||
{
|
||||
if (this->min != __value) {
|
||||
this->min = __value;
|
||||
drawMinMax=true;
|
||||
}
|
||||
}
|
||||
|
||||
double JKQTPBoxplotVerticalElement::getMin() const
|
||||
{
|
||||
return this->min;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalElement::setMax(double __value)
|
||||
{
|
||||
if (this->max != __value) {
|
||||
this->max = __value;
|
||||
drawMinMax=true;
|
||||
}
|
||||
}
|
||||
|
||||
double JKQTPBoxplotVerticalElement::getMax() const
|
||||
{
|
||||
return this->max;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalElement::setPercentile25(double __value)
|
||||
{
|
||||
this->percentile25 = __value;
|
||||
}
|
||||
|
||||
double JKQTPBoxplotVerticalElement::getPercentile25() const
|
||||
{
|
||||
return this->percentile25;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalElement::setPercentile75(double __value)
|
||||
{
|
||||
this->percentile75 = __value;
|
||||
}
|
||||
|
||||
double JKQTPBoxplotVerticalElement::getPercentile75() const
|
||||
{
|
||||
return this->percentile75;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalElement::setDrawMean(bool __value)
|
||||
{
|
||||
this->drawMean = __value;
|
||||
}
|
||||
|
||||
bool JKQTPBoxplotVerticalElement::getDrawMean() const
|
||||
{
|
||||
return this->drawMean;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalElement::setDrawMedian(bool __value)
|
||||
{
|
||||
this->drawMedian = __value;
|
||||
}
|
||||
|
||||
bool JKQTPBoxplotVerticalElement::getDrawMedian() const
|
||||
{
|
||||
return this->drawMedian;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalElement::setDrawMinMax(bool __value)
|
||||
{
|
||||
this->drawMinMax = __value;
|
||||
}
|
||||
|
||||
bool JKQTPBoxplotVerticalElement::getDrawMinMax() const
|
||||
{
|
||||
return this->drawMinMax;
|
||||
}
|
||||
|
||||
|
||||
void JKQTPBoxplotVerticalElement::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
QPen pw=p;
|
||||
pw.setStyle(whiskerStyle);
|
||||
QPen p=getLinePenForRects(painter, parent);
|
||||
QPen pw=getWhiskerPen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
p.setWidthF(qMin(1.0, p.widthF()));
|
||||
pw.setWidthF(qMin(1.0, pw.widthF()));
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
|
||||
double x=rect.left()+rect.width()/2.0;
|
||||
double xma=x+rect.width()/2.5;
|
||||
@ -962,7 +1147,7 @@ void JKQTPBoxplotVerticalElement::drawKeyMarker(JKQTPEnhancedPainter& painter, Q
|
||||
}
|
||||
|
||||
QColor JKQTPBoxplotVerticalElement::getKeyLabelColor() const {
|
||||
return color;
|
||||
return getLineColor();
|
||||
}
|
||||
|
||||
|
||||
@ -970,20 +1155,12 @@ QColor JKQTPBoxplotVerticalElement::getKeyLabelColor() const {
|
||||
|
||||
void JKQTPBoxplotHorizontalElement::drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) {
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
|
||||
QPen pw=p;
|
||||
pw.setStyle(whiskerStyle);
|
||||
QPen p=getLinePenForRects(painter, parent);
|
||||
QPen pw=getWhiskerPen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
p.setWidthF(qMin(1.0, p.widthF()));
|
||||
pw.setWidthF(qMin(1.0, pw.widthF()));
|
||||
|
||||
double y=rect.top()+rect.height()/2.0;
|
||||
double yma=y+rect.height()/2.5;
|
||||
@ -1072,7 +1249,7 @@ JKQTPBoxplotHorizontalElement::JKQTPBoxplotHorizontalElement(JKQTBasePlotter *pa
|
||||
}
|
||||
|
||||
JKQTPBoxplotHorizontalElement::JKQTPBoxplotHorizontalElement(JKQTPlotter *parent):
|
||||
JKQTPBoxplotVerticalElement(parent)
|
||||
JKQTPBoxplotHorizontalElement(parent->getPlotter())
|
||||
{
|
||||
}
|
||||
|
||||
@ -1086,19 +1263,10 @@ void JKQTPBoxplotHorizontalElement::draw(JKQTPEnhancedPainter& painter) {
|
||||
{
|
||||
painter.save(); auto __finalpaint=JKQTPFinally([&painter]() {painter.restore();});
|
||||
|
||||
QPen p=painter.pen();
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH, parent->pt2px(painter, lineWidth*parent->getLineWidthMultiplier())));
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
QPen pw=p;
|
||||
pw.setStyle(whiskerStyle);
|
||||
QPen p=getLinePenForRects(painter, parent);
|
||||
QPen pw=getWhiskerPen(painter, parent);
|
||||
QPen np(Qt::NoPen);
|
||||
|
||||
QBrush b=painter.brush();
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
QBrush b=getFillBrush(painter, parent);
|
||||
double yv=pos;
|
||||
double p25v=percentile25;
|
||||
double p75v=percentile75;
|
||||
@ -1122,7 +1290,7 @@ void JKQTPBoxplotHorizontalElement::draw(JKQTPEnhancedPainter& painter) {
|
||||
double max=transformX(maxv);
|
||||
double median=transformX(medianv);
|
||||
|
||||
double w= parent->pt2px(painter, boxWidth);
|
||||
double w= parent->pt2px(painter, getBoxWidth());
|
||||
double yma=y+w/2.0;
|
||||
double ymi=y-w/2.0;
|
||||
|
||||
@ -1148,7 +1316,7 @@ void JKQTPBoxplotHorizontalElement::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
if (drawMean) {
|
||||
double mean=transformY(this->mean);
|
||||
JKQTPPlotSymbol(painter, mean, y, meanSymbol, parent->pt2px(painter, meanSymbolSize), parent->pt2px(painter, meanSymbolWidth*parent->getLineWidthMultiplier()), color, fillColor);
|
||||
plotStyledSymbol(parent, painter, mean, y);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1161,17 +1329,6 @@ void JKQTPBoxplotHorizontalElement::draw(JKQTPEnhancedPainter& painter) {
|
||||
|
||||
|
||||
|
||||
|
||||
QPen JKQTPBoxplotVerticalGraph::getLinePen(JKQTPEnhancedPainter& painter) const {
|
||||
QPen p;
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void JKQTPBoxplotVerticalGraph::intSortData()
|
||||
{
|
||||
sortedIndices.clear();
|
||||
@ -1206,28 +1363,3 @@ void JKQTPBoxplotVerticalGraph::intSortData()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
QBrush JKQTPBoxplotVerticalGraph::getBrush(JKQTPEnhancedPainter& /*painter*/) const {
|
||||
QBrush b;
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
return b;
|
||||
}
|
||||
|
||||
QBrush JKQTPBoxplotVerticalElement::getBrush(JKQTPEnhancedPainter& /*painter*/) const {
|
||||
QBrush b;
|
||||
b.setColor(fillColor);
|
||||
b.setStyle(fillStyle);
|
||||
return b;
|
||||
}
|
||||
|
||||
QPen JKQTPBoxplotVerticalElement::getLinePen(JKQTPEnhancedPainter& painter) const {
|
||||
QPen p;
|
||||
p.setColor(color);
|
||||
p.setWidthF(qMax(JKQTPlotterDrawinTools::ABS_MIN_LINEWIDTH,parent->pt2px(painter, parent->getLineWidthMultiplier()*lineWidth)));
|
||||
p.setJoinStyle(Qt::RoundJoin);
|
||||
p.setCapStyle(Qt::RoundCap);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "jkqtplottertools/jkqtp_imexport.h"
|
||||
#include "jkqtplottertools/jkqtpimagetools.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbase.h"
|
||||
#include "jkqtplotter/jkqtpgraphsbasestylingmixins.h"
|
||||
|
||||
#ifndef jkqtpgraphsboxplot_H
|
||||
#define jkqtpgraphsboxplot_H
|
||||
@ -32,6 +33,74 @@
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief Styling Mix-In for Boxplots
|
||||
\ingroup jkqtplotter_basegraphs_stylemixins
|
||||
|
||||
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPGraphBoxplotStyleMixin: public JKQTPGraphLineStyleMixin, public JKQTPGraphFillStyleMixin, public JKQTPGraphSymbolStyleMixin {
|
||||
Q_GADGET
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
JKQTPGraphBoxplotStyleMixin();
|
||||
|
||||
void initBoxplotStyle(JKQTBasePlotter* parent, int &parentPlotStyle);
|
||||
|
||||
|
||||
|
||||
/*! \copydoc whiskerStyle
|
||||
\see see whiskerStyle for details */
|
||||
void setWhiskerLineStyle(const Qt::PenStyle & __value);
|
||||
/*! \copydoc whiskerStyle
|
||||
\see see whiskerStyle for details */
|
||||
Qt::PenStyle getWhiskerLineStyle() const;
|
||||
|
||||
/*! \copydoc boxWidth
|
||||
\see see boxWidth for details */
|
||||
void setBoxWidth(double __value);
|
||||
/*! \copydoc boxWidth
|
||||
\see see boxWidth for details */
|
||||
double getBoxWidth() const;
|
||||
|
||||
/*! \copydoc whiskerLineWidth
|
||||
\see see whiskerLineWidth for details */
|
||||
void setWhiskerLineWidth(double __value);
|
||||
/*! \copydoc whiskerLineWidth
|
||||
\see see whiskerLineWidth for details */
|
||||
double getWhiskerLineWidth() const;
|
||||
|
||||
/*! \copydoc whiskerLineColor
|
||||
\see see whiskerLineColor for details */
|
||||
void setWhiskerLineColor(QColor __value);
|
||||
/*! \copydoc whiskerLineColor
|
||||
\see see whiskerLineColor for details */
|
||||
QColor getWhiskerLineColor() const;
|
||||
|
||||
/** \brief build a pen to be used for drawing whiskers */
|
||||
QPen getWhiskerPen(JKQTPEnhancedPainter &painter, JKQTBasePlotter *parent) const;
|
||||
|
||||
protected:
|
||||
/*! \brief set the color of the graph (colors all elements, based on the given color \a c )*/
|
||||
void setBoxplotColor(QColor c, JKQTBasePlotter *parent);
|
||||
private:
|
||||
/** \brief line style of the whisker lines */
|
||||
Qt::PenStyle whiskerLineStyle;
|
||||
/** \brief line width (in pt) of the whisker lines */
|
||||
double whiskerLineWidth;
|
||||
/** \brief color of the whisker lines */
|
||||
QColor whiskerLineColor;
|
||||
/** \brief width of box in percent of distance between the current two posColumn values
|
||||
* if we only plot one box&whiskers then this is the width in plot coordinates */
|
||||
double boxWidth;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*! \brief This implements vertical <a href="http://en.wikipedia.org/wiki/Box_plot">boxplots</a>
|
||||
\ingroup jkqtplotter_statgraphs
|
||||
|
||||
@ -59,7 +128,7 @@
|
||||
\code
|
||||
// 4. create a graph of vertical boxplots:
|
||||
JKQTPBoxplotVerticalGraph* graph=new JKQTPBoxplotVerticalGraph(&plot);
|
||||
graph->setPosColumn(columnPOS);
|
||||
graph->setPositionColumn(columnPOS);
|
||||
graph->setMinColumn(columnMIN);
|
||||
graph->setPercentile25Column(columnQ25);
|
||||
graph->setMedianColumn(columnMEDIAN);
|
||||
@ -85,10 +154,11 @@
|
||||
\see \ref JKQTPlotterBoxplotsGraphs
|
||||
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalGraph: public JKQTPGraph {
|
||||
class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalGraph: public JKQTPGraph, public JKQTPGraphBoxplotStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
/** \brief Sortierordnung für Daten in einem JKQTPBoxplotVerticalGraph (oder seinen Kindern) */
|
||||
enum DataSortOrder {
|
||||
Unsorted=0,
|
||||
Sorted=1
|
||||
@ -102,11 +172,13 @@ class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalGraph: public JKQTPGraph {
|
||||
JKQTPBoxplotVerticalGraph(JKQTPlotter* parent);
|
||||
|
||||
/** \brief plots the graph to the plotter object specified as parent */
|
||||
virtual void draw(JKQTPEnhancedPainter& painter);
|
||||
virtual void draw(JKQTPEnhancedPainter& painter) override;
|
||||
/** \brief plots a key marker inside the specified rectangle \a rect */
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect);
|
||||
virtual void drawKeyMarker(JKQTPEnhancedPainter& painter, QRectF& rect) override;
|
||||
/** \brief returns the color to be used for the key label */
|
||||
virtual QColor getKeyLabelColor() const override;
|
||||
/*! \brief set the color of the graph (colors all elements, based on the given color \a c )*/
|
||||
virtual void setColor(QColor c);
|
||||
|
||||
|
||||
/** \brief get the maximum and minimum x-value of the graph
|
||||
@ -125,243 +197,85 @@ class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalGraph: public JKQTPGraph {
|
||||
|
||||
/*! \copydoc sortData
|
||||
\see see sortData for details */
|
||||
inline virtual void setDataSortOrder(const DataSortOrder & __value)
|
||||
{
|
||||
this->sortData = __value;
|
||||
}
|
||||
void setDataSortOrder(DataSortOrder __value);
|
||||
/*! \copydoc sortData
|
||||
\see see sortData for details */
|
||||
inline virtual DataSortOrder getDataSortOrder() const
|
||||
{
|
||||
return this->sortData;
|
||||
}
|
||||
DataSortOrder getDataSortOrder() const;
|
||||
/*! \brief sets the property sortData ( \copybrief sortData ) to the specified \a __value. \details Description of the parameter sortData is: <BLOCKQUOTE>\copydoc sortData </BLOCKQUOTE> \see sortData for more information */
|
||||
void setDataSortOrder(int __value);
|
||||
/*! \copydoc posColumn
|
||||
\see see posColumn for details */
|
||||
inline virtual void setPosColumn(int __value)
|
||||
{
|
||||
this->posColumn = __value;
|
||||
}
|
||||
void setPositionColumn(int __value);
|
||||
/*! \copydoc posColumn
|
||||
\see see posColumn for details */
|
||||
inline virtual int getPosColumn() const
|
||||
{
|
||||
return this->posColumn;
|
||||
}
|
||||
int getPositionColumn() const;
|
||||
/*! \brief sets the property posColumn ( \copybrief posColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
|
||||
\details Description of the parameter posColumn is: <BLOCKQUOTE>\copydoc posColumn </BLOCKQUOTE>
|
||||
\see posColumn for more information */
|
||||
inline virtual void setPosColumn (size_t __value) { this->posColumn = static_cast<int>(__value); }
|
||||
void setPositionColumn (size_t __value);
|
||||
/*! \copydoc medianColumn
|
||||
\see see medianColumn for details */
|
||||
inline virtual void setMedianColumn(int __value)
|
||||
{
|
||||
this->medianColumn = __value;
|
||||
}
|
||||
void setMedianColumn(int __value);
|
||||
/*! \copydoc medianColumn
|
||||
\see see medianColumn for details */
|
||||
inline virtual int getMedianColumn() const
|
||||
{
|
||||
return this->medianColumn;
|
||||
}
|
||||
int getMedianColumn() const;
|
||||
/*! \brief sets the property medianColumn ( \copybrief medianColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
|
||||
\details Description of the parameter medianColumn is: <BLOCKQUOTE>\copydoc medianColumn </BLOCKQUOTE>
|
||||
\see medianColumn for more information */
|
||||
inline virtual void setMedianColumn (size_t __value) { this->medianColumn = static_cast<int>(__value); }
|
||||
void setMedianColumn (size_t __value);
|
||||
/*! \copydoc meanColumn
|
||||
\see see meanColumn for details */
|
||||
inline virtual void setMeanColumn(int __value)
|
||||
{
|
||||
this->meanColumn = __value;
|
||||
}
|
||||
void setMeanColumn(int __value);
|
||||
/*! \copydoc meanColumn
|
||||
\see see meanColumn for details */
|
||||
inline virtual int getMeanColumn() const
|
||||
{
|
||||
return this->meanColumn;
|
||||
}
|
||||
int getMeanColumn() const;
|
||||
/*! \brief sets the property meanColumn ( \copybrief meanColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
|
||||
\details Description of the parameter meanColumn is: <BLOCKQUOTE>\copydoc meanColumn </BLOCKQUOTE>
|
||||
\see meanColumn for more information */
|
||||
inline virtual void setMeanColumn (size_t __value) { this->meanColumn = static_cast<int>(__value); }
|
||||
void setMeanColumn (size_t __value);
|
||||
/*! \copydoc minColumn
|
||||
\see see minColumn for details */
|
||||
inline virtual void setMinColumn(int __value)
|
||||
{
|
||||
this->minColumn = __value;
|
||||
}
|
||||
void setMinColumn(int __value);
|
||||
/*! \copydoc minColumn
|
||||
\see see minColumn for details */
|
||||
inline virtual int getMinColumn() const
|
||||
{
|
||||
return this->minColumn;
|
||||
}
|
||||
int getMinColumn() const;
|
||||
/*! \brief sets the property minColumn ( \copybrief minColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
|
||||
\details Description of the parameter minColumn is: <BLOCKQUOTE>\copydoc minColumn </BLOCKQUOTE>
|
||||
\see minColumn for more information */
|
||||
inline virtual void setMinColumn( size_t __value) { this->minColumn = static_cast<int>(__value); }
|
||||
void setMinColumn( size_t __value);
|
||||
/*! \copydoc maxColumn
|
||||
\see see maxColumn for details */
|
||||
inline virtual void setMaxColumn(int __value)
|
||||
{
|
||||
this->maxColumn = __value;
|
||||
}
|
||||
void setMaxColumn(int __value);
|
||||
/*! \copydoc maxColumn
|
||||
\see see maxColumn for details */
|
||||
inline virtual int getMaxColumn() const
|
||||
{
|
||||
return this->maxColumn;
|
||||
}
|
||||
int getMaxColumn() const;
|
||||
/*! \brief sets the property maxColumn ( \copybrief maxColumn ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
|
||||
\details Description of the parameter maxColumn is: <BLOCKQUOTE>\copydoc maxColumn </BLOCKQUOTE>
|
||||
\see maxColumn for more information */
|
||||
inline virtual void setMaxColumn (size_t __value) { this->maxColumn = static_cast<int>(__value); }
|
||||
void setMaxColumn (size_t __value);
|
||||
/*! \copydoc percentile25Column
|
||||
\see see percentile25Column for details */
|
||||
inline virtual void setPercentile25Column(int __value)
|
||||
{
|
||||
this->percentile25Column = __value;
|
||||
}
|
||||
void setPercentile25Column(int __value);
|
||||
/*! \copydoc percentile25Column
|
||||
\see see percentile25Column for details */
|
||||
inline virtual int getPercentile25Column() const
|
||||
{
|
||||
return this->percentile25Column;
|
||||
}
|
||||
int getPercentile25Column() const;
|
||||
/*! \brief sets the property percentile25Column ( \copybrief percentile25Column ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
|
||||
\details Description of the parameter percentile25Column is: <BLOCKQUOTE>\copydoc percentile25Column </BLOCKQUOTE>
|
||||
\see percentile25Column for more information */
|
||||
inline virtual void setPercentile25Column (size_t __value) { this->percentile25Column = static_cast<int>(__value); }
|
||||
void setPercentile25Column (size_t __value);
|
||||
/*! \copydoc percentile75Column
|
||||
\see see percentile75Column for details */
|
||||
inline virtual void setPercentile75Column(int __value)
|
||||
{
|
||||
this->percentile75Column = __value;
|
||||
}
|
||||
void setPercentile75Column(int __value);
|
||||
/*! \copydoc percentile75Column
|
||||
\see see percentile75Column for details */
|
||||
inline virtual int getPercentile75Column() const
|
||||
{
|
||||
return this->percentile75Column;
|
||||
}
|
||||
int getPercentile75Column() const;
|
||||
/*! \brief sets the property percentile75Column ( \copybrief percentile75Column ) to the specified \a __value, where __value is static_cast'ed from size_t to int.
|
||||
\details Description of the parameter percentile75Column is: <BLOCKQUOTE>\copydoc percentile75Column </BLOCKQUOTE>
|
||||
\see percentile75Column for more information */
|
||||
inline virtual void setPercentile75Column (size_t __value) { this->percentile75Column = static_cast<int>(__value); }
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual void setColor(const QColor & __value)
|
||||
{
|
||||
this->color = __value;
|
||||
}
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual QColor getColor() const
|
||||
{
|
||||
return this->color;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual void setFillColor(const QColor & __value)
|
||||
{
|
||||
this->fillColor = __value;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual QColor getFillColor() const
|
||||
{
|
||||
return this->fillColor;
|
||||
}
|
||||
/*! \copydoc whiskerStyle
|
||||
\see see whiskerStyle for details */
|
||||
inline virtual void setWhiskerStyle(const Qt::PenStyle & __value)
|
||||
{
|
||||
this->whiskerStyle = __value;
|
||||
}
|
||||
/*! \copydoc whiskerStyle
|
||||
\see see whiskerStyle for details */
|
||||
inline virtual Qt::PenStyle getWhiskerStyle() const
|
||||
{
|
||||
return this->whiskerStyle;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual void setFillStyle(const Qt::BrushStyle & __value)
|
||||
{
|
||||
this->fillStyle = __value;
|
||||
}
|
||||
/*! \copydoc fillStyle
|
||||
\see see fillStyle for details */
|
||||
inline virtual Qt::BrushStyle getFillStyle() const
|
||||
{
|
||||
return this->fillStyle;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual void setLineWidth(double __value)
|
||||
{
|
||||
this->lineWidth = __value;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual double getLineWidth() const
|
||||
{
|
||||
return this->lineWidth;
|
||||
}
|
||||
/*! \copydoc boxWidth
|
||||
\see see boxWidth for details */
|
||||
inline virtual void setBoxWidth(double __value)
|
||||
{
|
||||
this->boxWidth = __value;
|
||||
}
|
||||
/*! \copydoc boxWidth
|
||||
\see see boxWidth for details */
|
||||
inline virtual double getBoxWidth() const
|
||||
{
|
||||
return this->boxWidth;
|
||||
}
|
||||
void setPercentile75Column (size_t __value);
|
||||
|
||||
/*! \copydoc meanSymbol
|
||||
\see see meanSymbol for details */
|
||||
inline virtual void setMeanSymbol(JKQTPGraphSymbols __value)
|
||||
{
|
||||
this->meanSymbol = __value;
|
||||
}
|
||||
/*! \copydoc meanSymbol
|
||||
\see see meanSymbol for details */
|
||||
inline virtual JKQTPGraphSymbols getMeanSymbol() const
|
||||
{
|
||||
return this->meanSymbol;
|
||||
}
|
||||
/*! \copydoc meanSymbolWidth
|
||||
\see see meanSymbolWidth for details */
|
||||
inline virtual void setMeanSymbolWidth(double __value)
|
||||
{
|
||||
this->meanSymbolWidth = __value;
|
||||
}
|
||||
/*! \copydoc meanSymbolWidth
|
||||
\see see meanSymbolWidth for details */
|
||||
inline virtual double getMeanSymbolWidth() const
|
||||
{
|
||||
return this->meanSymbolWidth;
|
||||
}
|
||||
/*! \copydoc meanSymbolSize
|
||||
\see see meanSymbolSize for details */
|
||||
inline virtual void setMeanSymbolSize(double __value)
|
||||
{
|
||||
this->meanSymbolSize = __value;
|
||||
}
|
||||
/*! \copydoc meanSymbolSize
|
||||
\see see meanSymbolSize for details */
|
||||
inline virtual double getMeanSymbolSize() const
|
||||
{
|
||||
return this->meanSymbolSize;
|
||||
}
|
||||
|
||||
protected:
|
||||
/** \brief which plot style to use from the parent plotter (via JKQTBasePlotter::getPlotStyle() and JKQTBasePlotter::getNextStyle() ) */
|
||||
int parentPlotStyle;
|
||||
|
||||
/** \brief the column that contains the x-component of the datapoints */
|
||||
int posColumn;
|
||||
@ -377,33 +291,13 @@ class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalGraph: public JKQTPGraph {
|
||||
int percentile25Column;
|
||||
/** \brief the column that contains the 75% percentile-component of the datapoints */
|
||||
int percentile75Column;
|
||||
/** \brief color of the lines */
|
||||
QColor color;
|
||||
/** \brief color of the box fill */
|
||||
QColor fillColor;
|
||||
/** \brief fill style for the box */
|
||||
Qt::BrushStyle fillStyle;
|
||||
/** \brief linestyle of the whisker lines */
|
||||
Qt::PenStyle whiskerStyle;
|
||||
/** \brief width (pt) of the graph, given in pt */
|
||||
double lineWidth;
|
||||
/** \brief width of box in percent of distance between the current two posColumn values
|
||||
* if we only plot one box&whiskers then this is the width in plot coordinates */
|
||||
double boxWidth;
|
||||
/** \brief which symbol to use for the mean */
|
||||
JKQTPGraphSymbols meanSymbol;
|
||||
/** \brief size (diameter in pt) of the symbol for the mean */
|
||||
double meanSymbolSize;
|
||||
/** \brief width (in pt) of the lines used to plot the symbol for the mean */
|
||||
double meanSymbolWidth;
|
||||
|
||||
QBrush getBrush(JKQTPEnhancedPainter& painter) const;
|
||||
QPen getLinePen(JKQTPEnhancedPainter &painter) const;
|
||||
/** \brief if \c !=Unsorted, the data is sorted before plotting */
|
||||
DataSortOrder sortData;
|
||||
/** \brief this array contains the order of indices, in which to access the data in the data columns */
|
||||
QVector<int> sortedIndices;
|
||||
|
||||
virtual void intSortData() ;
|
||||
|
||||
inline int getDataIndex(int i) {
|
||||
if (sortData==Unsorted) return i;
|
||||
return sortedIndices.value(i,i);
|
||||
@ -472,7 +366,7 @@ class JKQTP_LIB_EXPORT JKQTPBoxplotHorizontalGraph: public JKQTPBoxplotVerticalG
|
||||
|
||||
\image html boxplots.png
|
||||
*/
|
||||
class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalElement: public JKQTPPlotObject {
|
||||
class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalElement: public JKQTPPlotObject, public JKQTPGraphBoxplotStyleMixin {
|
||||
Q_OBJECT
|
||||
public:
|
||||
/** \brief class constructor */
|
||||
@ -502,237 +396,67 @@ class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalElement: public JKQTPPlotObject {
|
||||
|
||||
/*! \copydoc pos
|
||||
\see see pos for details */
|
||||
inline virtual void setPos(double __value)
|
||||
{
|
||||
this->pos = __value;
|
||||
}
|
||||
void setPos(double __value);
|
||||
/*! \copydoc pos
|
||||
\see see pos for details */
|
||||
inline virtual double getPos() const
|
||||
{
|
||||
return this->pos;
|
||||
}
|
||||
double getPos() const;
|
||||
/*! \copydoc median
|
||||
\see see median for details */
|
||||
inline virtual void setMedian(double __value)
|
||||
{
|
||||
if (this->median != __value) {
|
||||
this->median = __value;
|
||||
drawMedian=true;
|
||||
}
|
||||
}
|
||||
void setMedian(double __value);
|
||||
/*! \copydoc median
|
||||
\see see median for details */
|
||||
inline virtual double getMedian() const
|
||||
{
|
||||
return this->median;
|
||||
}
|
||||
double getMedian() const;
|
||||
/*! \copydoc mean
|
||||
\see see mean for details */
|
||||
inline virtual void setMean(double __value)
|
||||
{
|
||||
if (this->mean != __value) {
|
||||
this->mean = __value;
|
||||
drawMean=true;
|
||||
}
|
||||
}
|
||||
void setMean(double __value);
|
||||
/*! \copydoc mean
|
||||
\see see mean for details */
|
||||
inline virtual double getMean() const
|
||||
{
|
||||
return this->mean;
|
||||
}
|
||||
double getMean() const;
|
||||
/*! \copydoc min
|
||||
\see see min for details */
|
||||
inline virtual void setMin(double __value)
|
||||
{
|
||||
if (this->min != __value) {
|
||||
this->min = __value;
|
||||
drawMinMax=true;
|
||||
}
|
||||
}
|
||||
void setMin(double __value);
|
||||
/*! \copydoc min
|
||||
\see see min for details */
|
||||
inline virtual double getMin() const
|
||||
{
|
||||
return this->min;
|
||||
}
|
||||
double getMin() const;
|
||||
/*! \copydoc max
|
||||
\see see max for details */
|
||||
inline virtual void setMax(double __value)
|
||||
{
|
||||
if (this->max != __value) {
|
||||
this->max = __value;
|
||||
drawMinMax=true;
|
||||
}
|
||||
}
|
||||
void setMax(double __value);
|
||||
/*! \copydoc max
|
||||
\see see max for details */
|
||||
inline virtual double getMax() const
|
||||
{
|
||||
return this->max;
|
||||
}
|
||||
double getMax() const;
|
||||
/*! \copydoc percentile25
|
||||
\see see percentile25 for details */
|
||||
inline virtual void setPercentile25(double __value)
|
||||
{
|
||||
this->percentile25 = __value;
|
||||
}
|
||||
void setPercentile25(double __value);
|
||||
/*! \copydoc percentile25
|
||||
\see see percentile25 for details */
|
||||
inline virtual double getPercentile25() const
|
||||
{
|
||||
return this->percentile25;
|
||||
}
|
||||
double getPercentile25() const;
|
||||
/*! \copydoc percentile75
|
||||
\see see percentile75 for details */
|
||||
inline virtual void setPercentile75(double __value)
|
||||
{
|
||||
this->percentile75 = __value;
|
||||
}
|
||||
void setPercentile75(double __value);
|
||||
/*! \copydoc percentile75
|
||||
\see see percentile75 for details */
|
||||
inline virtual double getPercentile75() const
|
||||
{
|
||||
return this->percentile75;
|
||||
}
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual void setColor(const QColor & __value)
|
||||
{
|
||||
this->color = __value;
|
||||
}
|
||||
/*! \copydoc color
|
||||
\see see color for details */
|
||||
inline virtual QColor getColor() const
|
||||
{
|
||||
return this->color;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual void setFillColor(const QColor & __value)
|
||||
{
|
||||
this->fillColor = __value;
|
||||
}
|
||||
/*! \copydoc fillColor
|
||||
\see see fillColor for details */
|
||||
inline virtual QColor getFillColor() const
|
||||
{
|
||||
return this->fillColor;
|
||||
}
|
||||
/*! \copydoc whiskerStyle
|
||||
\see see whiskerStyle for details */
|
||||
inline virtual void setWhiskerStyle(const Qt::PenStyle & __value)
|
||||
{
|
||||
this->whiskerStyle = __value;
|
||||
}
|
||||
/*! \copydoc whiskerStyle
|
||||
\see see whiskerStyle for details */
|
||||
inline virtual Qt::PenStyle getWhiskerStyle() const
|
||||
{
|
||||
return this->whiskerStyle;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual void setLineWidth(double __value)
|
||||
{
|
||||
this->lineWidth = __value;
|
||||
}
|
||||
/*! \copydoc lineWidth
|
||||
\see see lineWidth for details */
|
||||
inline virtual double getLineWidth() const
|
||||
{
|
||||
return this->lineWidth;
|
||||
}
|
||||
/*! \copydoc boxWidth
|
||||
\see see boxWidth for details */
|
||||
inline virtual void setBoxWidth(double __value)
|
||||
{
|
||||
this->boxWidth = __value;
|
||||
}
|
||||
/*! \copydoc boxWidth
|
||||
\see see boxWidth for details */
|
||||
inline virtual double getBoxWidth() const
|
||||
{
|
||||
return this->boxWidth;
|
||||
}
|
||||
double getPercentile75() const;
|
||||
|
||||
/*! \copydoc meanSymbol
|
||||
\see see meanSymbol for details */
|
||||
inline virtual void setMeanSymbol(JKQTPGraphSymbols __value)
|
||||
{
|
||||
this->meanSymbol = __value;
|
||||
}
|
||||
/*! \copydoc meanSymbol
|
||||
\see see meanSymbol for details */
|
||||
inline virtual JKQTPGraphSymbols getMeanSymbol() const
|
||||
{
|
||||
return this->meanSymbol;
|
||||
}
|
||||
/*! \copydoc meanSymbolWidth
|
||||
\see see meanSymbolWidth for details */
|
||||
inline virtual void setMeanSymbolWidth(double __value)
|
||||
{
|
||||
this->meanSymbolWidth = __value;
|
||||
}
|
||||
/*! \copydoc meanSymbolWidth
|
||||
\see see meanSymbolWidth for details */
|
||||
inline virtual double getMeanSymbolWidth() const
|
||||
{
|
||||
return this->meanSymbolWidth;
|
||||
}
|
||||
/*! \copydoc meanSymbolSize
|
||||
\see see meanSymbolSize for details */
|
||||
inline virtual void setMeanSymbolSize(double __value)
|
||||
{
|
||||
this->meanSymbolSize = __value;
|
||||
}
|
||||
/*! \copydoc meanSymbolSize
|
||||
\see see meanSymbolSize for details */
|
||||
inline virtual double getMeanSymbolSize() const
|
||||
{
|
||||
return this->meanSymbolSize;
|
||||
}
|
||||
/*! \copydoc drawMean
|
||||
\see see drawMean for details */
|
||||
inline virtual void setDrawMean(bool __value)
|
||||
{
|
||||
this->drawMean = __value;
|
||||
}
|
||||
void setDrawMean(bool __value);
|
||||
/*! \copydoc drawMean
|
||||
\see see drawMean for details */
|
||||
inline virtual bool getDrawMean() const
|
||||
{
|
||||
return this->drawMean;
|
||||
}
|
||||
bool getDrawMean() const;
|
||||
/*! \copydoc drawMedian
|
||||
\see see drawMedian for details */
|
||||
inline virtual void setDrawMedian(bool __value)
|
||||
{
|
||||
this->drawMedian = __value;
|
||||
}
|
||||
void setDrawMedian(bool __value);
|
||||
/*! \copydoc drawMedian
|
||||
\see see drawMedian for details */
|
||||
inline virtual bool getDrawMedian() const
|
||||
{
|
||||
return this->drawMedian;
|
||||
}
|
||||
bool getDrawMedian() const;
|
||||
/*! \copydoc drawMinMax
|
||||
\see see drawMinMax for details */
|
||||
inline virtual void setDrawMinMax(bool __value)
|
||||
{
|
||||
this->drawMinMax = __value;
|
||||
}
|
||||
void setDrawMinMax(bool __value);
|
||||
/*! \copydoc drawMinMax
|
||||
\see see drawMinMax for details */
|
||||
inline virtual bool getDrawMinMax() const
|
||||
{
|
||||
return this->drawMinMax;
|
||||
}
|
||||
bool getDrawMinMax() const;
|
||||
|
||||
protected:
|
||||
/** \brief which plot style to use from the parent plotter (via JKQTBasePlotter::getPlotStyle() and JKQTBasePlotter::getNextStyle() ) */
|
||||
int parentPlotStyle;
|
||||
|
||||
/** \brief the column that contains the x-component of the datapoints */
|
||||
double pos;
|
||||
@ -754,27 +478,6 @@ class JKQTP_LIB_EXPORT JKQTPBoxplotVerticalElement: public JKQTPPlotObject {
|
||||
double percentile25;
|
||||
/** \brief the column that contains the 75% percentile-component of the datapoints */
|
||||
double percentile75;
|
||||
/** \brief color of the lines */
|
||||
QColor color;
|
||||
/** \brief color of the box fill */
|
||||
QColor fillColor;
|
||||
/** \brief fill style for the box */
|
||||
Qt::BrushStyle fillStyle;
|
||||
/** \brief linestyle of the whisker lines */
|
||||
Qt::PenStyle whiskerStyle;
|
||||
/** \brief width (pixels) of the graph */
|
||||
double lineWidth;
|
||||
/** \brief width of box, given in pt */
|
||||
double boxWidth;
|
||||
/** \brief which symbol to use for the mean */
|
||||
JKQTPGraphSymbols meanSymbol;
|
||||
/** \brief size (diameter in pt) of the symbol for the mean */
|
||||
double meanSymbolSize;
|
||||
/** \brief width (in pt) of the lines used to plot the symbol for the mean */
|
||||
double meanSymbolWidth;
|
||||
|
||||
QBrush getBrush(JKQTPEnhancedPainter& painter) const;
|
||||
QPen getLinePen(JKQTPEnhancedPainter& painter) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -356,7 +356,7 @@ void JKQTPColumnOverlayImageEnhanced::draw(JKQTPEnhancedPainter &painter) {
|
||||
size_t imgSize=parent->getDatastore()->getColumn(imageColumn).getRows();
|
||||
this->data=(bool*)malloc(imgSize*sizeof(bool));
|
||||
this->Ny=imgSize/this->Nx;
|
||||
for (int i=0; i<imgSize; i++) {
|
||||
for (size_t i=0; i<imgSize; i++) {
|
||||
data[i]=(d[i]!=0.0);
|
||||
}
|
||||
JKQTPOverlayImageEnhanced::draw(painter);
|
||||
|
@ -192,7 +192,7 @@ void JKQTPSingleColumnSymbolsGraph::draw(JKQTPEnhancedPainter &painter)
|
||||
void JKQTPSingleColumnSymbolsGraph::drawKeyMarker(JKQTPEnhancedPainter &painter, QRectF &rect)
|
||||
{
|
||||
const double minSize=qMin(rect.width(), rect.height());
|
||||
const double maxSize=qMax(rect.width(), rect.height());
|
||||
//const double maxSize=qMax(rect.width(), rect.height());
|
||||
double symbolSize=parent->pt2px(painter, this->getSymbolSize());
|
||||
if (symbolSize>minSize*0.9) symbolSize=minSize*0.9;
|
||||
double symbolWidth=parent->pt2px(painter, this->getSymbolLineWidth()*parent->getLineWidthMultiplier());
|
||||
|
Loading…
Reference in New Issue
Block a user