Exemplo n.º 1
0
void CQBarChart::setColors(std::vector<QColor> mColors, double min, double max)
{
#ifdef DEBUG_UI
  qDebug() << "-- in qwt3dPlot.cpp Plot3d::setColors --";
#endif
  unsigned int i;
  mData.maxValue = max;
  mData.minValue = min;
  Qwt3D::ColorVector cv;

  Qwt3D::RGBA rgb;

  for (i = 0; i < mColors.size(); i++)
    {
      double r, g, b;
      r = (mColors[i].red()); g = (mColors[i].green()); b = (mColors[i].blue());
      rgb.r = r / 254; rgb.g = g / 254; rgb.b = b / 254;
      //rgb.a = 1;
      cv.push_back(rgb);
    }

  BarColor* mpCol = new BarColor(mpPlot, 100, min, max);
  mpCol->setColorVector(cv);
  mpPlot->setDataColor(mpCol);
}
void EnrichmentMainWindow::setColor()
{	
  Qwt3D::ColorVector cv;
	
	RGBA rgb;
	int i = 252;
	int step = 4;

  while (i>=0)
  {    
    rgb.r = i/255.; rgb.g=(i-60>0) ? (i-60)/255.:0;rgb.b=0;
  //  rgb.a = 0.2;
    cv.push_back(rgb);	
    if (!--step) 
    {
      i-=4;
      step=4;
    }
  }
	StandardColor* col = new StandardColor(plot);
	col->setColorVector(cv);
	
	plot->setDataColor(col);
}