上传缺失文件

This commit is contained in:
duanshengchao 2024-12-25 08:34:51 +08:00
parent f7550112e4
commit 8860553d6e
5 changed files with 144 additions and 1 deletions

View File

@ -0,0 +1,10 @@
#include "dpBaseWidget.h"
dpBaseWidget::dpBaseWidget(QWidget* parent)
:QWidget(parent)
{
}
dpBaseWidget::~dpBaseWidget()
{
}

29
dataPanel/dpBaseWidget.h Normal file
View File

@ -0,0 +1,29 @@
#ifndef DPBASEWIDGET_H
#define DPBASEWIDGET_H
/*******************************************************************************
** DataPanel-BaseWidget
** author dsc
**
** dataPanel中进行数据展示的widget基类
**
**
******************************************************************************/
#include <QWidget>
#include <QDateTime>
#include "global.h"
class dpBaseWidget : public QWidget
{
Q_OBJECT
public:
dpBaseWidget(QWidget *parent = nullptr);
~dpBaseWidget();
virtual void setTimeRange(TimeUnit) {}
virtual void viewHistoricalData(QDateTime) {}
};
#endif

70
dataPanel/dpLineChart.cpp Normal file
View File

@ -0,0 +1,70 @@
#include "dpLineChart.h"
#include "util/Chart/qcustomplot.h"
dpLineChart::dpLineChart(QWidget* parent)
:dpBaseWidget(parent)
{
setAttribute(Qt::WA_TranslucentBackground,true);
m_pCustomPlot = new QCustomPlot(this);
initQCP();
QBoxLayout* mainLayout = new QBoxLayout(QBoxLayout::LeftToRight);
mainLayout->setContentsMargins(0, 1, 0, 0);
mainLayout->addWidget(m_pCustomPlot);
setLayout(mainLayout);
}
dpLineChart::~dpLineChart()
{
}
void dpLineChart::initQCP()
{
m_pCustomPlot->axisRect()->setupFullAxesBox();
m_pCustomPlot->xAxis->setSubTicks(false);
m_pCustomPlot->xAxis2->setTicks(false);
m_pCustomPlot->xAxis2->setSubTicks(false);
m_pCustomPlot->yAxis->setSubTicks(false);
m_pCustomPlot->yAxis2->setTicks(false);
m_pCustomPlot->yAxis2->setSubTicks(false);
//背景颜色
m_pCustomPlot->setBackground(QBrush(Qt::transparent));
//坐标轴颜色
QColor axisColor(100, 100, 100);
m_pCustomPlot->xAxis->setBasePen(axisColor);
m_pCustomPlot->xAxis->setTickPen(axisColor);
m_pCustomPlot->xAxis2->setBasePen(axisColor);
m_pCustomPlot->xAxis2->setTickPen(axisColor);
m_pCustomPlot->yAxis->setBasePen(axisColor);
m_pCustomPlot->yAxis->setTickPen(axisColor);
m_pCustomPlot->yAxis2->setBasePen(axisColor);
m_pCustomPlot->yAxis2->setTickPen(axisColor);
//坐标刻度颜色
QColor tickColor(100, 100, 100);
m_pCustomPlot->xAxis->setTickPen(QPen(tickColor));
m_pCustomPlot->yAxis->setTickPen(QPen(tickColor));
//坐标刻度Label颜色
QColor tickLabelColor(250, 250, 250);
m_pCustomPlot->xAxis->setTickLabelColor(tickLabelColor);
m_pCustomPlot->xAxis->setTickLabelFont(QFont(QString::fromWCharArray(L"黑体"), 10));
m_pCustomPlot->yAxis->setTickLabelColor(tickLabelColor);
m_pCustomPlot->yAxis->setTickLabelFont(QFont(QString::fromWCharArray(L"黑体"), 10));
//网格线颜色
QColor gridColor(100, 100, 100);
m_pCustomPlot->xAxis->grid()->setPen(QPen(gridColor, 1, Qt::DotLine));
m_pCustomPlot->xAxis->grid()->setZeroLinePen(QPen(gridColor, 1, Qt::DotLine));
m_pCustomPlot->yAxis->grid()->setPen(QPen(gridColor, 1, Qt::DotLine));
m_pCustomPlot->yAxis->grid()->setZeroLinePen(QPen(gridColor, 1, Qt::DotLine));
}
void dpLineChart::setTimeRange(TimeUnit unit)
{
}
void dpLineChart::viewHistoricalData(QDateTime dateTime)
{
}

34
dataPanel/dpLineChart.h Normal file
View File

@ -0,0 +1,34 @@
#ifndef DPLINECHART_H
#define DPLINECHART_H
/*******************************************************************************
** DataPanel-LineChart
** author dsc
**
** 线TimeLine等组件进行时间属性的交互
** QCustomPlot实现
**
******************************************************************************/
#include "dpBaseWidget.h"
class QCustomPlot;
class dpLineChart : public dpBaseWidget
{
Q_OBJECT
public:
dpLineChart(QWidget *parent = nullptr);
~dpLineChart();
void setTimeRange(TimeUnit);
void viewHistoricalData(QDateTime);
private:
void initQCP();
QCustomPlot* m_pCustomPlot;
};
#endif

View File

@ -3,7 +3,7 @@
/******************************************************************************* /*******************************************************************************
** TimeLine-TimeLineItem ** TimeLine-TimeLineItem
** author ** author dsc
** **
** TimeLine的核心组件线 ** TimeLine的核心组件线
** **