CustomPlotHelper.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef CUSTOMPLOTHELPER_H
  2. #define CUSTOMPLOTHELPER_H
  3. #include "CustomplotHead.h"
  4. class VCustomPlot;
  5. class CustomPlotHelper
  6. {
  7. public:
  8. //获取内置颜色集合
  9. static lcolor colors;
  10. static lcolor getColorList();
  11. static QStringList getColorNames();
  12. //随机获取颜色集合中的颜色
  13. static QColor getRandColor();
  14. //获取随机数,指定最小值和最大值
  15. static double getRandValue(int min, int max);
  16. //16进制字符串转为short
  17. static qint16 strHexToShort(const QString &strHex);
  18. //从数据坐标中取出XY轴范围值 offset为偏移值
  19. static void getRange(const vpoint &points, double &minX, double &maxX, double &minY, double &maxY, double offset = 0);
  20. //从多个数组中取出最大值
  21. static double getMaxValue(const lvdouble &values);
  22. //从多个数组中取出和最大值
  23. static double getMaxValue2(const lvdouble &values);
  24. //设置画布背景颜色形成面积图
  25. static void setGraphBrush(QCPGraph *graph, const QColor &color, int type);
  26. static void setGraphBrush(QPainter *painter, const QColor &color, int type);
  27. static void setGraphBrush(QCPGraph *graph, QPainter *painter, const QColor &color, int type);
  28. };
  29. #endif // CUSTOMPLOTHELPER_H