diff --git a/src/Chart.cpp b/src/Chart.cpp index 878b1d32..bb8fe619 100644 --- a/src/Chart.cpp +++ b/src/Chart.cpp @@ -36,6 +36,18 @@ #include #include +//////////////////////////////////////////////////////////////////////////////// +Chart::Chart ( + const bool with_label_month, + const bool with_label_week, + const bool with_label_weekday, + const bool with_label_day) : + with_label_month(with_label_month), + with_label_week(with_label_week), + with_label_weekday(with_label_weekday), + with_label_day(with_label_day) +{ } + std::string Chart::render ( const Interval &filter, const std::vector &tracked, @@ -52,10 +64,6 @@ std::string Chart::render ( const bool with_summary, const bool with_holidays, const bool with_totals, - const bool with_month, - const bool with_week, - const bool with_day, - const bool with_weekday, const bool with_internal_axis, const int minutes_per_char, const int spacing, @@ -74,7 +82,7 @@ std::string Chart::render ( const auto chars_per_hour = 60 / minutes_per_char; const auto cell_size = chars_per_hour + spacing; - const auto indent_size = getIndentSize (with_month, with_week, with_day, with_weekday); + const auto indent_size = getIndentSize (with_label_month, with_label_week, with_label_day, with_label_weekday); const auto indent = std::string (indent_size, ' '); const auto padding_size = indent_size + ((last_hour - first_hour + 1) * (cell_size)) + 1; @@ -132,10 +140,10 @@ std::string Chart::render ( auto now = Datetime (); auto color_day = getDayColor (day, now, holidays, color_today, color_holiday); - auto labelMonth = with_month ? renderMonth (previous, day) : ""; - auto labelWeek = with_week ? renderWeek (previous, day) : ""; - auto labelWeekday = with_weekday ? renderWeekday (day, color_day) : ""; - auto labelDay = with_day ? renderDay (day, color_day) : ""; + auto labelMonth = with_label_month ? renderMonth (previous, day) : ""; + auto labelWeek = with_label_week ? renderWeek (previous, day) : ""; + auto labelWeekday = with_label_weekday ? renderWeekday (day, color_day) : ""; + auto labelDay = with_label_day ? renderDay (day, color_day) : ""; out << labelMonth << labelWeek diff --git a/src/Chart.h b/src/Chart.h index 3e5d0cac..ffeee124 100644 --- a/src/Chart.h +++ b/src/Chart.h @@ -34,9 +34,9 @@ class Chart { public: - Chart() = default; + Chart(bool, bool, bool, bool); - std::string render (const Interval&, const std::vector &, const std::vector &, const std::map &, const std::map &, const Color&, const Color&, const Color&, const Color&, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, int, int, int); + std::string render (const Interval&, const std::vector &, const std::vector &, const std::map &, const std::map &, const Color&, const Color&, const Color&, const Color&, bool, bool, bool, bool, bool, bool, bool, int, int, int); private: unsigned long getIndentSize (bool, bool, bool, bool); @@ -66,6 +66,11 @@ private: std::string renderHolidays (const std::map &); std::string renderSummary (const std::string&, const Interval&, const std::vector &, const std::vector &, bool); + + const bool with_label_month; + const bool with_label_week; + const bool with_label_weekday; + const bool with_label_day; }; #endif diff --git a/src/commands/CmdChart.cpp b/src/commands/CmdChart.cpp index c34c2190..7e10556b 100644 --- a/src/commands/CmdChart.cpp +++ b/src/commands/CmdChart.cpp @@ -145,9 +145,9 @@ int renderChart ( auto axis_type = rules.get ("reports." + type + ".axis"); const auto with_internal_axis = axis_type == "internal"; - Chart chart; + Chart chart(with_month, with_week, with_weekday, with_day); - std::cout << chart.render (filter, tracked, exclusions, holidays, tag_colors, color_today, color_holiday, color_label, color_exclusion, show_intervals, determine_hour_range, with_ids, with_summary, with_holidays, with_totals, with_month, with_week, with_day, with_weekday, with_internal_axis, minutes_per_char, spacing, num_lines); + std::cout << chart.render (filter, tracked, exclusions, holidays, tag_colors, color_today, color_holiday, color_label, color_exclusion, show_intervals, determine_hour_range, with_ids, with_summary, with_holidays, with_totals, with_internal_axis, minutes_per_char, spacing, num_lines); return 0; }