当前位置: 首页>>代码示例>>C++>>正文


C++ Axis::logScale方法代码示例

本文整理汇总了C++中Axis::logScale方法的典型用法代码示例。如果您正苦于以下问题:C++ Axis::logScale方法的具体用法?C++ Axis::logScale怎么用?C++ Axis::logScale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Axis的用法示例。


在下文中一共展示了Axis::logScale方法的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);
  }
}
开发者ID:SAOImageDS9,项目名称:tkblt,代码行数:49,代码来源:tkbltGraph.C


注:本文中的Axis::logScale方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。