Go to the documentation of this file.00001
00012 #include "FuncChiRep.h"
00013
00014 #include "graphics/ViewBase.h"
00015 #include "pattern/string_convert.h"
00016 #include "projectors/FunctionProjector.h"
00017
00018 #include <iomanip>
00019 #include <sstream>
00020
00021 using std::string;
00022
00023 using namespace hippodraw;
00024
00025 FuncChiRep::FuncChiRep ( )
00026 : TextRepBase ( "Chi-squared" )
00027 {
00028 }
00029
00030 FuncChiRep::FuncChiRep ( const FuncChiRep & rep )
00031 : TextRepBase( rep )
00032 {
00033 }
00034
00035 RepBase * FuncChiRep::clone ()
00036 {
00037 return new FuncChiRep ( *this );
00038 }
00039
00040 void
00041 FuncChiRep::
00042 drawProjectedValues ( ProjectorBase & proj,
00043 ViewBase & view )
00044 {
00045 const FunctionProjector & projector
00046 = dynamic_cast< const FunctionProjector & > ( proj );
00047
00048 int dof = projector.degreesOfFreedom ();
00049
00050 std::ostringstream message;
00051 message << "chi^2 / dof = "
00052 << std::setprecision(3)
00053 << projector.objectiveValue()
00054 << " / " << dof;
00055
00056 view.drawText ( message.str(), 5.0, 0.0, m_size, 0, 'l', 't', true,
00057 0, &m_color );
00058 }