QCustomPlot(2) 數組
這個小部件類,對於QCustomPlot的全部方面都有所體現緩存
下面閱讀它的函數:ide
函數組織順序爲: 基本設置---添加圖線---刪除圖線---添加額外Item---層次管理---座標軸管理----導出圖表函數
[cpp] view plain copyurl
QCustomPlot (QWidget *parent=0) spa
void setViewport (const QRect &rect)//視口設置,一般就是本部件所在的長寬 .net
void setBackground (const QPixmap &pm)//在整個視口的最底層繪製圖片,用做背景 orm
void setBackground (const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding) 對象
void setBackground (const QBrush &brush) blog
void setBackgroundScaled (bool scaled)//設置setBackground 所繪的圖是否進行縮放以適應Viewport
void setBackgroundScaledMode (Qt::AspectRatioMode mode)//有Qt::IgnoreAspectRatio(忽略比例,縮放至適應視口),Qt::KeepAspectRatio(保持長寬比,直到一邊最大至視口邊緣)Qt::KeepAspectRatioByExpanding(保持長寬比,縮放至充滿視口)
void setAntialiasedElements (const QCP::AntialiasedElements &antialiasedElements)//抗鋸齒效果,對於各對象,都有默認設置,可經過本函數,改變默認不抗鋸齒的元素,使它也抗。
void setAntialiasedElement (QCP::AntialiasedElement antialiasedElement, bool enabled=true)//更方便的開關
void setNotAntialiasedElements (const QCP::AntialiasedElements AntialiasedElements)//設置不抗
void setNotAntialiasedElement (QCP::AntialiasedElement notAntialiasedElement, bool enabled=true)
void setAutoAddPlottableToLegend (bool on)//是否自動添加圖形到圖例,默認是
void setInteraction (const QCP::Interaction &interaction, bool enabled=true)//設置交互方式,如是否可拖動或縮放軸,是否可選中軸或圖例等。
void setInteractions (const QCP::Interactions &interactions)
void setSelectionTolerance (int pixels)//選擇公差設置,在多少像素中能選中某個元素
void setNoAntialiasingOnDrag (bool enabled)//拖動時是否也抗鋸齒
void setPlottingHint (QCP::PlottingHint hint, bool enabled=true)//設置其它參數,如快速繪製線(損失質量),緩存軸的lable(提升效率)
void setPlottingHints (const QCP::PlottingHints &hints)
void setMultiSelectModifier (Qt::KeyboardModifier modifier)//要多選時的按鍵,默認Qt::ControlModifier,即ctrl
QRect viewport () const//與上述大體對應
QPixmap background () const
bool backgroundScaled () const
Qt::AspectRatioMode backgroundScaledMode () const
QCPLayoutGrid * plotLayout () const
QCP::AntialiasedElements antialiasedElements () const
QCP::AntialiasedElements notAntialiasedElements () const
bool autoAddPlottableToLegend () const
const QCP::Interactions interactions () const
int selectionTolerance () const
bool noAntialiasingOnDrag () const
QCP::PlottingHints plottingHints () const
Qt::KeyboardModifier multiSelectModifier () const
QCPAbstractPlottable * plottable (int index)//全部添加的圖線都自動加了索引,按前後順序
QCPAbstractPlottable * plottable ()
bool addPlottable (QCPAbstractPlottable *plottable)//添加除graph線外的其它種類型的曲線或圖
bool removePlottable (QCPAbstractPlottable *plottable)
bool removePlottable (int index)
int clearPlottables ()
int plottableCount () const
QList< QCPAbstractPlottable * > selectedPlottables () const//返回選中的線
QCPAbstractPlottable * plottableAt (const QPointF &pos, bool onlySelectable=false) const//返回某個點是否有圖線
bool hasPlottable (QCPAbstractPlottable *plottable) const
QCPGraph * addGraph (QCPAxis *keyAxis=0, QCPAxis *valueAxis=0)//爲Graph線留的特殊接口,因Graph是最經常使用的
bool removeGraph (QCPGraph *graph)
bool removeGraph (int index)
QCPGraph * graph (int index) const
QCPGraph * graph () const
int clearGraphs ()
int graphCount () const
QList< QCPGraph * > selectedGraphs () const
bool addItem (QCPAbstractItem *item)//添加一些附加item,如箭頭等
bool removeItem (QCPAbstractItem *item)
bool removeItem (int index)
int clearItems ()
int itemCount () const
QCPAbstractItem * item (int index) const
QCPAbstractItem * item () const
QList< QCPAbstractItem * > selectedItems () const
QCPAbstractItem * itemAt (const QPointF &pos, bool onlySelectable=false) const
bool hasItem (QCPAbstractItem *item) const
QCPLayoutElement * layoutElementAt (const QPointF &pos) const
QCPLayer * layer (const QString &name) const//QCustomPlot分層的實現與管理
QCPLayer * layer (int index) const
QCPLayer * currentLayer () const
bool setCurrentLayer (const QString &name)
bool setCurrentLayer (QCPLayer *layer)
int layerCount () const
bool addLayer (const QString &name, QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove)
bool removeLayer (QCPLayer *layer)
bool moveLayer (QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove)
QCPAxisRect * axisRect (int index=0) const
QList< QCPAxisRect * > axisRects () const
QList< QCPAxis * > selectedAxes () const
QList< QCPLegend * > selectedLegends () const
int axisRectCount () const
bool savePdf (const QString &fileName, bool noCosmeticPen=false, int width=0, int height=0, const QString &pdfCreator="", const QString &pdfTitle="")//將圖表導出成各類格式
bool savePng (const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
bool saveJpg (const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1)
bool saveBmp (const QString &fileName, int width=0, int height=0, double scale=1.0)
bool saveRastered (const QString &fileName, int width, int height, double scale, const char *format, int quality=-1)
QPixmap toPixmap (int width=0, int height=0, double scale=1.0)
void toPainter (QCPPainter *painter, int width=0, int height=0)
//三個槽
Q_SLOT void replot (QCustomPlot::RefreshPriority refreshPriority=QCustomPlot::rpHint)//從新生成圖表
Q_SLOT void rescaleAxes (bool onlyVisiblePlottables=false)
Q_SLOT void deselectAll ()//取消選擇