mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Add QChart to Python Chart (2b of 5)
Basics now in place to plot line, scatter, pie and bar charts. This commit finishes off the final bit of part 2, adding axes control. A new GC api, GC.setAxis(..) has been added allowing fine grained control on the axes added automatically. They reference axes by name, based upon the xaxis and yaxis parameters passed to the GC.setCurve(..) function. GC.setAxis(..) should be called /after/ the curves are added since it will not create axes in advance.
This commit is contained in:
@@ -299,7 +299,7 @@ PythonChart::PythonChart(Context *context, bool ridesummary) : GcChartWindow(con
|
||||
chartview=NULL;
|
||||
canvas=NULL;
|
||||
barseries=NULL;
|
||||
baraxisx=NULL;
|
||||
bottom=left=true;
|
||||
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||
mainLayout->setSpacing(0);
|
||||
@@ -369,6 +369,8 @@ PythonChart::PythonChart(Context *context, bool ridesummary) : GcChartWindow(con
|
||||
connect(this, SIGNAL(emitChart(QString,int,bool)), this, SLOT(configChart(QString,int,bool)));
|
||||
connect(this, SIGNAL(emitCurve(QString,QVector<double>,QVector<double>,QString,QString,QStringList,QStringList,int,int,int,QString,int,bool)),
|
||||
this, SLOT( setCurve(QString,QVector<double>,QVector<double>,QString,QString,QStringList,QStringList,int,int,int,QString,int,bool)));
|
||||
connect(this, SIGNAL(emitAxis(QString,bool,int,double,double,int,QString,QString,bool,QStringList)),
|
||||
this, SLOT(configAxis(QString,bool,int,double,double,int,QString,QString,bool,QStringList)));
|
||||
|
||||
if (ridesummary) {
|
||||
|
||||
@@ -644,6 +646,9 @@ PythonChart::runScript()
|
||||
|
||||
}
|
||||
|
||||
// polish the chart if needed
|
||||
if (qchart) polishChart();
|
||||
|
||||
// turn off updates for a sec
|
||||
setUpdatesEnabled(true);
|
||||
|
||||
@@ -657,9 +662,6 @@ PythonChart::runScript()
|
||||
// scale to fit and center on output
|
||||
//canvas->fitInView(canvas->sceneRect(), Qt::KeepAspectRatio);
|
||||
|
||||
// polish the chart if needed
|
||||
if (qchart) polishChart();
|
||||
|
||||
// clear context
|
||||
python->canvas = NULL;
|
||||
python->chart = NULL;
|
||||
@@ -688,6 +690,37 @@ PythonChart::setCurve(QString name, QVector<double> xseries, QVector<double> yse
|
||||
}
|
||||
}
|
||||
|
||||
// lets find that axis - even blank ones
|
||||
AxisInfo *xaxis, *yaxis;
|
||||
xaxis=axisinfos.value(xname);
|
||||
yaxis=axisinfos.value(yname);
|
||||
if (xaxis==NULL) {
|
||||
xaxis=new AxisInfo(Qt::Horizontal, xname);
|
||||
|
||||
// default alignment toggles
|
||||
xaxis->align = bottom ? Qt::AlignBottom : Qt::AlignTop;
|
||||
bottom = !bottom;
|
||||
|
||||
// use marker color for x axes
|
||||
xaxis->labelcolor = xaxis->axiscolor = GColor(CPLOTMARKER);
|
||||
|
||||
// add to list
|
||||
axisinfos.insert(xname, xaxis);
|
||||
}
|
||||
if (yaxis==NULL) {
|
||||
yaxis=new AxisInfo(Qt::Vertical, yname);
|
||||
|
||||
// default alignment toggles
|
||||
yaxis->align = left ? Qt::AlignLeft : Qt::AlignRight;
|
||||
left = !left;
|
||||
|
||||
// yaxis color matches, but not done for xaxis above
|
||||
yaxis->labelcolor = yaxis->axiscolor = QColor(color);
|
||||
|
||||
// add to list
|
||||
axisinfos.insert(yname, yaxis);
|
||||
}
|
||||
|
||||
switch (charttype) {
|
||||
default:
|
||||
|
||||
@@ -706,9 +739,14 @@ PythonChart::setCurve(QString name, QVector<double> xseries, QVector<double> yse
|
||||
add->setOpacity(double(opacity) / 100.0); // 0-100% to 0.0-1.0 values
|
||||
|
||||
// data
|
||||
for (int i=0; i<xseries.size() && i<yseries.size(); i++)
|
||||
for (int i=0; i<xseries.size() && i<yseries.size(); i++) {
|
||||
add->append(xseries.at(i), yseries.at(i));
|
||||
|
||||
// tell axis about the data
|
||||
xaxis->point(xseries.at(i), yseries.at(i));
|
||||
yaxis->point(xseries.at(i), yseries.at(i));
|
||||
}
|
||||
|
||||
// hardware support?
|
||||
chartview->setRenderHint(QPainter::Antialiasing);
|
||||
add->setUseOpenGL(opengl); // for scatter or line only apparently
|
||||
@@ -718,6 +756,8 @@ PythonChart::setCurve(QString name, QVector<double> xseries, QVector<double> yse
|
||||
|
||||
// add to list of curves
|
||||
curves.insert(name,add);
|
||||
xaxis->series.append(add);
|
||||
yaxis->series.append(add);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -736,9 +776,15 @@ PythonChart::setCurve(QString name, QVector<double> xseries, QVector<double> yse
|
||||
add->setOpacity(double(opacity) / 100.0); // 0-100% to 0.0-1.0 values
|
||||
|
||||
// data
|
||||
for (int i=0; i<xseries.size() && i<yseries.size(); i++)
|
||||
for (int i=0; i<xseries.size() && i<yseries.size(); i++) {
|
||||
add->append(xseries.at(i), yseries.at(i));
|
||||
|
||||
// tell axis about the data
|
||||
xaxis->point(xseries.at(i), yseries.at(i));
|
||||
yaxis->point(xseries.at(i), yseries.at(i));
|
||||
|
||||
}
|
||||
|
||||
// hardware support?
|
||||
chartview->setRenderHint(QPainter::Antialiasing);
|
||||
add->setUseOpenGL(opengl); // for scatter or line only apparently
|
||||
@@ -750,9 +796,12 @@ PythonChart::setCurve(QString name, QVector<double> xseries, QVector<double> yse
|
||||
|
||||
// add to list of curves
|
||||
curves.insert(name,add);
|
||||
xaxis->series.append(add);
|
||||
yaxis->series.append(add);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case GC_CHART_BAR:
|
||||
{
|
||||
// set up the barsets
|
||||
@@ -766,17 +815,19 @@ PythonChart::setCurve(QString name, QVector<double> xseries, QVector<double> yse
|
||||
for (int i=0; i<yseries.size(); i++) {
|
||||
double value = yseries.at(i);
|
||||
*add << value;
|
||||
if (value < barminy) barminy=value;
|
||||
if (value > barmaxy) barmaxy=value;
|
||||
yaxis->point(i,value);
|
||||
xaxis->point(i,value);
|
||||
}
|
||||
|
||||
// keep track of number of categories
|
||||
if (add->count() > maxcategories) maxcategories=add->count();
|
||||
// we are very particular regarding axis
|
||||
yaxis->type = AxisInfo::CONTINUOUS;
|
||||
xaxis->type = AxisInfo::CATEGORY;
|
||||
|
||||
// add to list of barsets
|
||||
barsets << add;
|
||||
}
|
||||
break;
|
||||
|
||||
case GC_CHART_PIE:
|
||||
{
|
||||
// set up the curves
|
||||
@@ -821,51 +872,130 @@ PythonChart::polishChart()
|
||||
{
|
||||
if (!qchart) return;
|
||||
|
||||
// must be done when all series are added
|
||||
if (charttype==GC_CHART_LINE || charttype==GC_CHART_SCATTER) {
|
||||
qchart->createDefaultAxes();
|
||||
}
|
||||
|
||||
// more aesthetics
|
||||
// basic aesthetics
|
||||
qchart->legend()->setMarkerShape(QLegend::MarkerShapeRectangle);
|
||||
qchart->setDropShadowEnabled(false);
|
||||
|
||||
// no more than 1 category axis since barsets are all assigned.
|
||||
bool donecategory=false;
|
||||
|
||||
// Create axes - for everyone except pie charts that don't have any
|
||||
if (charttype != GC_CHART_PIE) {
|
||||
// create desired axis
|
||||
foreach(AxisInfo *axisinfo, axisinfos) {
|
||||
//fprintf(stderr, "Axis: %s, orient:%s, type:%d\n",axisinfo->name.toStdString().c_str(),axisinfo->orientation==Qt::Vertical?"vertical":"horizontal",(int)axisinfo->type);
|
||||
//fflush(stderr);
|
||||
QAbstractAxis *add=NULL;
|
||||
switch (axisinfo->type) {
|
||||
case AxisInfo::DATERANGE: // TODO
|
||||
case AxisInfo::TIME: // TODO
|
||||
case AxisInfo::CONTINUOUS:
|
||||
{
|
||||
QValueAxis *vaxis= new QValueAxis(qchart);
|
||||
add=vaxis; // gets added later
|
||||
|
||||
vaxis->setMin(axisinfo->min());
|
||||
vaxis->setMax(axisinfo->max());
|
||||
|
||||
// attach to the chart
|
||||
qchart->addAxis(add, axisinfo->locate());
|
||||
}
|
||||
break;
|
||||
case AxisInfo::CATEGORY:
|
||||
{
|
||||
if (!donecategory) {
|
||||
|
||||
donecategory=true;
|
||||
|
||||
QBarCategoryAxis *caxis = new QBarCategoryAxis(qchart);
|
||||
add=caxis;
|
||||
|
||||
// add the bar series
|
||||
if (!barseries) { barseries = new QBarSeries(); qchart->addSeries(barseries); }
|
||||
else barseries->clear();
|
||||
|
||||
// add the new barsets
|
||||
foreach (QBarSet *bs, barsets)
|
||||
barseries->append(bs);
|
||||
|
||||
// attach before addig barseries
|
||||
qchart->addAxis(add, axisinfo->locate());
|
||||
|
||||
// attach to category axis
|
||||
barseries->attachAxis(caxis);
|
||||
|
||||
// category labels
|
||||
for(int i=axisinfo->categories.count(); i<=axisinfo->maxx; i++)
|
||||
axisinfo->categories << QString("%1").arg(i+1);
|
||||
caxis->setCategories(axisinfo->categories);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// at this point the basic settngs have been done and the axis
|
||||
// is attached to the chart, so we can go ahead and apply common settings
|
||||
if (add) {
|
||||
|
||||
// once we've done the basics, lets do the aesthetics
|
||||
if (axisinfo->name != "x" && axisinfo->name != "y") // equivalent to being blank
|
||||
add->setTitleText(axisinfo->name);
|
||||
add->setLinePenColor(axisinfo->axiscolor);
|
||||
add->setLabelsColor(axisinfo->labelcolor);
|
||||
add->setTitleBrush(QBrush(axisinfo->labelcolor));
|
||||
|
||||
// add the series that are associated with this
|
||||
foreach(QAbstractSeries *series, axisinfo->series)
|
||||
series->attachAxis(add);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (charttype ==GC_CHART_PIE) {
|
||||
// pie, never want a legend
|
||||
qchart->legend()->setVisible(false);
|
||||
}
|
||||
|
||||
//barseries
|
||||
if (charttype==GC_CHART_BAR) {
|
||||
// barseries special case
|
||||
if (charttype==GC_CHART_BAR && barseries) {
|
||||
|
||||
// add the bar series
|
||||
if (!barseries) { barseries = new QBarSeries(); qchart->addSeries(barseries); }
|
||||
else barseries->clear();
|
||||
|
||||
// add the new barsets
|
||||
foreach (QBarSet *bs, barsets)
|
||||
barseries->append(bs);
|
||||
|
||||
// create the category axis
|
||||
QStringList categories;
|
||||
for(int i=1; i<=maxcategories; i++) {
|
||||
categories << QString("%1").arg(i);
|
||||
}
|
||||
|
||||
// do we have the x axis already?
|
||||
if (baraxisx==NULL) {
|
||||
baraxisx = new QBarCategoryAxis();
|
||||
qchart->addAxis(baraxisx, Qt::AlignBottom);
|
||||
barseries->attachAxis(baraxisx);
|
||||
} else baraxisx->clear();
|
||||
baraxisx->append(categories);
|
||||
|
||||
// do we have the y axis already?
|
||||
if (baraxisy==NULL) {
|
||||
baraxisy = new QValueAxis();
|
||||
qchart->addAxis(baraxisy, Qt::AlignLeft);
|
||||
barseries->attachAxis(baraxisy);
|
||||
}
|
||||
baraxisy->setRange(barminy,barmaxy);
|
||||
// need to attach barseries to the value axes
|
||||
foreach(QAbstractAxis *axis, qchart->axes(Qt::Vertical))
|
||||
barseries->attachAxis(axis);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
PythonChart::configAxis(QString name, bool visible, int align, double min, double max,
|
||||
int type, QString labelcolor, QString color, bool log, QStringList categories)
|
||||
{
|
||||
AxisInfo *axis = axisinfos.value(name);
|
||||
if (axis == NULL) return false;
|
||||
|
||||
// lets update the settings then
|
||||
axis->visible = visible;
|
||||
|
||||
// -1 if not passed
|
||||
if (align == 0) axis->align = Qt::AlignBottom;
|
||||
if (align == 1) axis->align = Qt::AlignLeft;
|
||||
if (align == 2) axis->align = Qt::AlignTop;
|
||||
if (align == 3) axis->align = Qt::AlignRight;
|
||||
|
||||
// -1 if not passed
|
||||
if (min != -1) axis->minx = axis->miny = min;
|
||||
if (max != -1) axis->maxx = axis->maxy = max;
|
||||
|
||||
// type
|
||||
if (type != -1) axis->type = static_cast<AxisInfo::AxisInfoType>(type);
|
||||
|
||||
// color
|
||||
if (labelcolor != "") axis->labelcolor=QColor(labelcolor);
|
||||
if (color != "") axis->axiscolor=QColor(color);
|
||||
|
||||
// log .. hmmm
|
||||
axis->log = log;
|
||||
|
||||
// categories
|
||||
if (categories.count()) axis->categories = categories;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "GoldenCheetah.h"
|
||||
#include "Context.h"
|
||||
#include "Athlete.h"
|
||||
#include "Colors.h"
|
||||
#include "RCanvas.h"
|
||||
|
||||
// keep aligned to library.py
|
||||
@@ -93,6 +94,59 @@ private:
|
||||
int promptStartIndex = 4;
|
||||
};
|
||||
|
||||
// axis info, might become generic later (i.e. use in other charts)
|
||||
class AxisInfo {
|
||||
public:
|
||||
enum axisinfoType { CONTINUOUS=0, // Continious range
|
||||
DATERANGE=1, // Date
|
||||
TIME=2, // Duration, Time
|
||||
CATEGORY=3 // labelled with categories
|
||||
};
|
||||
typedef enum axisinfoType AxisInfoType;
|
||||
|
||||
AxisInfo(Qt::Orientations orientation, QString name) : name(name), orientation(orientation) {
|
||||
miny=maxy=minx=maxx=0;
|
||||
fixed=log=false;
|
||||
visible=minorgrid=majorgrid=true;
|
||||
type=CONTINUOUS;
|
||||
axiscolor=labelcolor=GColor(CPLOTMARKER);
|
||||
}
|
||||
|
||||
void point(double x, double y) {
|
||||
if (fixed) return;
|
||||
if (x>maxx) maxx=x;
|
||||
if (x<minx) minx=x;
|
||||
if (y>maxy) maxy=y;
|
||||
if (y<miny) miny=y;
|
||||
}
|
||||
|
||||
double min() {
|
||||
if (orientation == Qt::Horizontal) return minx;
|
||||
else return miny;
|
||||
}
|
||||
double max() {
|
||||
if (orientation == Qt::Horizontal) return maxx;
|
||||
else return maxy;
|
||||
}
|
||||
|
||||
Qt::AlignmentFlag locate() {
|
||||
return align;
|
||||
}
|
||||
|
||||
// series we are associated with
|
||||
QList<QAbstractSeries*> series;
|
||||
|
||||
// data is all public to avoid tedious get/set
|
||||
QString name;
|
||||
Qt::Orientations orientation;
|
||||
Qt::AlignmentFlag align;
|
||||
double miny, maxy, minx, maxx; // updated as we see points, set the range
|
||||
bool visible,fixed, log, minorgrid, majorgrid; // settings
|
||||
QColor labelcolor, axiscolor; // aesthetics
|
||||
QStringList categories;
|
||||
AxisInfoType type; // what type of axis is this?
|
||||
};
|
||||
|
||||
// the chart
|
||||
class PythonChart : public GcChartWindow, public PythonHost {
|
||||
|
||||
@@ -140,11 +194,12 @@ class PythonChart : public GcChartWindow, public PythonHost {
|
||||
|
||||
signals:
|
||||
void setUrl(QUrl);
|
||||
bool emitChart(QString title, int type, bool animate);
|
||||
bool emitCurve(QString name, QVector<double> xseries, QVector<double> yseries, QString xname, QString yname,
|
||||
void emitChart(QString title, int type, bool animate);
|
||||
void emitCurve(QString name, QVector<double> xseries, QVector<double> yseries, QString xname, QString yname,
|
||||
QStringList labels, QStringList colors,
|
||||
int line, int symbol, int size, QString color, int opacity, bool opengl);
|
||||
|
||||
void emitAxis(QString name, bool visible, int align, double min, double max,
|
||||
int type, QString labelcolor, QString color, bool log, QStringList categories);
|
||||
|
||||
public slots:
|
||||
void configChanged(qint32);
|
||||
@@ -178,12 +233,12 @@ class PythonChart : public GcChartWindow, public PythonHost {
|
||||
qchart->removeAxis(axis);
|
||||
delete axis;
|
||||
}
|
||||
baraxisx=NULL; //leak?
|
||||
baraxisy=NULL; //leak?
|
||||
foreach(AxisInfo *axisinfo, axisinfos) delete axisinfo;
|
||||
axisinfos.clear();
|
||||
|
||||
left=true;
|
||||
bottom=true;
|
||||
barsets.clear();
|
||||
maxcategories=0;
|
||||
barmaxy=0;
|
||||
barminy=0;
|
||||
|
||||
// remember type
|
||||
charttype=type;
|
||||
@@ -203,6 +258,9 @@ class PythonChart : public GcChartWindow, public PythonHost {
|
||||
QStringList labels, QStringList colors,
|
||||
int line, int symbol, int size, QString color, int opacity, bool opengl);
|
||||
|
||||
bool configAxis(QString name, bool visible, int align, double min, double max,
|
||||
int type, QString labelcolor, QString color, bool log, QStringList categories);
|
||||
|
||||
protected:
|
||||
// enable stopping long running scripts
|
||||
bool eventFilter(QObject *, QEvent *e);
|
||||
@@ -215,18 +273,20 @@ class PythonChart : public GcChartWindow, public PythonHost {
|
||||
QString text; // if Rtool not alive
|
||||
bool ridesummary;
|
||||
int charttype;
|
||||
int maxcategories;
|
||||
|
||||
// curves
|
||||
QMap<QString, QAbstractSeries *>curves;
|
||||
|
||||
// axes
|
||||
QMap<QString, AxisInfo *>axisinfos;
|
||||
|
||||
// barsets
|
||||
QList<QBarSet*> barsets;
|
||||
QStringList categories;
|
||||
QBarSeries *barseries;
|
||||
QBarCategoryAxis *baraxisx;
|
||||
QValueAxis *baraxisy;
|
||||
double barmaxy,barminy;
|
||||
|
||||
// axis placement (before user interacts)
|
||||
// alternates as axis added
|
||||
bool left, bottom;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -102,6 +102,14 @@ Bindings::setCurve(QString name, PyObject *xseries, PyObject *yseries, QString x
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
Bindings::configAxis(QString name, bool visible, int align, double min, double max,
|
||||
int type, QString labelcolor, QString color, bool log, QStringList categories)
|
||||
{
|
||||
python->chart->emitAxis(name, visible, align, min, max, type, labelcolor, color, log, categories);
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
Bindings::result(double value)
|
||||
{
|
||||
|
||||
@@ -118,6 +118,8 @@ class Bindings {
|
||||
bool setCurve(QString name, PyObject *xseries, PyObject *yseries, QString xname, QString yname,
|
||||
QStringList labels, QStringList colors,
|
||||
int line, int symbol, int symbolsize, QString color, int opacity, bool opengl) const;
|
||||
bool configAxis(QString name, bool visible, int align, double min, double max,
|
||||
int type, QString labelcolor, QString color, bool log, QStringList categories);
|
||||
|
||||
private:
|
||||
// find a RideItem by DateTime
|
||||
|
||||
@@ -392,5 +392,7 @@ public:
|
||||
bool setCurve(QString name, PyObject *xseries, PyObject *yseries, QString xname, QString yname,
|
||||
QStringList labels, QStringList colors,
|
||||
int line, int symbol, int symbolsize, QString color, int opacity, bool opengl) const;
|
||||
bool configAxis(QString name, bool visible, int align, double min, double max,
|
||||
int type, QString labelcolor, QString color, bool log, QStringList categories);
|
||||
};
|
||||
|
||||
|
||||
@@ -59,112 +59,128 @@
|
||||
#define sipName___setitem__ &sipStrings_goldencheetah[310]
|
||||
#define sipNameNr___getitem__ 322
|
||||
#define sipName___getitem__ &sipStrings_goldencheetah[322]
|
||||
#define sipNameNr_symbolsize 334
|
||||
#define sipName_symbolsize &sipStrings_goldencheetah[334]
|
||||
#define sipNameNr_seriesUnit 345
|
||||
#define sipName_seriesUnit &sipStrings_goldencheetah[345]
|
||||
#define sipNameNr_xdataNames 356
|
||||
#define sipName_xdataNames &sipStrings_goldencheetah[356]
|
||||
#define sipNameNr_seriesLast 367
|
||||
#define sipName_seriesLast &sipStrings_goldencheetah[367]
|
||||
#define sipNameNr_seriesName 378
|
||||
#define sipName_seriesName &sipStrings_goldencheetah[378]
|
||||
#define sipNameNr_activities 389
|
||||
#define sipName_activities &sipStrings_goldencheetah[389]
|
||||
#define sipNameNr_processor 400
|
||||
#define sipName_processor &sipStrings_goldencheetah[400]
|
||||
#define sipNameNr_seasonPmc 410
|
||||
#define sipName_seasonPmc &sipStrings_goldencheetah[410]
|
||||
#define sipNameNr_setCurve 420
|
||||
#define sipName_setCurve &sipStrings_goldencheetah[420]
|
||||
#define sipNameNr_duration 429
|
||||
#define sipName_duration &sipStrings_goldencheetah[429]
|
||||
#define sipNameNr_activity 438
|
||||
#define sipName_activity &sipStrings_goldencheetah[438]
|
||||
#define sipNameNr_threadid 447
|
||||
#define sipName_threadid &sipStrings_goldencheetah[447]
|
||||
#define sipNameNr_Bindings 456
|
||||
#define sipName_Bindings &sipStrings_goldencheetah[456]
|
||||
#define sipNameNr_opacity 465
|
||||
#define sipName_opacity &sipStrings_goldencheetah[465]
|
||||
#define sipNameNr_yseries 473
|
||||
#define sipName_yseries &sipStrings_goldencheetah[473]
|
||||
#define sipNameNr_xseries 481
|
||||
#define sipName_xseries &sipStrings_goldencheetah[481]
|
||||
#define sipNameNr_animate 489
|
||||
#define sipName_animate &sipStrings_goldencheetah[489]
|
||||
#define sipNameNr_metrics 497
|
||||
#define sipName_metrics &sipStrings_goldencheetah[497]
|
||||
#define sipNameNr_compare 505
|
||||
#define sipName_compare &sipStrings_goldencheetah[505]
|
||||
#define sipNameNr_athlete 513
|
||||
#define sipName_athlete &sipStrings_goldencheetah[513]
|
||||
#define sipNameNr_webpage 521
|
||||
#define sipName_webpage &sipStrings_goldencheetah[521]
|
||||
#define sipNameNr_version 529
|
||||
#define sipName_version &sipStrings_goldencheetah[529]
|
||||
#define sipNameNr___len__ 537
|
||||
#define sipName___len__ &sipStrings_goldencheetah[537]
|
||||
#define sipNameNr___str__ 545
|
||||
#define sipName___str__ &sipStrings_goldencheetah[545]
|
||||
#define sipNameNr_QString 553
|
||||
#define sipName_QString &sipStrings_goldencheetah[553]
|
||||
#define sipNameNr_opengl 561
|
||||
#define sipName_opengl &sipStrings_goldencheetah[561]
|
||||
#define sipNameNr_symbol 568
|
||||
#define sipName_symbol &sipStrings_goldencheetah[568]
|
||||
#define sipNameNr_colors 575
|
||||
#define sipName_colors &sipStrings_goldencheetah[575]
|
||||
#define sipNameNr_labels 582
|
||||
#define sipName_labels &sipStrings_goldencheetah[582]
|
||||
#define sipNameNr_metric 589
|
||||
#define sipName_metric &sipStrings_goldencheetah[589]
|
||||
#define sipNameNr_series 474
|
||||
#define sipName_series &sipStrings_goldencheetah[474]
|
||||
#define sipNameNr_season 596
|
||||
#define sipName_season &sipStrings_goldencheetah[596]
|
||||
#define sipNameNr_filter 603
|
||||
#define sipName_filter &sipStrings_goldencheetah[603]
|
||||
#define sipNameNr_result 610
|
||||
#define sipName_result &sipStrings_goldencheetah[610]
|
||||
#define sipNameNr_remove 617
|
||||
#define sipName_remove &sipStrings_goldencheetah[617]
|
||||
#define sipNameNr_append 624
|
||||
#define sipName_append &sipStrings_goldencheetah[624]
|
||||
#define sipNameNr_color 631
|
||||
#define sipName_color &sipStrings_goldencheetah[631]
|
||||
#define sipNameNr_yname 637
|
||||
#define sipName_yname &sipStrings_goldencheetah[637]
|
||||
#define sipNameNr_xname 643
|
||||
#define sipName_xname &sipStrings_goldencheetah[643]
|
||||
#define sipNameNr_title 649
|
||||
#define sipName_title &sipStrings_goldencheetah[649]
|
||||
#define sipNameNr_index 655
|
||||
#define sipName_index &sipStrings_goldencheetah[655]
|
||||
#define sipNameNr_group 661
|
||||
#define sipName_group &sipStrings_goldencheetah[661]
|
||||
#define sipNameNr_xdata 667
|
||||
#define sipName_xdata &sipStrings_goldencheetah[667]
|
||||
#define sipNameNr_sport 673
|
||||
#define sipName_sport &sipStrings_goldencheetah[673]
|
||||
#define sipNameNr_value 679
|
||||
#define sipName_value &sipStrings_goldencheetah[679]
|
||||
#define sipNameNr_build 685
|
||||
#define sipName_build &sipStrings_goldencheetah[685]
|
||||
#define sipNameNr_line 691
|
||||
#define sipName_line &sipStrings_goldencheetah[691]
|
||||
#define sipNameNr_join 696
|
||||
#define sipName_join &sipStrings_goldencheetah[696]
|
||||
#define sipNameNr_name 638
|
||||
#define sipName_name &sipStrings_goldencheetah[638]
|
||||
#define sipNameNr_type 701
|
||||
#define sipName_type &sipStrings_goldencheetah[701]
|
||||
#define sipNameNr_date 706
|
||||
#define sipName_date &sipStrings_goldencheetah[706]
|
||||
#define sipNameNr_all 711
|
||||
#define sipName_all &sipStrings_goldencheetah[711]
|
||||
#define sipNameNr_url 715
|
||||
#define sipName_url &sipStrings_goldencheetah[715]
|
||||
#define sipNameNr_configAxis 334
|
||||
#define sipName_configAxis &sipStrings_goldencheetah[334]
|
||||
#define sipNameNr_categories 345
|
||||
#define sipName_categories &sipStrings_goldencheetah[345]
|
||||
#define sipNameNr_labelcolor 356
|
||||
#define sipName_labelcolor &sipStrings_goldencheetah[356]
|
||||
#define sipNameNr_symbolsize 367
|
||||
#define sipName_symbolsize &sipStrings_goldencheetah[367]
|
||||
#define sipNameNr_seriesUnit 378
|
||||
#define sipName_seriesUnit &sipStrings_goldencheetah[378]
|
||||
#define sipNameNr_xdataNames 389
|
||||
#define sipName_xdataNames &sipStrings_goldencheetah[389]
|
||||
#define sipNameNr_seriesLast 400
|
||||
#define sipName_seriesLast &sipStrings_goldencheetah[400]
|
||||
#define sipNameNr_seriesName 411
|
||||
#define sipName_seriesName &sipStrings_goldencheetah[411]
|
||||
#define sipNameNr_activities 422
|
||||
#define sipName_activities &sipStrings_goldencheetah[422]
|
||||
#define sipNameNr_processor 433
|
||||
#define sipName_processor &sipStrings_goldencheetah[433]
|
||||
#define sipNameNr_seasonPmc 443
|
||||
#define sipName_seasonPmc &sipStrings_goldencheetah[443]
|
||||
#define sipNameNr_setCurve 453
|
||||
#define sipName_setCurve &sipStrings_goldencheetah[453]
|
||||
#define sipNameNr_duration 462
|
||||
#define sipName_duration &sipStrings_goldencheetah[462]
|
||||
#define sipNameNr_activity 471
|
||||
#define sipName_activity &sipStrings_goldencheetah[471]
|
||||
#define sipNameNr_threadid 480
|
||||
#define sipName_threadid &sipStrings_goldencheetah[480]
|
||||
#define sipNameNr_Bindings 489
|
||||
#define sipName_Bindings &sipStrings_goldencheetah[489]
|
||||
#define sipNameNr_visible 498
|
||||
#define sipName_visible &sipStrings_goldencheetah[498]
|
||||
#define sipNameNr_opacity 506
|
||||
#define sipName_opacity &sipStrings_goldencheetah[506]
|
||||
#define sipNameNr_yseries 514
|
||||
#define sipName_yseries &sipStrings_goldencheetah[514]
|
||||
#define sipNameNr_xseries 522
|
||||
#define sipName_xseries &sipStrings_goldencheetah[522]
|
||||
#define sipNameNr_animate 530
|
||||
#define sipName_animate &sipStrings_goldencheetah[530]
|
||||
#define sipNameNr_metrics 538
|
||||
#define sipName_metrics &sipStrings_goldencheetah[538]
|
||||
#define sipNameNr_compare 546
|
||||
#define sipName_compare &sipStrings_goldencheetah[546]
|
||||
#define sipNameNr_athlete 554
|
||||
#define sipName_athlete &sipStrings_goldencheetah[554]
|
||||
#define sipNameNr_webpage 562
|
||||
#define sipName_webpage &sipStrings_goldencheetah[562]
|
||||
#define sipNameNr_version 570
|
||||
#define sipName_version &sipStrings_goldencheetah[570]
|
||||
#define sipNameNr___len__ 578
|
||||
#define sipName___len__ &sipStrings_goldencheetah[578]
|
||||
#define sipNameNr___str__ 586
|
||||
#define sipName___str__ &sipStrings_goldencheetah[586]
|
||||
#define sipNameNr_QString 594
|
||||
#define sipName_QString &sipStrings_goldencheetah[594]
|
||||
#define sipNameNr_opengl 602
|
||||
#define sipName_opengl &sipStrings_goldencheetah[602]
|
||||
#define sipNameNr_symbol 609
|
||||
#define sipName_symbol &sipStrings_goldencheetah[609]
|
||||
#define sipNameNr_colors 616
|
||||
#define sipName_colors &sipStrings_goldencheetah[616]
|
||||
#define sipNameNr_labels 623
|
||||
#define sipName_labels &sipStrings_goldencheetah[623]
|
||||
#define sipNameNr_metric 630
|
||||
#define sipName_metric &sipStrings_goldencheetah[630]
|
||||
#define sipNameNr_series 515
|
||||
#define sipName_series &sipStrings_goldencheetah[515]
|
||||
#define sipNameNr_season 637
|
||||
#define sipName_season &sipStrings_goldencheetah[637]
|
||||
#define sipNameNr_filter 644
|
||||
#define sipName_filter &sipStrings_goldencheetah[644]
|
||||
#define sipNameNr_result 651
|
||||
#define sipName_result &sipStrings_goldencheetah[651]
|
||||
#define sipNameNr_remove 658
|
||||
#define sipName_remove &sipStrings_goldencheetah[658]
|
||||
#define sipNameNr_append 665
|
||||
#define sipName_append &sipStrings_goldencheetah[665]
|
||||
#define sipNameNr_align 672
|
||||
#define sipName_align &sipStrings_goldencheetah[672]
|
||||
#define sipNameNr_color 361
|
||||
#define sipName_color &sipStrings_goldencheetah[361]
|
||||
#define sipNameNr_yname 678
|
||||
#define sipName_yname &sipStrings_goldencheetah[678]
|
||||
#define sipNameNr_xname 684
|
||||
#define sipName_xname &sipStrings_goldencheetah[684]
|
||||
#define sipNameNr_title 690
|
||||
#define sipName_title &sipStrings_goldencheetah[690]
|
||||
#define sipNameNr_index 696
|
||||
#define sipName_index &sipStrings_goldencheetah[696]
|
||||
#define sipNameNr_group 702
|
||||
#define sipName_group &sipStrings_goldencheetah[702]
|
||||
#define sipNameNr_xdata 708
|
||||
#define sipName_xdata &sipStrings_goldencheetah[708]
|
||||
#define sipNameNr_sport 714
|
||||
#define sipName_sport &sipStrings_goldencheetah[714]
|
||||
#define sipNameNr_value 720
|
||||
#define sipName_value &sipStrings_goldencheetah[720]
|
||||
#define sipNameNr_build 726
|
||||
#define sipName_build &sipStrings_goldencheetah[726]
|
||||
#define sipNameNr_line 732
|
||||
#define sipName_line &sipStrings_goldencheetah[732]
|
||||
#define sipNameNr_join 737
|
||||
#define sipName_join &sipStrings_goldencheetah[737]
|
||||
#define sipNameNr_name 679
|
||||
#define sipName_name &sipStrings_goldencheetah[679]
|
||||
#define sipNameNr_type 742
|
||||
#define sipName_type &sipStrings_goldencheetah[742]
|
||||
#define sipNameNr_date 747
|
||||
#define sipName_date &sipStrings_goldencheetah[747]
|
||||
#define sipNameNr_log 752
|
||||
#define sipName_log &sipStrings_goldencheetah[752]
|
||||
#define sipNameNr_max 120
|
||||
#define sipName_max &sipStrings_goldencheetah[120]
|
||||
#define sipNameNr_min 756
|
||||
#define sipName_min &sipStrings_goldencheetah[756]
|
||||
#define sipNameNr_all 760
|
||||
#define sipName_all &sipStrings_goldencheetah[760]
|
||||
#define sipNameNr_url 764
|
||||
#define sipName_url &sipStrings_goldencheetah[764]
|
||||
|
||||
#define sipMalloc sipAPI_goldencheetah->api_malloc
|
||||
#define sipFree sipAPI_goldencheetah->api_free
|
||||
|
||||
@@ -1148,6 +1148,62 @@ static PyObject *meth_Bindings_setCurve(PyObject *sipSelf, PyObject *sipArgs, Py
|
||||
}
|
||||
|
||||
|
||||
extern "C" {static PyObject *meth_Bindings_configAxis(PyObject *, PyObject *, PyObject *);}
|
||||
static PyObject *meth_Bindings_configAxis(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
|
||||
{
|
||||
PyObject *sipParseErr = NULL;
|
||||
|
||||
{
|
||||
::QString* a0;
|
||||
int a0State = 0;
|
||||
bool a1;
|
||||
int a2;
|
||||
double a3;
|
||||
double a4;
|
||||
int a5;
|
||||
::QString* a6;
|
||||
int a6State = 0;
|
||||
::QString* a7;
|
||||
int a7State = 0;
|
||||
bool a8;
|
||||
::QStringList* a9;
|
||||
int a9State = 0;
|
||||
::Bindings *sipCpp;
|
||||
|
||||
static const char *sipKwdList[] = {
|
||||
sipName_name,
|
||||
sipName_visible,
|
||||
sipName_align,
|
||||
sipName_min,
|
||||
sipName_max,
|
||||
sipName_type,
|
||||
sipName_labelcolor,
|
||||
sipName_color,
|
||||
sipName_log,
|
||||
sipName_categories,
|
||||
};
|
||||
|
||||
if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, NULL, "BJ1biddiJ1J1bJ1", &sipSelf, sipType_Bindings, &sipCpp, sipType_QString,&a0, &a0State, &a1, &a2, &a3, &a4, &a5, sipType_QString,&a6, &a6State, sipType_QString,&a7, &a7State, &a8, sipType_QStringList,&a9, &a9State))
|
||||
{
|
||||
bool sipRes;
|
||||
|
||||
sipRes = sipCpp->configAxis(*a0,a1,a2,a3,a4,a5,*a6,*a7,a8,*a9);
|
||||
sipReleaseType(a0,sipType_QString,a0State);
|
||||
sipReleaseType(a6,sipType_QString,a6State);
|
||||
sipReleaseType(a7,sipType_QString,a7State);
|
||||
sipReleaseType(a9,sipType_QStringList,a9State);
|
||||
|
||||
return PyBool_FromLong(sipRes);
|
||||
}
|
||||
}
|
||||
|
||||
/* Raise an exception if the arguments couldn't be parsed. */
|
||||
sipNoMethod(sipParseErr, sipName_Bindings, sipName_configAxis, NULL);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Call the instance's destructor. */
|
||||
extern "C" {static void release_Bindings(void *, int);}
|
||||
static void release_Bindings(void *sipCppV, int)
|
||||
@@ -1225,6 +1281,7 @@ static PyMethodDef methods_Bindings[] = {
|
||||
{SIP_MLNAME_CAST(sipName_athlete), meth_Bindings_athlete, METH_VARARGS, NULL},
|
||||
{SIP_MLNAME_CAST(sipName_athleteZones), (PyCFunction)meth_Bindings_athleteZones, METH_VARARGS|METH_KEYWORDS, NULL},
|
||||
{SIP_MLNAME_CAST(sipName_build), meth_Bindings_build, METH_VARARGS, NULL},
|
||||
{SIP_MLNAME_CAST(sipName_configAxis), (PyCFunction)meth_Bindings_configAxis, METH_VARARGS|METH_KEYWORDS, NULL},
|
||||
{SIP_MLNAME_CAST(sipName_configChart), (PyCFunction)meth_Bindings_configChart, METH_VARARGS|METH_KEYWORDS, NULL},
|
||||
{SIP_MLNAME_CAST(sipName_createXDataSeries), (PyCFunction)meth_Bindings_createXDataSeries, METH_VARARGS|METH_KEYWORDS, NULL},
|
||||
{SIP_MLNAME_CAST(sipName_deleteActivitySample), (PyCFunction)meth_Bindings_deleteActivitySample, METH_VARARGS|METH_KEYWORDS, NULL},
|
||||
@@ -1266,7 +1323,7 @@ sipClassTypeDef sipTypeDef_goldencheetah_Bindings = {
|
||||
{
|
||||
sipNameNr_Bindings,
|
||||
{0, 0, 1},
|
||||
33, methods_Bindings,
|
||||
34, methods_Bindings,
|
||||
0, 0,
|
||||
0, 0,
|
||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
|
||||
|
||||
@@ -41,6 +41,9 @@ const char sipStrings_goldencheetah[] = {
|
||||
'Q', 'S', 't', 'r', 'i', 'n', 'g', 'L', 'i', 's', 't', 0,
|
||||
'_', '_', 's', 'e', 't', 'i', 't', 'e', 'm', '_', '_', 0,
|
||||
'_', '_', 'g', 'e', 't', 'i', 't', 'e', 'm', '_', '_', 0,
|
||||
'c', 'o', 'n', 'f', 'i', 'g', 'A', 'x', 'i', 's', 0,
|
||||
'c', 'a', 't', 'e', 'g', 'o', 'r', 'i', 'e', 's', 0,
|
||||
'l', 'a', 'b', 'e', 'l', 'c', 'o', 'l', 'o', 'r', 0,
|
||||
's', 'y', 'm', 'b', 'o', 'l', 's', 'i', 'z', 'e', 0,
|
||||
's', 'e', 'r', 'i', 'e', 's', 'U', 'n', 'i', 't', 0,
|
||||
'x', 'd', 'a', 't', 'a', 'N', 'a', 'm', 'e', 's', 0,
|
||||
@@ -54,6 +57,7 @@ const char sipStrings_goldencheetah[] = {
|
||||
'a', 'c', 't', 'i', 'v', 'i', 't', 'y', 0,
|
||||
't', 'h', 'r', 'e', 'a', 'd', 'i', 'd', 0,
|
||||
'B', 'i', 'n', 'd', 'i', 'n', 'g', 's', 0,
|
||||
'v', 'i', 's', 'i', 'b', 'l', 'e', 0,
|
||||
'o', 'p', 'a', 'c', 'i', 't', 'y', 0,
|
||||
'y', 's', 'e', 'r', 'i', 'e', 's', 0,
|
||||
'x', 's', 'e', 'r', 'i', 'e', 's', 0,
|
||||
@@ -76,7 +80,7 @@ const char sipStrings_goldencheetah[] = {
|
||||
'r', 'e', 's', 'u', 'l', 't', 0,
|
||||
'r', 'e', 'm', 'o', 'v', 'e', 0,
|
||||
'a', 'p', 'p', 'e', 'n', 'd', 0,
|
||||
'c', 'o', 'l', 'o', 'r', 0,
|
||||
'a', 'l', 'i', 'g', 'n', 0,
|
||||
'y', 'n', 'a', 'm', 'e', 0,
|
||||
'x', 'n', 'a', 'm', 'e', 0,
|
||||
't', 'i', 't', 'l', 'e', 0,
|
||||
@@ -90,6 +94,8 @@ const char sipStrings_goldencheetah[] = {
|
||||
'j', 'o', 'i', 'n', 0,
|
||||
't', 'y', 'p', 'e', 0,
|
||||
'd', 'a', 't', 'e', 0,
|
||||
'l', 'o', 'g', 0,
|
||||
'm', 'i', 'n', 0,
|
||||
'a', 'l', 'l', 0,
|
||||
'u', 'r', 'l', 0,
|
||||
};
|
||||
|
||||
@@ -38,13 +38,25 @@ def __GCsetCurve(name="",x=list(),y=list(),xaxis="x",yaxis="y", labels=list(), c
|
||||
raise ValueError("curve 'name' must be set and unique.")
|
||||
GC.setCurve(name,list(x),list(y),xaxis,yaxis,list(labels),list(colors),line,symbol,size,color,opacity,opengl)
|
||||
|
||||
# setting the axis
|
||||
def __GCconfigAxis(name,visible=True,align=-1,min=-1,max=-1,type=-1,labelcolor="",color="",log=False,categories=list()):
|
||||
if (name == ""):
|
||||
raise ValueError("axis 'name' must be passed.")
|
||||
GC.configAxis(name, visible, align, min, max, type, labelcolor, color, log, categories)
|
||||
|
||||
|
||||
# add to main GC entrypoint
|
||||
GC.activity=__GCactivity
|
||||
GC.activityXdata=__GCactivityXdata
|
||||
GC.setChart=__GCsetChart
|
||||
GC.addCurve=__GCsetCurve
|
||||
GC.setAxis=__GCconfigAxis
|
||||
|
||||
# constants
|
||||
GC_ALIGN_BOTTOM=0
|
||||
GC_ALIGN_LEFT=1
|
||||
GC_ALIGN_TOP=2
|
||||
GC_ALIGN_RIGHT=3
|
||||
|
||||
# 0 reserved for uninitialised
|
||||
GC.CHART_LINE=1
|
||||
|
||||
Reference in New Issue
Block a user