33 if(pYRange.second < pYRange.first)
34 throw std::invalid_argument(
"Bar value range is not allowed to be empty.");
53 *(
mGnuplotHandler) <<
"set yrange [" << pYRange.first <<
":" << pYRange.second <<
"]\n";
60 *(
mGnuplotHandler) <<
"set style fill transparent solid 0.75 border -1\n";
67 std::vector<std::string>::const_iterator barLabelIterator;
70 for(barLabelIterator = pBarLabels.begin(); barLabelIterator != pBarLabels.end(); barLabelIterator++) {
72 std::pair<float, std::pair<std::string, float> > zeroBar = std::make_pair(static_cast<float>(std::distance(pBarLabels.begin(), barLabelIterator)), std::make_pair(
"\"" + *barLabelIterator +
"\"", 0.0
f));
83 throw std::runtime_error(
"Cannot update non-existing gnuplot visualization.");
86 std::vector<std::pair<float, std::pair<std::string, float> > >::iterator barChartBufferIterator;
89 std::map<std::string, float>::const_iterator currentDataIterator;
94 currentDataIterator = pCurrentData.find(barChartBufferIterator->second.first.substr(1, barChartBufferIterator->second.first.size() - 2));
97 if(currentDataIterator != pCurrentData.end()) {
100 if(currentDataIterator->second <
mYRange.first || currentDataIterator->second >
mYRange.second)
101 throw std::invalid_argument(
"Bar chart value " + boost::lexical_cast<std::string>(currentDataIterator->second) +
" is outside allowed range.");
104 barChartBufferIterator->second.second = currentDataIterator->second;
113 throw std::runtime_error(
"Cannot show non-existing gnuplot visualization.");
117 throw std::logic_error(
"Chart with no bars cannot be shown.");
void updateBarChartValues(const std::map< std::string, float > &pCurrentData)
boost::shared_ptr< Gnuplot > mGnuplotHandler
void sendBarChartToGnuplot(const bool pHighlightHighestValue)
void initAnimatedBarChart(const std::vector< std::string > &pBarLabels, const std::string &pBarChartTitle, const std::string &pYLabel, const std::pair< float, float > &pYRange)
std::vector< std::pair< float, std::pair< std::string, float > > > mBarChartBuffer
std::pair< float, float > mYRange