ChartConfig.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // This may look like C code, but it's really -*- C++ -*-
  2. /*
  3. * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
  4. *
  5. * See the LICENSE file for terms of use.
  6. */
  7. #ifndef CHART_CONFIG_H_
  8. #define CHART_CONFIG_H_
  9. #include <Wt/WContainerWidget>
  10. #include <Wt/Chart/WDataSeries>
  11. namespace Wt {
  12. class WCheckBox;
  13. class WComboBox;
  14. class WFormWidget;
  15. class WLineEdit;
  16. class WTable;
  17. namespace Chart {
  18. class WCartesianChart;
  19. }
  20. }
  21. /**
  22. * @addtogroup chartsexample
  23. */
  24. /*@{*/
  25. /*! \brief A class that allows configuration of a cartesian chart.
  26. *
  27. * This widget provides forms for configuring chart, series, and axis properties
  28. * and manipulates the chart according to user settings.
  29. *
  30. * This widget is part of the %Wt charts example.
  31. */
  32. class ChartConfig : public Wt::WContainerWidget
  33. {
  34. public:
  35. /*! \brief Constructor.
  36. */
  37. ChartConfig(Wt::Chart::WCartesianChart *chart, Wt::WContainerWidget *parent);
  38. void setValueFill(Wt::Chart::FillRangeType fill);
  39. private:
  40. Wt::Chart::WCartesianChart *chart_;
  41. Wt::Chart::FillRangeType fill_;
  42. //! Struct that holds the controls for one series
  43. struct SeriesControl {
  44. Wt::WCheckBox *enabledEdit;
  45. Wt::WComboBox *typeEdit;
  46. Wt::WComboBox *markerEdit;
  47. Wt::WComboBox *axisEdit;
  48. Wt::WCheckBox *legendEdit;
  49. Wt::WCheckBox *shadowEdit;
  50. Wt::WComboBox *labelsEdit;
  51. };
  52. //! Controls for series
  53. std::vector<SeriesControl> seriesControls_;
  54. //! Struct that holds the controls for one axis
  55. struct AxisControl {
  56. Wt::WCheckBox *visibleEdit;
  57. Wt::WComboBox *scaleEdit;
  58. Wt::WCheckBox *autoEdit;
  59. Wt::WLineEdit *minimumEdit;
  60. Wt::WLineEdit *maximumEdit;
  61. Wt::WCheckBox *gridLinesEdit;
  62. Wt::WLineEdit *labelAngleEdit;
  63. Wt::WLineEdit *titleEdit;
  64. Wt::WComboBox *titleOrientationEdit;
  65. Wt::WComboBox *tickDirectionEdit;
  66. Wt::WComboBox *locationEdit;
  67. };
  68. //! Controls for axes
  69. std::vector<AxisControl> axisControls_;
  70. Wt::WLineEdit *titleEdit_;
  71. Wt::WLineEdit *chartWidthEdit_;
  72. Wt::WLineEdit *chartHeightEdit_;
  73. Wt::WComboBox *chartOrientationEdit_;
  74. Wt::WComboBox *legendLocationEdit_;
  75. Wt::WComboBox *legendSideEdit_;
  76. Wt::WComboBox *legendAlignmentEdit_;
  77. Wt::WCheckBox *borderEdit_;
  78. void connectSignals(Wt::WFormWidget *w);
  79. void update();
  80. static bool validate(Wt::WFormWidget *w);
  81. };
  82. /*@}*/
  83. #endif // CHARTS_EXAMPLE_H_