Back

//---------------------------------------------------------------------------
// N.V.Shokhirev
// created:  20041020
// modified: 20051020
// modified: 20060107 - switched to real
//---------------------------------------------------------------------------
#ifndef Graph2DH
#define Graph2DH
#include "MatUtils.h"
#include "dynarrays.h"
//#include <math.h>

//---------------------------------------------------------------------------
AnsiString FloatToStr(real x);

// Minimal necessary number of decimals for labeling the interval [Xmin, Xmax]
int MinDec(real Xmin, real Xmax);

// Compact output of real numbers
String CompactFloatToStr(real z, int decimals);

void SetLim(real& x1, real& x2);

class PlotBox2D : public TPaintBox
{
  private:// User declarations
    real fXmin;
    real fXmax;
    real fYmin;
    real fYmax;
    real rTdH ;
    real rBdH ;
    real rW   ;
    real rLdW ;
    real rRdW ;
    real rH   ;
    int TdH ;
    int BdH ;
    int LdW ;
    int RdW ;
  public:// User declarations
    __fastcall PlotBox2D(Classes::TComponent* Owner);
    __fastcall virtual ~PlotBox2D(void) { }
    real Xi2r( int iX);
    real Yi2r( int iY);
    void SetLimits(real Xmin, real Xmax, real Ymin, real Ymax);
    int XDec; // X-Label decimals
    int YDec; // Y-Label decimals
    real GetXmax();
    real GetXmin();
    real GetYmin();
    real GetYmax();
    void SetXmin(real Value);
    void SetXmax(real Value);
    void SetYmin(real Value);
    void SetYmax(real Value);
    int Yr2i(real Y) ;
    int Xr2i(real X) ;
    real XYRatio;
    int NYTicks ;
    int NXTicks ;
    bool XCaption;
    bool YCaption;
    String XTitle;
    String YTitle;
    TColor FrameColor;
    int GetPenWidth()  ;
    void SetPenWidth(int Value);
    TColor GetPenColor()  ;
    TColor GetBrushColor();
    void SetPenColor(  TColor Value);
    void SetBrushColor(TColor Value);
    void Circle( real x, real y, int r);
    void MoveToF(real x, real y);
    void LineToF(real x, real y);
    void LineF(real x1, real y1, real x2, real y2);
  void RectangleF(real x1, real y1, real x2, real y2);
    void PlotFrame();
    void PlotArrays(FArr1D& x, FArr1D& y, TColor color);
    void PlotArray(FArr1D& y, TColor color);
};

#endif

Back