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 {
Linear,
Stack,
DoubleLinear,
};
} // namespace Statistic

View File

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

View File

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

View File

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