/* * ColorAxis.cc * * Created on: 30 jun. 2014 * Author: AKKA */ #include "ColorAxis.hh" using namespace plot; std::string ColorAxis::getPlotOpt() { std::string options = DigitalAxis::getPlotOpt(); //b & c : Draws edge of frame //options += "bc"; //v: Write numeric labels for vertical axis parallel to the base of the graph, // rather than parallel to the axis. options += "v"; /*//Use custom labelling function to generate axis label text. options += "o"; if (_scale == Scale::LOGARITHMIC) //l: Labels axis logarithmically options += "l";*/ return options; } ColorAxis::Format ColorAxis::getFormat() { //always used scientific format for color axis return DigitalAxis::Format::SCIENTIFIC; } void ColorAxis::writeContext(ContextFileWriter& writer) { writer.startElement("axis"); writer.addAttribute("id", _id.c_str()); writer.addAttribute("logarithmic", (_scale == Scale::LOGARITHMIC) ? "true" : "false"); std::ostringstream outMin; outMin << std::setprecision(12) << getRange().getMin(); std::ostringstream outMax; outMax << std::setprecision(12) << getRange().getMax(); writer.addAttribute("min", outMin.str().c_str()); writer.addAttribute("max", outMax.str().c_str()); std::ostringstream colorListStr; for (unsigned int i(0); i < _colorsList.size(); ++i){ colorListStr << "[" << _colorsList[i][0] << "," << _colorsList[i][1] << "," << _colorsList[i][2] << "]|"; } writer.addAttribute("colorsList",colorListStr.str().c_str()); writer.endElement(); }