Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Sypify core.QgsHistogram
  • Loading branch information
arnaud-morvan authored and 3nids committed May 4, 2017
1 parent 8e61d48 commit 264c902
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 35 deletions.
1 change: 0 additions & 1 deletion python/auto_sip.blacklist
Expand Up @@ -14,7 +14,6 @@ core/qgsgeometrysimplifier.sip
core/qgsgeometryvalidator.sip
core/qgsgml.sip
core/qgsgmlschema.sip
core/qgshistogram.sip
core/qgsmaptopixelgeometrysimplifier.sip
core/qgstransaction.sip
core/qgstransactiongroup.sip
Expand Down
114 changes: 80 additions & 34 deletions python/core/qgshistogram.sip
@@ -1,60 +1,106 @@
/** \ingroup core
* \class QgsHistogram
* \brief Calculator for a numeric histogram from a list of values.
*
* \note Added in version 2.9
*/
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgshistogram.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/








class QgsHistogram
{
%Docstring
Calculator for a numeric histogram from a list of values.

.. versionadded:: 2.9
%End

%TypeHeaderCode
#include "qgshistogram.h"
%End

public:

QgsHistogram();

virtual ~QgsHistogram();

/** Assigns numeric source values for the histogram.
* @param values list of doubles
*/
void setValues( const QList<double> &values );
%Docstring
Assigns numeric source values for the histogram.
\param values list of doubles
%End

bool setValues( const QgsVectorLayer *layer, const QString &fieldOrExpression, QgsFeedback *feedback = 0 );
%Docstring
Assigns numeric source values for the histogram from a vector layer's field or as the
result of an expression.
\param layer vector layer
\param fieldOrExpression field name or expression to be evaluated
\param feedback optional feedback object to allow cancelation of calculation
:return: true if values were successfully set
:rtype: bool
%End

/** Calculates the optimal bin width using the Freedman-Diaconis rule. Bins widths are
* determined by the inter-quartile range of values and the number of values.
* @returns optimal width for bins
* @see optimalNumberBins
* @note values must first be specified using @link setValues @endlink
*/
double optimalBinWidth() const;
%Docstring
Calculates the optimal bin width using the Freedman-Diaconis rule. Bins widths are
determined by the inter-quartile range of values and the number of values.
:return: optimal width for bins
.. seealso:: optimalNumberBins
.. note::

values must first be specified using setValues()
:rtype: float
%End

/** Returns the optimal number of bins for the source values, calculated using the
* Freedman-Diaconis rule. The number of bins are determined by the inter-quartile range
* of values and the number of values.
* @returns optimal number of bins
* @see optimalBinWidth
* @note values must first be specified using @link setValues @endlink
*/
int optimalNumberBins() const;
%Docstring
Returns the optimal number of bins for the source values, calculated using the
Freedman-Diaconis rule. The number of bins are determined by the inter-quartile range
of values and the number of values.
:return: optimal number of bins
.. seealso:: optimalBinWidth
.. note::

values must first be specified using setValues()
:rtype: int
%End

/** Returns a list of edges for the histogram for a specified number of bins. This list
* will be length bins + 1, as both the first and last value are also included.
* @param bins number of bins
* @return list of bin edges
* @note values must first be specified using @link setValues @endlink
*/
QList<double> binEdges( int bins ) const;
%Docstring
Returns a list of edges for the histogram for a specified number of bins. This list
will be length bins + 1, as both the first and last value are also included.
\param bins number of bins
:return: list of bin edges
.. note::

values must first be specified using setValues()
:rtype: list of float
%End

/** Returns the calculated list of the counts for the histogram bins.
* @param bins number of histogram bins
* @return list of histogram counts
* @note values must first be specified using @link setValues @endlink
*/
QList<int> counts( int bins ) const;
%Docstring
Returns the calculated list of the counts for the histogram bins.
\param bins number of histogram bins
:return: list of histogram counts
.. note::

values must first be specified using setValues()
:rtype: list of int
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgshistogram.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

0 comments on commit 264c902

Please sign in to comment.