00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
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 double 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, Ln, Log2, Reciprocal, Probability, Logit};
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 enum AxisTitlePolicy{Default, ColName, ColComment, NameAndComment};
00140
00142 MultiLayer *multiLayer();
00143
00145 void setActiveTool(PlotToolInterface *tool);
00147 PlotToolInterface* activeTool() const { return d_active_tool; }
00149 bool hasActiveTool();
00150
00151 QList <LegendWidget *> textsList();
00152 LegendWidget *activeText();
00153 void setActiveText(LegendWidget *l){d_active_enrichment = (FrameWidget *)l;};
00154 void select(QWidget *l, bool add = false);
00155
00156 FrameWidget *activeEnrichment(){return d_active_enrichment;};
00157 QList <FrameWidget *> enrichmentsList(){return d_enrichments;};
00158 QList <FrameWidget *> increasingAreaEnrichmentsList();
00159
00160 bool hasSeletedItems();
00161 void deselect();
00162 void deselect(QWidget *);
00163
00164 QPointer<SelectionMoveResizer> selectionMoveResizer(){return d_markers_selector;};
00165
00166 QwtPlotItem* selectedCurveLabels();
00168 void restoreCurveLabels(int curveID, const QStringList& lst);
00169
00170 Grid *grid(){return (Grid *)d_grid;};
00171 QList<QwtPlotItem *> curvesList(){return d_curves;};
00172
00173 QwtPlotItem* closestCurve(int xpos, int ypos, int &dist, int &point);
00174
00175 void insertMarker(QwtPlotMarker *m);
00176
00177 QList<int> getMajorTicksType();
00178 void setMajorTicksType(int axis, int type);
00179
00180 QList<int> getMinorTicksType();
00181 void setMinorTicksType(int axis, int type);
00182
00183 int minorTickLength() const;
00184 int majorTickLength() const;
00185 void setTickLength (int minLength, int majLength);
00186
00187 int axesLinewidth() const;
00188 void setAxesLinewidth(int width);
00189
00190 void axisLabelFormat(int axis, char &f, int &prec) const;
00191
00192 int axisLabelFormat(int axis);
00193 int axisLabelPrecision(int axis);
00194
00195 QColor frameColor();
00196 const QColor & paletteBackgroundColor() const;
00197
00198 void print(QPainter *, const QRect &rect, const QwtPlotPrintFilter & = QwtPlotPrintFilter());
00199 void updateLayout();
00200 void setCanvasGeometry(const QRect &canvasRect);
00202 void setCanvasGeometry(int x, int y, int w, int h){setCanvasGeometry(QRect(x, y, w, h));};
00203 void setCanvasSize(const QSize &size);
00205 void setCanvasSize(int w, int h){setCanvasSize(QSize(w, h));};
00206
00207 void updateCurveLabels();
00208
00209 TexWidget* addTexFormula(const QString& s, const QPixmap& pix);
00210
00211 FrameWidget* add(FrameWidget* fw, bool copy = true);
00212 void remove(FrameWidget*);
00213
00214 QRect boundingRect();
00215 void raiseEnrichements();
00216 void addLegendItem();
00217 bool isPrinting(){return d_is_printing;};
00218
00219 void enablePanningMagnifier(bool on = true, int mode = 0);
00220 bool hasPanningMagnifierEnabled(){if (d_magnifier && d_panner) return true; return false;};
00221 QwtPlotMagnifier* magnifyTool(){return d_magnifier;};
00222
00223 static QString escapeTeXSpecialCharacters(const QString &);
00224 static QString texSuperscripts(const QString &);
00225
00226 void changeCurveIndex(int fromIndex, int toIndex);
00227 void enableDouglasPeukerSpeedMode(double tolerance, int maxPoints);
00228
00229 int speedModeMaxPoints(){return d_speed_mode_points;};
00230 double getDouglasPeukerTolerance(){return d_Douglas_Peuker_tolerance;};
00231
00232 AxisTitlePolicy axisTitlePolicy(){return d_axis_title_policy;};
00233 void setAxisTitlePolicy(const AxisTitlePolicy& policy){d_axis_title_policy = policy;};
00234 void setSynchronizedScaleDivisions(bool on){d_synchronize_scales = on;};
00235
00236 public slots:
00237 void copy(Graph* g);
00238 void copyCurves(Graph* g);
00239
00241
00242
00243 bool isPiePlot();
00245 QwtPieCurve* plotPie(Table* w,const QString& name, int startRow = 0, int endRow = -1);
00247 QwtPieCurve* plotPie(Table* w, const QString& name, const QPen& pen, int brush, int size,
00248 int firstColor, int startRow = 0, int endRow = -1, bool visible = true,
00249 double d_start_azimuth = 270, double d_view_angle = 90, double d_thickness = 33,
00250 double d_horizontal_offset = 0.0, double d_edge_dist = 25, bool d_counter_clockwise = false,
00251 bool d_auto_labeling = true, bool d_values = false, bool d_percentages = true,
00252 bool d_categories = false, bool d_fixed_labels_pos = true);
00253
00254 void removePie();
00255 QString pieLegendText();
00256 QString savePieCurveLayout();
00258
00259 bool addCurves(Table* w, const QStringList& names, int style = 0, double lWidth = 1, int sSize = 3, int startRow = 0, int endRow = -1);
00260 DataCurve* insertCurve(Table* w, const QString& name, int style, int startRow = 0, int endRow = -1);
00261 DataCurve* insertCurve(Table* w, int xcol, const QString& name, int style);
00262 DataCurve* insertCurve(Table* w, const QString& xColName, const QString& yColName, int style, int startRow = 0, int endRow = -1);
00263 void insertPlotItem(QwtPlotItem *i, int type);
00264 void insertCurve(QwtPlotItem *c);
00265
00267 void showCurve(int index, bool visible = true);
00268 int visibleCurves();
00269
00270 void removeCurve(QwtPlotItem *it);
00272 void removeCurve(int index);
00276 void removeCurve(const QString& s);
00280 void removeCurves(const QString& s);
00281
00282 void updateCurvesData(Table* w, const QString& yColName);
00283
00284 int curveCount(){return d_curves.size();};
00285 bool validCurvesDataSize();
00286 double selectedXStartValue();
00287 double selectedXEndValue();
00288
00290 int curveIndex(QwtPlotItem *c){return d_curves.indexOf(c);};
00292 int curveIndex(const QString &title){return plotItemsList().findIndex(title);}
00293 DataCurve* dataCurve(int index);
00295 PlotCurve* curve(int index);
00297 PlotCurve* curve(const QString &title){return curve(curveIndex(title));};
00299 QString curveTitle(int index);
00300
00302 QStringList analysableCurvesList();
00304 QStringList curveNamesList();
00306 QStringList plotItemsList();
00308 QwtPlotItem* plotItem(int index);
00309
00310 void updateCurveNames(const QString& oldName, const QString& newName, bool updateTableName = true);
00311
00313
00314 void setCurveStyle(int index, int s);
00315 void setCurveFullRange(int curveIndex);
00316 void setCurveLineColor(int curveIndex, int colorIndex);
00317 void setCurveLineColor(int curveIndex, QColor qColor);
00318 void setCurveLineStyle(int curveIndex, Qt::PenStyle style);
00319 void setCurveLineWidth(int curveIndex, double width);
00320 void setGrayScale();
00321 void setIndexedColors();
00323
00325
00326 void print();
00327 void copyImage();
00328 QPixmap graphPixmap(const QSize& size = QSize(), double scaleFontsFactor = 1.0, bool transparent = false);
00330 void exportToFile(const QString& fileName);
00331 void exportSVG(const QString& fname, const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0);
00332 #ifdef EMF_OUTPUT
00333 void exportEMF(const QString& fname, const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0);
00334 #endif
00335 void exportTeX(const QString& fname, bool color = true, bool escapeStrings = true, bool fontSizes = true,
00336 const QSizeF& customSize = QSizeF(), int unit = FrameWidget::Pixel, double fontsFactor = 1.0);
00337 void exportVector(const QString& fileName, int res = 0, bool color = true,
00338 const QSizeF& customSize = QSizeF (), int unit = FrameWidget::Pixel, double fontsFactor = 1.0);
00339 void exportImage(const QString& fileName, int quality = 100, bool transparent = false,
00340 int dpi = 0, const QSizeF& customSize = QSizeF (),
00341 int unit = FrameWidget::Pixel, double fontsFactor = 1.0);
00342
00343 void draw(QPaintDevice *, const QSize& size, double fontsFactor = 1.0);
00344 static QSize customPrintSize(const QSizeF& customSize, int unit, int dpi);
00345
00346 bool isExportingTeX(){return d_is_exporting_tex;};
00347 void setTeXExportingMode(bool on = true){d_is_exporting_tex = on;};
00348 bool escapeTeXStrings(){return d_tex_escape_strings;};
00349 void setEscapeTeXStringsMode(bool on = true){d_tex_escape_strings = on;};
00351
00352 void updatePlot();
00353
00355
00356 QwtErrorPlotCurve* addErrorBars(const QString& xColName, const QString& yColName, Table *errTable,
00357 const QString& errColName, int type = 1, double width = 1, int cap = 8, const QColor& color = QColor(Qt::black),
00358 bool through = true, bool minus = true, bool plus = true);
00359
00360 QwtErrorPlotCurve* addErrorBars(const QString& yColName, Table *errTable, const QString& errColName,
00361 int type = 1, double width = 1, int cap = 8, const QColor& color = QColor(Qt::black),
00362 bool through = true, bool minus = true, bool plus = true);
00363
00364 void updateErrorBars(QwtErrorPlotCurve *er, bool xErr, double width, int cap, const QColor& c, bool plus, bool minus, bool through);
00365
00367 DataCurve* masterCurve(QwtErrorPlotCurve *er);
00369 DataCurve* masterCurve(const QString& xColName, const QString& yColName);
00371
00373
00374 void contextMenuEvent(QContextMenuEvent *);
00375 void closeEvent(QCloseEvent *e);
00376 bool focusNextPrevChild ( bool next );
00378
00380 void invertScale(int axis);
00381 void setScale(int axis, double start, double end, double step = 0.0,
00382 int majorTicks = 5, int minorTicks = 5, int type = 0, bool inverted = false,
00383 double left_break = -DBL_MAX, double right_break = DBL_MAX, int pos = 50,
00384 double stepBeforeBreak = 0.0, double stepAfterBreak = 0.0, int minTicksBeforeBreak = 4,
00385 int minTicksAfterBreak = 4, bool log10AfterBreak = false, int breakWidth = 4, bool breakDecoration = true);
00386 double axisStep(int axis){return d_user_step[axis];};
00387 void setCanvasCoordinates(const QRectF&);
00388
00390
00391 CurveLayout initCurveLayout(int style, int curves = 0, bool guessLayout = true);
00392 static CurveLayout initCurveLayout();
00393 void updateCurveLayout(PlotCurve* c, const CurveLayout *cL);
00395 void guessUniqueCurveLayout(int& colorIndex, int& symbolIndex);
00397
00399
00400 void zoomed (const QwtDoubleRect &);
00401 void zoom(bool on);
00402 void zoomOut();
00403 bool zoomOn();
00405
00406 void setAutoScale();
00407 void updateScale();
00408
00410
00411 QString saveToString(bool saveAsTemplate = false);
00412 QString saveScale();
00413 QString saveScaleTitles();
00414 QString saveFonts();
00415 QString saveMarkers();
00416 QString saveCurveLayout(int index);
00417 QString saveAxesTitleColors();
00418 QString saveAxesColors();
00419 QString saveEnabledAxes();
00420 QString saveCanvas();
00421 QString saveTitle();
00422 QString saveAxesTitleAlignement();
00423 QString saveEnabledTickLabels();
00424 QString saveTicksType();
00425 QString saveCurves();
00426 QString saveLabelsFormat();
00427 QString saveLabelsRotation();
00428 QString saveAxesLabelsType();
00429 QString saveAxesBaseline();
00430 QString saveAxesFormulas();
00431 QString saveAxesBackbones();
00432 QString saveTickLabelsSpace();
00433 QString saveLabelsPrefixAndSuffix();
00435
00437
00438 LegendWidget* addText(LegendWidget*);
00440 LegendWidget* insertText(const QStringList& list, int fileVersion);
00441
00442 LegendWidget* addTimeStamp();
00443 void removeLegendItem(int index);
00444 void insertLegend(const QStringList& lst, int fileVersion);
00445
00446 LegendWidget* newLegend(const QString& text = QString());
00448 QString legendText(bool layerSpec = false);
00450
00452
00453 LegendWidget* legend();
00454 void setLegend(const QString&);
00455 void removeLegend();
00457
00459
00460 ArrowMarker* addArrow(ArrowMarker* mrk);
00461 void remove(ArrowMarker* arrow);
00462
00464 void addArrow(QStringList list, int fileVersion);
00465 QList<ArrowMarker *> arrowsList(){return d_lines;};
00466 int numArrows(){return d_lines.count();};
00467
00469 void drawLine(bool on, bool arrow = false);
00470 bool drawArrow(){return drawArrowOn;};
00471 bool drawLineActive(){return drawLineOn;};
00472 bool arrowMarkerSelected();
00474
00476
00477 ImageWidget* addImage(ImageWidget* i);
00478 ImageWidget* addImage(const QString& fileName);
00479 ImageWidget* addImage(const QImage& image);
00480
00481 void insertImageMarker(const QStringList& lst, int fileVersion);
00482 bool imageMarkerSelected();
00484
00486
00487 void removeMarker();
00489 void updateMarkersBoundingRect(bool rescaleEvent = true);
00490
00497 void setSelectedArrow(ArrowMarker* mrk, bool add = false);
00498 ArrowMarker* selectedArrow(){return d_selected_arrow;};
00499 bool markerSelected();
00501 void deselectMarker();
00503
00505
00506 QwtScaleWidget* currentScale();
00507 QwtScaleWidget* selectedScale();
00508 QRect axisTitleRect(const QwtScaleWidget *scale);
00509 bool axisTitleSelected();
00510
00511 ScaleDraw::ScaleType axisType(int axis);
00512
00513 void setXAxisTitle(const QString& text);
00514 void setYAxisTitle(const QString& text);
00515 void setRightAxisTitle(const QString& text);
00516 void setTopAxisTitle(const QString& text);
00517
00518 QString axisTitleString(int axis);
00519 void setAxisTitle(int axis, const QString& text);
00520 void updateAxesTitles();
00522 void setScaleTitle(int axis, const QString& text);
00523
00524 QFont axisTitleFont(int axis);
00525 void setAxisTitleFont(int axis,const QFont &fnt);
00526
00527 void setAxisFont(int axis, const QFont &fnt);
00528 void initFonts(const QFont &scaleTitleFnt,const QFont &numbersFnt);
00529
00530 QColor axisTitleColor(int axis);
00531 void setAxisTitleColor(int axis, const QColor& c);
00532
00533 int axisTitleAlignment (int axis);
00534 void setAxisTitleAlignment(int axis, int align);
00535
00536 int axisTitleDistance(int axis);
00537 void setAxisTitleDistance(int axis, int dist);
00538
00539 QColor axisColor(int axis);
00540 void setAxisColor(int axis, const QColor& color);
00541
00542 QColor axisLabelsColor(int axis);
00543 void setAxisLabelsColor(int axis, const QColor& color);
00544
00545 void showAxis(int axis, int type, const QString& formatInfo, Table *table, bool axisOn,
00546 int majTicksType, int minTicksType, bool labelsOn, const QColor& c, int format,
00547 int prec, int rotation, int baselineDist, const QString& formula, const QColor& labelsColor,
00548 int spacing = 4, bool backbone = true, const ScaleDraw::ShowTicksPolicy& showTicks = ScaleDraw::ShowAll,
00549 const QString& prefix = QString::null, const QString& suffix = QString::null);
00550
00551 void enableAxis(int axis, bool on = true);
00552 void enableAxisLabels(int axis, bool on = true);
00553
00554 int labelsRotation(int axis);
00555 void setAxisLabelRotation(int axis, int rotation);
00556
00558 void loadAxesLinewidth(int width);
00559
00560 void drawAxesBackbones(bool yes);
00561 bool axesBackbones(){return drawAxesBackbone;};
00563 void loadAxesOptions(const QStringList& lst);
00564
00565 void setAxisMargin(int axis, int margin);
00566
00567 void setMajorTicksType(const QList<int>& lst);
00568 void setMajorTicksType(const QStringList& lst);
00569
00570 void setMinorTicksType(const QList<int>& lst);
00571 void setMinorTicksType(const QStringList& lst);
00572
00573 void setAxisTicksLength(int axis, int majTicksType, int minTicksType, int minLength, int majLength);
00574 void setTicksLength(int minLength, int majLength);
00575 void changeTicksLength(int minLength, int majLength);
00577 void setLabelsNumericFormat(const QStringList& l);
00578 void setLabelsNumericFormat(int axis, int format, int prec = 6, const QString& formula = QString());
00579 void setLabelsDateTimeFormat(int axis, int type, const QString& formatInfo);
00580 void setLabelsDayFormat(int axis, int format);
00581 void setLabelsMonthFormat(int axis, int format);
00582
00583 QString axisFormatInfo(int axis);
00584
00585 void setLabelsTextFormat(int axis, int type, const QString& name, const QStringList& lst);
00586 void setLabelsTextFormat(int axis, int type, const QString& labelsColName, Table *table);
00587
00588 QString axisFormula(int axis);
00589 void setAxisFormula(int axis, const QString &);
00591
00593
00594 void setCanvasFrame(int width = 1, const QColor& color = QColor(Qt::black));
00595 QColor canvasFrameColor();
00596 int canvasFrameWidth();
00598
00600
00601 void setTitleFont(const QFont &fnt);
00602 void setTitleColor(const QColor &c);
00603 void setTitleAlignment(int align);
00604
00605 bool titleSelected();
00606 void selectTitle(bool select = true);
00608 void clearTitle();
00610 void removeTitle();
00611 void initTitle( bool on, const QFont& fnt);
00613
00615
00616 QString selectedCurveTitle();
00618
00619 void disableTools();
00620
00627 bool enableRangeSelectors(const QObject *status_target=NULL, const char *status_slot="");
00628 bool rangeSelectorsEnabled();
00629 QPointer<RangeSelectorTool> rangeSelectorTool(){return d_range_selector;};
00631
00632 void setFrame(int width = 1, const QColor& color = Qt::black);
00633 void setBackgroundColor(const QColor& color);
00635
00636 void addFitCurve(QwtPlotCurve *c);
00637 void deleteFitCurves();
00638 QList<QwtPlotCurve *> fitCurvesList(){return d_fit_curves;};
00643 int range(const QString& curveTitle, double *start, double *end);
00648 int range(QwtPlotCurve *c, double *start, double *end);
00649
00651 void setBarsGap(int curve, int gapPercent, int offset);
00652
00654
00655 void modifyFunctionCurve(int curve, int type, const QStringList &formulas, const QString &var,
00656 double start, double end, int points, const QMap<QString, double>& constants);
00657 FunctionCurve* addFunction(const QStringList &formulas, double start, double end, int points = 100, const QString &var = "x", int type = 0, const QString& title = QString::null);
00659 FunctionCurve* insertFunctionCurve(const QString& formula, int points, int fileVersion);
00660
00662 QString generateFunctionName(const QString& name = tr("F"));
00664
00666 void createTable(const QString& curveName);
00667 void createTable(const QwtPlotCurve* curve);
00668 void activateGraph();
00669
00671
00672 VectorCurve* plotVectorCurve(Table* w, const QStringList& colList, int style, int startRow = 0, int endRow = -1);
00673 void updateVectorsLayout(int curve, const QColor& color, double width, int arrowLength, int arrowAngle, bool filled, int position,
00674 const QString& xEndColName = QString(), const QString& yEndColName = QString());
00676
00678
00679 BoxCurve* openBoxDiagram(Table *w, const QStringList& l, int fileVersion);
00680 void plotBoxDiagram(Table *w, const QStringList& names, int startRow = 0, int endRow = -1);
00682
00684
00685 void resizeEvent(QResizeEvent *e);
00686 void scaleFonts(double factor);
00688
00689 void notifyChanges();
00690
00691 void updateSecondaryAxis(int axis, bool changeFormat = false);
00692
00693 bool isAutoscalingEnabled(){return d_auto_scale;};
00694 void enableAutoscaling(bool on = true){d_auto_scale = on;};
00695
00696 bool autoscaleFonts(){return autoScaleFonts;};
00697 void setAutoscaleFonts(bool on = true){autoScaleFonts = on;};
00698
00699 static int obsoleteSymbolStyle(int type);
00700 static QString penStyleName(Qt::PenStyle style);
00701 static Qt::PenStyle getPenStyle(const QString& s);
00702 static Qt::PenStyle getPenStyle(int style);
00703 static void showPlotErrorMessage(QWidget *parent, const QStringList& emptyColumns);
00704
00705 void showTitleContextMenu();
00706 void copyTitle();
00707 void cutTitle();
00708
00709 void clearAxisTitle();
00710 void removeAxisTitle();
00711 void cutAxisTitle();
00712 void copyAxisTitle();
00713 void showAxisTitleMenu();
00714 void showAxisContextMenu(int axis);
00715 void hideSelectedAxis();
00716 void showGrids();
00717
00719 void showGrid();
00721 void showGrid(int axis);
00722
00723 void showAxisDialog();
00724 void showScaleDialog();
00725
00727 Spectrogram* spectrogram(Matrix *m);
00729 Spectrogram* plotSpectrogram(Matrix *m, CurveType type);
00731 void restoreSpectrogram(ApplicationWindow *app, const QStringList& lst);
00733 QwtHistogram* addHistogram(Matrix *m);
00735 QwtHistogram* restoreHistogram(Matrix *m, const QStringList& l);
00736
00737 bool antialiasing(){return d_antialiasing;};
00739 void setAntialiasing(bool on = true, bool update = true);
00740
00741 void setCurrentFont(const QFont& f);
00742 void notifyFontChange(const QFont& f){emit currentFontChanged(f);};
00743 void enableTextEditor();
00744
00745 signals:
00746 void selectedGraph (Graph*);
00747 void closedGraph();
00748 void drawLineEnded(bool);
00749 void cursorInfo(const QString&);
00750 void showPlotDialog(int);
00751
00752 void viewLineDialog();
00753 void viewTitleDialog();
00754 void modifiedGraph();
00755 void hiddenPlot(QWidget*);
00756
00757 void showContextMenu();
00758 void showCurveContextMenu(QwtPlotItem *);
00759 void showMarkerPopupMenu();
00760
00761 void showAxisDialog(int);
00762 void axisDblClicked(int);
00763
00764 void showAxisTitleDialog();
00765
00766 void dataRangeChanged();
00767 void showFitResults(const QString&);
00768 void currentFontChanged(const QFont&);
00769 void enableTextEditor(Graph *);
00770 void axisDivChanged(Graph *, int);
00771 void updatedLayout(Graph *);
00772 void selectionChanged(SelectionMoveResizer *);
00773
00774 private slots:
00775 void selectorDeleted();
00776
00777 private:
00778 QString parseAxisTitle(int axis);
00779 QList<FrameWidget*> stackingOrderEnrichmentsList();
00781 QwtDoubleInterval axisBoundingInterval(int axis);
00782 void deselectCurves();
00783
00784 void dropEvent(QDropEvent*);
00785 void dragEnterEvent(QDragEnterEvent*);
00786 void showEvent (QShowEvent * event);
00787 void printFrame(QPainter *painter, const QRect &rect) const;
00788 void printCanvas(QPainter *painter, const QRect &canvasRect,
00789 const QwtScaleMap map[axisCnt], const QwtPlotPrintFilter &pfilter) const;
00790 virtual void printScale (QPainter *, int axisId, int startDist, int endDist,
00791 int baseDist, const QRect &) const;
00792 virtual void drawItems (QPainter *painter, const QRect &rect,
00793 const QwtScaleMap map[axisCnt], const QwtPlotPrintFilter &pfilter) const;
00794
00795 void drawInwardTicks(QPainter *painter, const QRect &rect,
00796 const QwtScaleMap&map, int axis, bool min, bool maj) const;
00797 void drawBreak(QPainter *painter, const QRect &rect, const QwtScaleMap &map, int axis) const;
00798
00799 QwtPlotZoomer *d_zoomer[2];
00800 TitlePicker *titlePicker;
00801 ScalePicker *scalePicker;
00802 CanvasPicker* cp;
00804 Grid *d_grid;
00806 QList<QwtPlotItem*> d_curves;
00808 QList<QwtPlotCurve *>d_fit_curves;
00810 bool d_antialiasing;
00811 bool autoScaleFonts;
00812 bool drawLineOn, drawArrowOn, drawAxesBackbone;
00814 bool d_is_printing;
00816 QVector<double> d_user_step;
00818 QList<ArrowMarker*> d_lines;
00820 ArrowMarker* d_selected_arrow;
00822 QPointer<SelectionMoveResizer> d_markers_selector;
00824 QPointer<RangeSelectorTool> d_range_selector;
00826 PlotToolInterface *d_active_tool, *d_peak_fit_tool;
00828 FrameWidget *d_active_enrichment;
00830 bool d_auto_scale;
00832 int d_min_tick_length, d_maj_tick_length;
00833 bool d_is_exporting_tex;
00834 bool d_tex_escape_strings;
00835 QList<FrameWidget*> d_enrichments;
00836 QwtPlotMagnifier *d_magnifier;
00837 QwtPlotPanner *d_panner;
00838
00839 double d_Douglas_Peuker_tolerance;
00840 int d_speed_mode_points;
00841 AxisTitlePolicy d_axis_title_policy;
00842 bool d_synchronize_scales;
00843 QStringList d_axis_titles;
00844 };
00845 #endif // GRAPH_H