Graph.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : Graph.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2004-2008 by Ion Vasilief
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr
00007     Description          : Graph widget
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *  This program is free software; you can redistribute it and/or modify   *
00014  *  it under the terms of the GNU General Public License as published by   *
00015  *  the Free Software Foundation; either version 2 of the License, or      *
00016  *  (at your option) any later version.                                    *
00017  *                                                                         *
00018  *  This program is distributed in the hope that it will be useful,        *
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00021  *  GNU General Public License for more details.                           *
00022  *                                                                         *
00023  *   You should have received a copy of the GNU General Public License     *
00024  *   along with this program; if not, write to the Free Software           *
00025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00026  *   Boston, MA  02110-1301  USA                                           *
00027  *                                                                         *
00028  ***************************************************************************/
00029 #ifndef GRAPH_H
00030 #define GRAPH_H
00031 
00032 #include <QList>
00033 #include <QPointer>
00034 #include <QPrinter>
00035 #include <QVector>
00036 #include <QEvent>
00037 #include <QMap>
00038 
00039 #include <qwt_text.h>
00040 #include <qwt_plot.h>
00041 #include <qwt_plot_marker.h>
00042 #include <qwt_plot_curve.h>
00043 
00044 #include <AxesDialog.h>
00045 #include <PlotToolInterface.h>
00046 #include <ScaleDraw.h>
00047 #include <FrameWidget.h>
00048 #include <float.h>
00049 
00050 class QwtPlotPanner;
00051 class QwtPlotMagnifier;
00052 class QwtPlotCurve;
00053 class QwtPlotZoomer;
00054 class QwtPieCurve;
00055 class Table;
00056 class ArrowMarker;
00057 class ImageWidget;
00058 class TitlePicker;
00059 class ScalePicker;
00060 class CanvasPicker;
00061 class ApplicationWindow;
00062 class Matrix;
00063 class SelectionMoveResizer;
00064 class RangeSelectorTool;
00065 class DataCurve;
00066 class PlotCurve;
00067 class QwtErrorPlotCurve;
00068 class MultiLayer;
00069 class Spectrogram;
00070 class FunctionCurve;
00071 class VectorCurve;
00072 class BoxCurve;
00073 class QwtHistogram;
00074 class Grid;
00075 class TexWidget;
00076 class LegendWidget;
00077 
00079 typedef struct{
00080   QColor lCol;     
00081   float lWidth;    
00082   int lStyle;      
00083   int filledArea;  
00084   QColor aCol;     
00085   int aStyle;      
00086   QColor symCol;   
00087   QColor fillCol;  
00088   float penWidth;  
00089   int sSize;       
00090   int sType;       
00091   int connectType; 
00092 }  CurveLayout;
00093 
00122 class Graph: public QwtPlot
00123 {
00124     Q_OBJECT
00125 
00126     public:
00127         Graph (int x = 0, int y = 0, int width = 500, int height = 400, QWidget* parent=0, Qt::WFlags f=0);
00128         ~Graph();
00129 
00130         enum Axis{Left, Right, Bottom, Top};
00131         enum Scale{Linear, Log10};
00132         enum Ticks{NoTicks = 0, Out = 1, InOut = 2, In = 3};
00133         enum MarkerType{None = -1, Text = 0, Arrow = 1, Image = 2};
00134         enum CurveType{Line, Scatter, LineSymbols, VerticalBars, Area, Pie, VerticalDropLines,
00135             Spline, HorizontalSteps, Histogram, HorizontalBars, VectXYXY, ErrorBars,
00136             Box, VectXYAM, VerticalSteps, ColorMap, GrayScale, Contour, Function, ImagePlot,
00137             StackBar, StackColumn};
00138         enum LegendDisplayMode{ColumnName, ColumnComment, TableName, TableLegend};
00139 
00141         MultiLayer *multiLayer();
00142 
00144         void setActiveTool(PlotToolInterface *tool);
00146         PlotToolInterface* activeTool() const { return d_active_tool; }
00148         bool hasActiveTool();
00149 
00150         QList <LegendWidget *> textsList();
00151         LegendWidget *activeText();
00152         void setActiveText(LegendWidget *l){d_active_enrichment = (FrameWidget *)l;};
00153         void select(QWidget *l, bool add = false);
00154 
00155         FrameWidget *activeEnrichment(){return d_active_enrichment;};
00156         QList <FrameWidget *> enrichmentsList(){return d_enrichments;};
00157 
00158         bool hasSeletedItems();
00159         void deselect();
00160         void deselect(QWidget *);
00161 
00162         QwtPlotItem* selectedCurveLabels();
00164         void restoreCurveLabels(int curveID, const QStringList& lst);
00165 
00166         Grid *grid(){return (Grid *)d_grid;};
00167         QList<QwtPlotItem *> curvesList(){return d_curves;};
00168 
00169         QwtPlotItem* closestCurve(int xpos, int ypos, int &dist, int &point);
00170 
00171         void insertMarker(QwtPlotMarker *m);
00172 
00173         QList<int> getMajorTicksType();
00174         void setMajorTicksType(int axis, int type);
00175 
00176         QList<int> getMinorTicksType();
00177         void setMinorTicksType(int axis, int type);
00178 
00179         int minorTickLength() const;
00180         int majorTickLength() const;
00181         void setTickLength (int minLength, int majLength);
00182 
00183         int axesLinewidth() const;
00184         void setAxesLinewidth(int width);
00185 
00186         void axisLabelFormat(int axis, char &f, int &prec) const;
00187 
00188         int axisLabelFormat(int axis);
00189         int axisLabelPrecision(int axis);
00190 
00191         QColor frameColor();
00192         const QColor & paletteBackgroundColor() const;
00193 
00194         void print(QPainter *, const QRect &rect, const QwtPlotPrintFilter & = QwtPlotPrintFilter());
00195         void updateLayout();
00196         void adjustGeometryToCanvas(const QRect &canvasRect);
00197 
00198         void updateCurveLabels();
00199 
00200         TexWidget* addTexFormula(const QString& s, const QPixmap& pix);
00201 
00202         FrameWidget* add(FrameWidget* fw, bool copy = true);
00203         void remove(FrameWidget*);
00204 
00205         QRect boundingRect();
00206         void raiseEnrichements();
00207         void addLegendItem();
00208         bool isPrinting(){return d_is_printing;};
00209 
00210         void enablePanningMagnifier(bool on = true);
00211         bool hasPanningMagnifierEnabled(){if (d_magnifier && d_panner) return true; return false;}
00212 
00213         static QString escapeTeXSpecialCharacters(const QString &);
00214         static QString texSuperscripts(const QString &);
00215 
00216         void changeCurveIndex(int fromIndex, int toIndex);
00217         void enableDouglasPeukerSpeedMode(double tolerance, int maxPoints);
00218 
00219         int speedModeMaxPoints(){return d_speed_mode_points;};
00220         double getDouglasPeukerTolerance(){return d_Douglas_Peuker_tolerance;};
00221 
00222     public slots:
00223         void copy(Graph* g);
00224         void copyCurves(Graph* g);
00225 
00227 
00228 
00229         bool isPiePlot();
00231         QwtPieCurve* plotPie(Table* w,const QString& name, int startRow = 0, int endRow = -1);
00233         QwtPieCurve* plotPie(Table* w, const QString& name, const QPen& pen, int brush, int size,
00234             int firstColor, int startRow = 0, int endRow = -1, bool visible = true,
00235             double d_start_azimuth = 270, double d_view_angle = 90, double d_thickness = 33,
00236             double d_horizontal_offset = 0.0, double d_edge_dist = 25, bool d_counter_clockwise = false,
00237             bool d_auto_labeling = true, bool d_values = false, bool d_percentages = true,
00238             bool d_categories = false, bool d_fixed_labels_pos = true);
00239 
00240         void removePie();
00241         QString pieLegendText();
00242         QString savePieCurveLayout();
00244 
00245         bool addCurves(Table* w, const QStringList& names, int style = 0, double lWidth = 1, int sSize = 3, int startRow = 0, int endRow = -1);
00246         DataCurve* insertCurve(Table* w, const QString& name, int style, int startRow = 0, int endRow = -1);
00247         DataCurve* insertCurve(Table* w, int xcol, const QString& name, int style);
00248         DataCurve* insertCurve(Table* w, const QString& xColName, const QString& yColName, int style, int startRow = 0, int endRow = -1);
00249         void insertPlotItem(QwtPlotItem *i, int type);
00250         void insertCurve(QwtPlotItem *c);
00251 
00253         void showCurve(int index, bool visible = true);
00254         int visibleCurves();
00255 
00256         void removeCurve(QwtPlotItem *it);
00258         void removeCurve(int index);
00262         void removeCurve(const QString& s);
00266         void removeCurves(const QString& s);
00267 
00268         void updateCurvesData(Table* w, const QString& yColName);
00269 
00270         int curveCount(){return d_curves.size();};
00271         bool validCurvesDataSize();
00272         double selectedXStartValue();
00273         double selectedXEndValue();
00274 
00276         int curveIndex(QwtPlotItem *c){return d_curves.indexOf(c);};
00278         int curveIndex(const QString &title){return plotItemsList().findIndex(title);}
00280         QwtPlotCurve* curve(int index);
00282         QwtPlotCurve* curve(const QString &title){return curve(curveIndex(title));};
00284         QString curveTitle(int index);
00285 
00287         QStringList analysableCurvesList();
00289         QStringList curveNamesList();
00291         QStringList plotItemsList();
00293         QwtPlotItem* plotItem(int index);
00294 
00295         void updateCurveNames(const QString& oldName, const QString& newName, bool updateTableName = true);
00296 
00298 
00299         void setCurveStyle(int index, int s);
00300         void setCurveFullRange(int curveIndex);
00301         void setCurveLineColor(int curveIndex, int colorIndex);
00302         void setCurveLineStyle(int curveIndex, Qt::PenStyle style);
00303         void setCurveLineWidth(int curveIndex, double width);
00304         void setGrayScale();
00305         void setIndexedColors();
00307 
00309 
00310         void print();
00311         void setScaleOnPrint(bool on){d_scale_on_print = on;};
00312         void printCropmarks(bool on){d_print_cropmarks = on;};
00313 
00314         void copyImage();
00315         QPixmap graphPixmap(const QSize& size = QSize(), double scaleFontsFactor = 1.0);
00317         void exportToFile(const QString& fileName);
00318         void exportSVG(const QString& fname, const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0);
00319 #ifdef EMF_OUTPUT
00320         void exportEMF(const QString& fname, const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0);
00321 #endif
00322         void exportTeX(const QString& fname, bool color = true, bool escapeStrings = true, bool fontSizes = true,
00323                         const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0);
00324         void exportVector(const QString& fileName, int res = 0, bool color = true,
00325                         const QSizeF& customSize = QSizeF (), int unit = FrameWidget::Pixel, double fontsFactor = 1.0);
00326         void exportImage(const QString& fileName, int quality = 100, bool transparent = false,
00327                          int dpi = 0, const QSizeF& customSize = QSizeF (),
00328                          int unit = FrameWidget::Pixel, double fontsFactor = 1.0);
00329 
00330         void draw(QPaintDevice *, const QSize& size, double fontsFactor = 1.0);
00331         static QSize customPrintSize(const QSizeF& customSize, int unit, int dpi);
00332 
00333         bool isExportingTeX(){return d_is_exporting_tex;};
00334         void setTeXExportingMode(bool on = true){d_is_exporting_tex = on;};
00335         void setEscapeTeXStringsMode(bool on = true){d_tex_escape_strings = on;};
00337 
00338         void updatePlot();
00339 
00341 
00342         QwtErrorPlotCurve* addErrorBars(const QString& xColName, const QString& yColName, Table *errTable,
00343                 const QString& errColName, int type = 1, double width = 1, int cap = 8, const QColor& color = QColor(Qt::black),
00344                 bool through = true, bool minus = true, bool plus = true);
00345 
00346         QwtErrorPlotCurve* addErrorBars(const QString& yColName, Table *errTable, const QString& errColName,
00347                 int type = 1, double width = 1, int cap = 8, const QColor& color = QColor(Qt::black),
00348                 bool through = true, bool minus = true, bool plus = true);
00349 
00350         void updateErrorBars(QwtErrorPlotCurve *er, bool xErr, double width, int cap, const QColor& c, bool plus, bool minus, bool through);
00351 
00353         DataCurve* masterCurve(QwtErrorPlotCurve *er);
00355         DataCurve* masterCurve(const QString& xColName, const QString& yColName);
00357 
00359 
00360         void contextMenuEvent(QContextMenuEvent *);
00361         void closeEvent(QCloseEvent *e);
00362         bool focusNextPrevChild ( bool next );
00364 
00366         void invertScale(int axis);
00367         void setScale(int axis, double start, double end, double step = 0.0,
00368                 int majorTicks = 5, int minorTicks = 5, int type = 0, bool inverted = false,
00369                 double left_break = -DBL_MAX, double right_break = DBL_MAX, int pos = 50,
00370                 double stepBeforeBreak = 0.0, double stepAfterBreak = 0.0, int minTicksBeforeBreak = 4,
00371                 int minTicksAfterBreak = 4, bool log10AfterBreak = false, int breakWidth = 4, bool breakDecoration = true);
00372         double axisStep(int axis){return d_user_step[axis];};
00373         void setCanvasCoordinates(const QRectF&);
00374 
00376 
00377         CurveLayout initCurveLayout(int style, int curves = 0, bool guessLayout = true);
00378         static CurveLayout initCurveLayout();
00379         void updateCurveLayout(PlotCurve* c, const CurveLayout *cL);
00381         void guessUniqueCurveLayout(int& colorIndex, int& symbolIndex);
00383 
00385 
00386         void zoomed (const QwtDoubleRect &);
00387         void zoom(bool on);
00388         void zoomOut();
00389         bool zoomOn();
00391 
00392         void setAutoScale();
00393         void updateScale();
00394 
00396 
00397         QString saveToString(bool saveAsTemplate = false);
00398         QString saveScale();
00399         QString saveScaleTitles();
00400         QString saveFonts();
00401         QString saveMarkers();
00402         QString saveCurveLayout(int index);
00403         QString saveAxesTitleColors();
00404         QString saveAxesColors();
00405         QString saveEnabledAxes();
00406         QString saveCanvas();
00407         QString saveTitle();
00408         QString saveAxesTitleAlignement();
00409         QString saveEnabledTickLabels();
00410         QString saveTicksType();
00411         QString saveCurves();
00412         QString saveLabelsFormat();
00413         QString saveLabelsRotation();
00414         QString saveAxesLabelsType();
00415         QString saveAxesBaseline();
00416         QString saveAxesFormulas();
00418 
00420 
00421         LegendWidget* addText(LegendWidget*);
00423         LegendWidget* insertText(const QStringList& list, int fileVersion);
00424 
00425         LegendWidget* addTimeStamp();
00426         void removeLegendItem(int index);
00427         void insertLegend(const QStringList& lst, int fileVersion);
00428 
00429         LegendWidget* newLegend(const QString& text = QString());
00431         QString legendText(bool layerSpec = false);
00433 
00435 
00436         LegendWidget* legend();
00437         void setLegend(const QString&);
00438         void removeLegend();
00440 
00442 
00443         ArrowMarker* addArrow(ArrowMarker* mrk);
00444         void remove(ArrowMarker* arrow);
00445 
00447         void addArrow(QStringList list, int fileVersion);
00448         QList<QwtPlotMarker *> linesList(){return d_lines;};
00449 
00451         void drawLine(bool on, bool arrow = false);
00452         bool drawArrow(){return drawArrowOn;};
00453         bool drawLineActive(){return drawLineOn;};
00454         bool arrowMarkerSelected();
00456 
00458 
00459         ImageWidget* addImage(ImageWidget* i);
00460         ImageWidget* addImage(const QString& fileName);
00461         ImageWidget* addImage(const QImage& image);
00462 
00463         void insertImageMarker(const QStringList& lst, int fileVersion);
00464         bool imageMarkerSelected();
00466 
00468 
00469         void removeMarker();
00471         void updateMarkersBoundingRect();
00472 
00479         void setSelectedMarker(QwtPlotMarker* mrk, bool add = false);
00480         QwtPlotMarker* selectedMarker(){return d_selected_marker;};
00481         bool markerSelected();
00483         void deselectMarker();
00485 
00487 
00488         QwtScaleWidget* currentScale();
00489         QwtScaleWidget* selectedScale();
00490         QRect axisTitleRect(const QwtScaleWidget *scale);
00491         bool axisTitleSelected();
00492 
00493         ScaleDraw::ScaleType axisType(int axis);
00494 
00495         void setXAxisTitle(const QString& text);
00496         void setYAxisTitle(const QString& text);
00497         void setRightAxisTitle(const QString& text);
00498         void setTopAxisTitle(const QString& text);
00499 
00500         QString axisTitleString(int axis){return axisTitle(axis).text();};
00501         void setAxisTitle(int axis, const QString& text);
00503         void setScaleTitle(int axis, const QString& text);
00504 
00505         QFont axisTitleFont(int axis);
00506         void setAxisTitleFont(int axis,const QFont &fnt);
00507 
00508         void setAxisFont(int axis, const QFont &fnt);
00509         void initFonts(const QFont &scaleTitleFnt,const QFont &numbersFnt);
00510 
00511         QColor axisTitleColor(int axis);
00512         void setAxisTitleColor(int axis, const QColor& c);
00513 
00514         int axisTitleAlignment (int axis);
00515         void setAxisTitleAlignment(int axis, int align);
00516 
00517         int axisTitleDistance(int axis);
00518         void setAxisTitleDistance(int axis, int dist);
00519 
00520         QColor axisColor(int axis);
00521         void setAxisColor(int axis, const QColor& color);
00522 
00523         QColor axisLabelsColor(int axis);
00524         void setAxisLabelsColor(int axis, const QColor& color);
00525 
00526         void showAxis(int axis, int type, const QString& formatInfo, Table *table, bool axisOn,
00527                 int majTicksType, int minTicksType, bool labelsOn, const QColor& c, int format,
00528                 int prec, int rotation, int baselineDist, const QString& formula, const QColor& labelsColor);
00529 
00530         void enableAxis(int axis, bool on = true);
00531         void enableAxisLabels(int axis, bool on = true);
00532 
00533         int labelsRotation(int axis);
00534         void setAxisLabelRotation(int axis, int rotation);
00535 
00537         void loadAxesLinewidth(int width);
00538 
00539         void drawAxesBackbones(bool yes);
00540         bool axesBackbones(){return drawAxesBackbone;};
00542         void loadAxesOptions(const QString& s);
00543 
00544         void setAxisMargin(int axis, int margin);
00545 
00546         void setMajorTicksType(const QList<int>& lst);
00547         void setMajorTicksType(const QStringList& lst);
00548 
00549         void setMinorTicksType(const QList<int>& lst);
00550         void setMinorTicksType(const QStringList& lst);
00551 
00552         void setAxisTicksLength(int axis, int majTicksType, int minTicksType, int minLength, int majLength);
00553         void setTicksLength(int minLength, int majLength);
00554         void changeTicksLength(int minLength, int majLength);
00556         void setLabelsNumericFormat(const QStringList& l);
00557         void setLabelsNumericFormat(int axis, int format, int prec = 6, const QString& formula = QString());
00558         void setLabelsDateTimeFormat(int axis, int type, const QString& formatInfo);
00559         void setLabelsDayFormat(int axis, int format);
00560         void setLabelsMonthFormat(int axis, int format);
00561 
00562         QString axisFormatInfo(int axis);
00563 
00564         void setLabelsTextFormat(int axis, int type, const QString& name, const QStringList& lst);
00565         void setLabelsTextFormat(int axis, int type, const QString& labelsColName, Table *table);
00566 
00567         QString axisFormula(int axis);
00568         void setAxisFormula(int axis, const QString &);
00570 
00572 
00573         void setCanvasFrame(int width = 1, const QColor& color =  QColor(Qt::black));
00574         QColor canvasFrameColor();
00575         int canvasFrameWidth();
00577 
00579 
00580         void setTitleFont(const QFont &fnt);
00581         void setTitleColor(const QColor &c);
00582         void setTitleAlignment(int align);
00583 
00584         bool titleSelected();
00585         void selectTitle(bool select = true);
00587         void clearTitle();
00589         void removeTitle();
00590         void initTitle( bool on, const QFont& fnt);
00592 
00594 
00595         QString selectedCurveTitle();
00597 
00598         void disableTools();
00599 
00606         bool enableRangeSelectors(const QObject *status_target=NULL, const char *status_slot="");
00607         bool rangeSelectorsEnabled();
00608         QPointer<RangeSelectorTool> rangeSelectorTool(){return d_range_selector;};
00610 
00611         void setFrame(int width = 1, const QColor& color = Qt::black);
00612         void setBackgroundColor(const QColor& color);
00614 
00615         void addFitCurve(QwtPlotCurve *c);
00616         void deleteFitCurves();
00617         QList<QwtPlotCurve *> fitCurvesList(){return d_fit_curves;};
00622         int range(const QString& curveTitle, double *start, double *end);
00627         int range(QwtPlotCurve *c, double *start, double *end);
00628 
00630         void setBarsGap(int curve, int gapPercent, int offset);
00631 
00633 
00634         void modifyFunctionCurve(int curve, int type, const QStringList &formulas, const QString &var,
00635             double start, double end, int points, const QMap<QString, double>& constants);
00636         FunctionCurve* addFunction(const QStringList &formulas, double start, double end, int points = 100, const QString &var = "x", int type = 0, const QString& title = QString::null);
00638         FunctionCurve* insertFunctionCurve(const QString& formula, int points, int fileVersion);
00639 
00641         QString generateFunctionName(const QString& name = tr("F"));
00643 
00645         void createTable(const QString& curveName);
00646         void createTable(const QwtPlotCurve* curve);
00647         void activateGraph();
00648 
00650 
00651         VectorCurve* plotVectorCurve(Table* w, const QStringList& colList, int style, int startRow = 0, int endRow = -1);
00652         void updateVectorsLayout(int curve, const QColor& color, double width, int arrowLength, int arrowAngle, bool filled, int position,
00653                 const QString& xEndColName = QString(), const QString& yEndColName = QString());
00655 
00657 
00658         BoxCurve* openBoxDiagram(Table *w, const QStringList& l, int fileVersion);
00659         void plotBoxDiagram(Table *w, const QStringList& names, int startRow = 0, int endRow = -1);
00661 
00663 
00664         void resizeEvent(QResizeEvent *e);
00665         void scaleFonts(double factor);
00667 
00668         void notifyChanges();
00669 
00670         void updateSecondaryAxis(int axis, bool changeFormat = false);
00671 
00672         bool isAutoscalingEnabled(){return d_auto_scale;};
00673         void enableAutoscaling(bool on = true){d_auto_scale = on;};
00674 
00675         bool autoscaleFonts(){return autoScaleFonts;};
00676         void setAutoscaleFonts(bool on = true){autoScaleFonts = on;};
00677 
00678         static int obsoleteSymbolStyle(int type);
00679         static QString penStyleName(Qt::PenStyle style);
00680         static Qt::PenStyle getPenStyle(const QString& s);
00681         static Qt::PenStyle getPenStyle(int style);
00682         static void showPlotErrorMessage(QWidget *parent, const QStringList& emptyColumns);
00683 
00684         void showTitleContextMenu();
00685         void copyTitle();
00686         void cutTitle();
00687 
00688         void clearAxisTitle();
00689         void removeAxisTitle();
00690         void cutAxisTitle();
00691         void copyAxisTitle();
00692         void showAxisTitleMenu();
00693         void showAxisContextMenu(int axis);
00694         void hideSelectedAxis();
00695         void showGrids();
00696 
00698         void showGrid();
00700         void showGrid(int axis);
00701 
00702         void showAxisDialog();
00703         void showScaleDialog();
00704 
00706         Spectrogram* plotSpectrogram(Matrix *m, CurveType type);
00708         void restoreSpectrogram(ApplicationWindow *app, const QStringList& lst);
00710         QwtHistogram* addHistogram(Matrix *m);
00712         QwtHistogram* restoreHistogram(Matrix *m, const QStringList& l);
00713 
00714         bool antialiasing(){return d_antialiasing;};
00716         void setAntialiasing(bool on = true, bool update = true);
00717 
00718         void setCurrentFont(const QFont& f);
00719         void notifyFontChange(const QFont& f){emit currentFontChanged(f);};
00720         void enableTextEditor();
00721 
00722 signals:
00723         void selectedGraph (Graph*);
00724         void closedGraph();
00725         void drawLineEnded(bool);
00726         void cursorInfo(const QString&);
00727         void showPlotDialog(int);
00728         void createTable(const QString&,int,int,const QString&);
00729 
00730         void viewLineDialog();
00731         void viewTitleDialog();
00732         void modifiedGraph();
00733         void hiddenPlot(QWidget*);
00734 
00735         void showContextMenu();
00736         void showCurveContextMenu(QwtPlotItem *);
00737         void showMarkerPopupMenu();
00738 
00739         void showAxisDialog(int);
00740         void axisDblClicked(int);
00741 
00742         void showAxisTitleDialog();
00743 
00744         void dataRangeChanged();
00745         void showFitResults(const QString&);
00746         void currentFontChanged(const QFont&);
00747         void enableTextEditor(Graph *);
00748         void axisDivChanged(Graph *, int);
00749 
00750     private:
00751         QList<FrameWidget*> stackingOrderEnrichmentsList();
00753         QwtDoubleInterval axisBoundingInterval(int axis);
00754         void deselectCurves();
00755 
00756         void dropEvent(QDropEvent*);
00757         void dragEnterEvent(QDragEnterEvent*);
00758         void showEvent (QShowEvent * event);
00759         void printFrame(QPainter *painter, const QRect &rect) const;
00760         void printCanvas(QPainter *painter, const QRect &canvasRect,
00761              const QwtScaleMap map[axisCnt], const QwtPlotPrintFilter &pfilter) const;
00762         virtual void printScale (QPainter *, int axisId, int startDist, int endDist,
00763             int baseDist, const QRect &) const;
00764         virtual void drawItems (QPainter *painter, const QRect &rect,
00765             const QwtScaleMap map[axisCnt], const QwtPlotPrintFilter &pfilter) const;
00766 
00767         void drawInwardTicks(QPainter *painter, const QRect &rect,
00768                             const QwtScaleMap&map, int axis, bool min, bool maj) const;
00769         void drawBreak(QPainter *painter, const QRect &rect, const QwtScaleMap &map, int axis) const;
00770 
00771         QwtPlotZoomer *d_zoomer[2];
00772         TitlePicker *titlePicker;
00773         ScalePicker *scalePicker;
00774         CanvasPicker* cp;
00776         Grid *d_grid;
00778         QList<QwtPlotItem*> d_curves;
00780         QList<QwtPlotCurve *>d_fit_curves;
00782         bool d_antialiasing;
00783         bool autoScaleFonts;
00784         bool d_scale_on_print, d_print_cropmarks;
00785         bool drawLineOn, drawArrowOn, drawAxesBackbone;
00787         bool d_is_printing;
00789         QVector<double> d_user_step;
00791         QList<QwtPlotMarker*> d_lines;
00793         QwtPlotMarker* d_selected_marker;
00795         QPointer<SelectionMoveResizer> d_markers_selector;
00797         QPointer<RangeSelectorTool> d_range_selector;
00799         PlotToolInterface *d_active_tool, *d_peak_fit_tool;
00801         FrameWidget *d_active_enrichment;
00803         bool d_auto_scale;
00805         int d_min_tick_length, d_maj_tick_length;
00806         bool d_is_exporting_tex;
00807         bool d_tex_escape_strings;
00808         QList<FrameWidget*> d_enrichments;
00809         QwtPlotMagnifier *d_magnifier;
00810         QwtPlotPanner *d_panner;
00811 
00812         double d_Douglas_Peuker_tolerance;
00813         int d_speed_mode_points;
00814 };
00815 #endif // GRAPH_H

Generated by  doxygen 1.6.2