qcustomplot彩虹色 Rainbow

1.
在.h文件
class QCPColorGradient枚举enum GradientPreset最后添加一行
,gpRainbow
即:
  enum GradientPreset { gpGrayscale  ///< Continuous lightness from black to white (suited for non-biased data representation)
                        ,gpHot       ///< Continuous lightness from black over firey colors to white (suited for non-biased data representation)
                        ,gpCold      ///< Continuous lightness from black over icey colors to white (suited for non-biased data representation)
                        ,gpNight     ///< Continuous lightness from black over weak blueish colors to white (suited for non-biased data representation)
                        ,gpCandy     ///< Blue over pink to white
                        ,gpGeography ///< Colors suitable to represent different elevations on geographical maps
                        ,gpIon       ///< Half hue spectrum from black over purple to blue and finally green (creates banding illusion but allows more precise magnitude estimates)
                        ,gpThermal   ///< Colors suitable for thermal imaging, ranging from dark blue over purple to orange, yellow and white
                        ,gpPolar     ///< Colors suitable to emphasize polarity around the center, with blue for negative, black in the middle and red for positive values
                        ,gpSpectrum  ///< An approximation of the visible light spectrum (creates banding illusion but allows more precise magnitude estimates)
                        ,gpJet       ///< Hue variation similar to a spectrum, often used in numerical visualization (creates banding illusion but allows more precise magnitude estimates)
                        ,gpHues      ///< Full hue cycle, with highest and lowest color red (suitable for periodic data, such as angles and phases, see \ref setPeriodic)
                        ,gpRainbow   /// rainbow  add
                      };

2.
在.cpp文件
void QCPColorGradient::loadPreset(GradientPreset preset)方法switch最后添加
  case gpRainbow: // rainbow
      //setColorInterpolation(ciRGB);
      //setColorStopAt(-1, QColor(0, 0, 255));
      //setColorStopAt(-0.5, QColor(0, 255, 255));
      //setColorStopAt(0, QColor(0, 255, 0));
      //setColorStopAt(0.5, QColor(255, 255, 0));
      //setColorStopAt(1, QColor(255, 0, 0));

      setColorInterpolation(ciRGB);
      setColorStopAt(0, QColor(0, 0, 255));
      setColorStopAt(0.25, QColor(0, 255, 255));
      setColorStopAt(0.5, QColor(0, 255, 0));
      setColorStopAt(0.75, QColor(255, 255, 0));
      setColorStopAt(1, QColor(255, 0, 0));
      break;

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值