本文整理汇总了C++中Axis::fixRange方法的典型用法代码示例。如果您正苦于以下问题:C++ Axis::fixRange方法的具体用法?C++ Axis::fixRange怎么用?C++ Axis::fixRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Axis
的用法示例。
在下文中一共展示了Axis::fixRange方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resetAxes
void Graph::resetAxes()
{
// Step 1: Reset all axes. Initialize the data limits of the axis to
// impossible values.
Tcl_HashSearch cursor;
for (Tcl_HashEntry* hPtr = Tcl_FirstHashEntry(&axes_.table, &cursor);
hPtr; hPtr = Tcl_NextHashEntry(&cursor)) {
Axis *axisPtr = (Axis*)Tcl_GetHashValue(hPtr);
axisPtr->min_ = axisPtr->valueRange_.min = DBL_MAX;
axisPtr->max_ = axisPtr->valueRange_.max = -DBL_MAX;
}
// Step 2: For each element that's to be displayed, get the smallest
// and largest data values mapped to each X and Y-axis. This
// will be the axis limits if the user doesn't override them
// with -min and -max options.
for (ChainLink* link = Chain_FirstLink(elements_.displayList); link;
link = Chain_NextLink(link)) {
Region2d exts;
Element* elemPtr = (Element*)Chain_GetValue(link);
ElementOptions* elemops = (ElementOptions*)elemPtr->ops();
elemPtr->extents(&exts);
elemops->xAxis->getDataLimits(exts.left, exts.right);
elemops->yAxis->getDataLimits(exts.top, exts.bottom);
}
// Step 3: Now that we know the range of data values for each axis,
// set axis limits and compute a sweep to generate tick values.
for (Tcl_HashEntry* hPtr = Tcl_FirstHashEntry(&axes_.table, &cursor);
hPtr; hPtr = Tcl_NextHashEntry(&cursor)) {
Axis *axisPtr = (Axis*)Tcl_GetHashValue(hPtr);
AxisOptions* ops = (AxisOptions*)axisPtr->ops();
axisPtr->fixRange();
double min = axisPtr->min_;
double max = axisPtr->max_;
if ((!isnan(axisPtr->scrollMin_)) && (min < axisPtr->scrollMin_))
min = axisPtr->scrollMin_;
if ((!isnan(axisPtr->scrollMax_)) && (max > axisPtr->scrollMax_))
max = axisPtr->scrollMax_;
if (ops->logScale)
axisPtr->logScale(min, max);
else
axisPtr->linearScale(min, max);
}
}