Added new type of chart view for double linear charts.

This commit is contained in:
23rd 2023-09-11 15:22:24 +03:00 committed by John Preston
parent 646390141a
commit 74313d23f3
4 changed files with 11 additions and 3 deletions

View file

@ -17,6 +17,7 @@ struct Limits final {
enum class ChartViewType { enum class ChartViewType {
Linear, Linear,
Stack, Stack,
DoubleLinear,
}; };
} // namespace Statistic } // namespace Statistic

View file

@ -16,11 +16,14 @@ namespace Statistic {
std::unique_ptr<AbstractChartView> CreateChartView(ChartViewType type) { std::unique_ptr<AbstractChartView> CreateChartView(ChartViewType type) {
switch (type) { switch (type) {
case ChartViewType::Linear: { case ChartViewType::Linear: {
return std::make_unique<LinearChartView>(); return std::make_unique<LinearChartView>(false);
} break; } break;
case ChartViewType::Stack: { case ChartViewType::Stack: {
return std::make_unique<StackChartView>(); return std::make_unique<StackChartView>();
} break; } break;
case ChartViewType::DoubleLinear: {
return std::make_unique<LinearChartView>(true);
} break;
default: Unexpected("Type in Statistic::CreateChartView."); default: Unexpected("Type in Statistic::CreateChartView.");
} }
} }

View file

@ -55,7 +55,9 @@ void PaintChartLine(
} // namespace } // namespace
LinearChartView::LinearChartView() = default; LinearChartView::LinearChartView(bool isDouble)
: _isDouble(isDouble) {
}
LinearChartView::~LinearChartView() = default; LinearChartView::~LinearChartView() = default;

View file

@ -20,7 +20,7 @@ struct Limits;
class LinearChartView final : public AbstractChartView { class LinearChartView final : public AbstractChartView {
public: public:
LinearChartView(); LinearChartView(bool isDouble);
~LinearChartView() override final; ~LinearChartView() override final;
void paint( void paint(
@ -59,6 +59,8 @@ public:
void tick(crl::time now) override; void tick(crl::time now) override;
private: private:
const bool _isDouble;
struct CacheToken final { struct CacheToken final {
explicit CacheToken() = default; explicit CacheToken() = default;
explicit CacheToken( explicit CacheToken(