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


C++ TText::GetTextSize方法代码示例

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


在下文中一共展示了TText::GetTextSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: plot

//--------------------------------------------------------------------------------------------------
void plot(long int xStart, long int xEnd, TString text, TString pngFileName)
{
  // Make sure we have the right styles
  MitRootStyle::Init();
  MitRootStyle::SetStyleWide();
  gStyle->SetPadRightMargin(0.07); // to make sure the exponent is on the picture

  // will execute a shell command to get the data
  TString timeSeriesFile("timeSeriesOfRates.txt");

  // Now open our database output
  ifstream input;
  input.open(timeSeriesFile.Data());

  Int_t time=0, nConn=0, nLines=0;
  Double_t rate=0, xMin=double(xStart), xMax=double(xEnd), maxRate=1.0;

  // First loop to determine the boundaries (could be done in one round, dynamically)
  //---------------------------------------------------------------------------------
  while (1) {
    // read in 
    input >> time >> rate >> nConn;
    // check it worked
    if (! input.good())
      break;

    //printf(" Min / Time / Max: %d %d %d\n",xStart,time,xEnd);

    // check whether in our requested time window
    if (xStart>0 && xStart>time)
      continue;
    if (xEnd>0 && xEnd<time)
      continue;
    
    // Show what we are reading
    if (nLines < 5)
      printf(" time=%d, rate=%8f nConnections=%d\n",time, rate, nConn);

    // Determine plot maximum
    if (rate > maxRate)
      maxRate = rate;
    if (nConn > maxRate)
      maxRate = double(nConn);

    nLines++;
  }
  input.close();

  printf(" \n");
  printf(" Found %d measurements.\n",nLines);
  printf(" Maximum tranfer rate at: %6.2f MB/sec\n",maxRate);
  printf(" \n");

  // Open a canvas
  TCanvas *cv = new TCanvas();
  cv->Draw();

  if (nLines<1) {
    printf(" WARNING - no measurements selected.\n");
    plotFrame(double(xStart),double(xEnd));
    double dX = double(xEnd)-double(xStart);
    TText *plotText = new TText(xMin-dX*0.14,0.-(maxRate*1.2*0.14),text.Data());
    printf("Text size: %f\n",plotText->GetTextSize());
    plotText->SetTextSize(0.04);
    plotText->SetTextColor(kBlue);
    plotText->Draw();
    cv->SaveAs(pngFileName.Data());
    return;
  }

  const int numVals = nLines;
  double xVals[numVals];
  double y1Vals[numVals];
  double y2Vals[numVals];

  input.open(timeSeriesFile.Data());

  // Second loop to register the measured values
  //--------------------------------------------
  Int_t i = 0;
  while (1) {
    // read in 
    input >> time >> rate >> nConn;
    // check it worked
    if (!input.good())
      break;

    // check whether in our requested time window
    if (xStart>0 && xStart>time)
      continue;
    if (xEnd>0 && xEnd<time)
      continue;

    xVals[i] = time;
    y1Vals[i] = rate;
    y2Vals[i] = nConn;

    i++;
  }
//.........这里部分代码省略.........
开发者ID:BambuPhysics,项目名称:MitPlots,代码行数:101,代码来源:plotSmartCacheTransferRate.C


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