/**************************************************************************
*   IRA Istituto di Radioastronomia                                       *
*   Created Feb 2005 by matteo murgia                                     *
*   murgia@ira.cnr.it                                                     *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
*   This program is distributed in the hope that it will be useful,       *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
*   GNU General Public License for more details.                          *
*                                                                         *
*   You should have received a copy of the GNU General Public License     *
*   along with this program; if not, write to the                         *
*   Free Software Foundation, Inc.,                                       *
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
***************************************************************************/

#ifndef __IRAHISTOGRAM__
#define __IRAHISTOGRAM__
#include "IRA_plotter.h"
#include "IRA_box.h"

using namespace std;

namespace IRA_GRAPH {

  //The IRA_histogram class provides a histogram in a box. 
  class IRA_histogram: public QCanvasRectangle {
  
  public:

    IRA_histogram(IRA_box*);
    ~IRA_histogram();

    int rtti () const { return IRA_plotter::Histogram; }
    
    void set_sample(const vector<double> data, double binsize=-1);
    void set_histogram(vector<double> bc, vector<int> hi);

  protected:
    void drawShape( QPainter & );
    
  private:
    IRA_box* box;
    void init();
    
    //friend void IRA_box::draw_ticks(QPainter&, double f=1.0); 

    double binsize,xmin,xmax;
    vector<int> histo;
    vector<double> bincenter;

  };
}

#endif
