24 const double failback_min = 0.0;
25 const double failback_max = 1.0;
30 template <
typename T>
auto get_min_max(
const std::vector<GraphItem*>& graphs, T func)
32 std::vector<double> values;
33 for (
auto graph : graphs) {
34 const auto array = func(graph);
35 std::copy(std::begin(array), std::end(array), std::back_inserter(values));
38 auto [xmin, xmax] = std::minmax_element(std::begin(values), std::end(values));
39 return xmin != xmax ? std::make_pair(*xmin, *xmax) :
std::make_pair(failback_min, failback_max);
54 return items<GraphItem>(
T_ITEMS);
61 std::vector<GraphItem*> all_items = items<GraphItem>(
T_ITEMS);
62 std::vector<GraphItem*> visible_items;
63 std::copy_if(all_items.begin(), all_items.end(), std::back_inserter(visible_items),
65 return graph_item->property<bool>(GraphItem::P_DISPLAYED);
74 std::vector<GraphItem*> output;
75 for (
auto graph_item : items<GraphItem>(
T_ITEMS)) {
76 if (std::find(visible_graph_items.begin(), visible_graph_items.end(), graph_item)
77 != visible_graph_items.end())
88 for (
auto graph_item : items<GraphItem>(
T_ITEMS))
One-dimensional graph representation of Data1DItem.
static const std::string P_DISPLAYED
std::vector< double > binValues() const
std::vector< double > binCenters() const
void setAllVisible()
Reset the graph selection.
std::vector< GraphItem * > visibleGraphItems() const
Returns the selected graph items.
void setVisible(const std::vector< GraphItem * > &visible_graph_items)
Set the graph selection.
GraphViewportItem(const std::string &model_type=Constants::GraphViewportItemType)
std::pair< double, double > data_yaxis_range() const override
Returns lower, upper range on y-axis occupied by all data points of all graphs.
std::pair< double, double > data_xaxis_range() const override
Returns lower, upper range on x-axis occupied by all data points of all graphs.
std::vector< GraphItem * > graphItems() const
Returns the selected graph items.
void registerTag(const TagInfo &tagInfo, bool set_as_default=false)
Registers tag to hold items under given name.
static TagInfo universalTag(std::string name, std::vector< std::string > modelTypes={})
Constructs universal tag intended for unlimited amount of various items.
Base class to represent 2D viewport.
static const std::string T_ITEMS
const model_type GraphItemType
materialitems.h Collection of materials to populate MaterialModel.