Skip to content

Commit aefeffa

Browse files
author
Koen Deforche
committed
Several changes:
- WCartesianChart: setAxisPadding should also set padding of Y2Axis - WidgetSet: preserve Wt parameters from initial request for widgetset reconnect, prevent accumulation
1 parent a3204fc commit aefeffa

19 files changed

+91
-51
lines changed

src/Wt/Chart/WAxisSliderWidget

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ public:
136136
*/
137137
bool isLabelsEnabled() const { return labelsEnabled_; }
138138

139+
/*! \brief Set whether the Y axis of the associated chart should be updated to fit the series.
140+
*
141+
* Y axis zoom is enabled by default.
142+
*/
143+
void setYAxisZoomEnabled(bool enabled = true);
144+
145+
/*! \brief Returns whether the Y axis of the associated chart should be updated to fit the series.
146+
*
147+
* \sa setYAxisZoomEnabled()
148+
*/
149+
bool isYAxisZoomEnabled() const { return yAxisZoomEnabled_; }
150+
139151
WDataSeries *series() { return series_; }
140152
const WDataSeries *series() const { return series_; }
141153

@@ -160,6 +172,7 @@ private:
160172
WBrush selectedAreaBrush_;
161173
bool autoPadding_;
162174
bool labelsEnabled_;
175+
bool yAxisZoomEnabled_;
163176
int padding_[4];
164177

165178
WJavaScriptHandle<WTransform> transform_;

src/Wt/Chart/WAxisSliderWidget.C

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "Wt/Chart/WAxisSliderWidget"
88

99
#include "Wt/WApplication"
10+
#include "Wt/WBoostAny"
1011
#include "Wt/WBrush"
1112
#include "Wt/WColor"
1213
#include "Wt/WJavaScript"
@@ -34,7 +35,8 @@ WAxisSliderWidget::WAxisSliderWidget(WContainerWidget *parent)
3435
background_(WColor(230, 230, 230)),
3536
selectedAreaBrush_(WColor(255, 255, 255)),
3637
autoPadding_(false),
37-
labelsEnabled_(true)
38+
labelsEnabled_(true),
39+
yAxisZoomEnabled_(true)
3840
{
3941
init();
4042
}
@@ -47,7 +49,8 @@ WAxisSliderWidget::WAxisSliderWidget(WDataSeries *series, WContainerWidget *pare
4749
background_(WColor(230, 230, 230)),
4850
selectedAreaBrush_(WColor(255, 255, 255)),
4951
autoPadding_(false),
50-
labelsEnabled_(true)
52+
labelsEnabled_(true),
53+
yAxisZoomEnabled_(true)
5154
{
5255
init();
5356
}
@@ -187,6 +190,14 @@ void WAxisSliderWidget::setLabelsEnabled(bool enabled)
187190
}
188191
}
189192

193+
void WAxisSliderWidget::setYAxisZoomEnabled(bool enabled)
194+
{
195+
if (enabled != yAxisZoomEnabled_) {
196+
yAxisZoomEnabled_ = enabled;
197+
update();
198+
}
199+
}
200+
190201
WRectF WAxisSliderWidget::hv(const WRectF& rect) const
191202
{
192203
bool horizontal = chart()->orientation() == Vertical; // yes, vertical chart means horizontal X axis slider
@@ -469,7 +480,8 @@ void WAxisSliderWidget::paintEvent(WPaintDevice *paintDevice)
469480
"transform:" << transform_.jsRef() << ","
470481
"rect:function(){return " << rect.jsRef() << "},"
471482
"drawArea:" << drawArea.jsRef() << ","
472-
"series:" << chart()->seriesIndexOf(*series_) <<
483+
"series:" << chart()->seriesIndexOf(*series_) << ","
484+
"updateYAxis:" << asString(yAxisZoomEnabled_).toUTF8() <<
473485
"});";
474486
doJavaScript(ss.str());
475487
}

src/Wt/Chart/WCartesianChart.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1751,7 +1751,7 @@ void WCartesianChart::IconWidget::paintEvent(Wt::WPaintDevice *paintDevice)
17511751
void WCartesianChart::setAxisPadding(int padding)
17521752
{
17531753
axisPadding_ = padding;
1754-
for (int i = 0; i < 2; ++i) {
1754+
for (int i = 0; i < 3; ++i) {
17551755
axes_[i]->setPadding(padding);
17561756
}
17571757
}

src/Wt/Dbo/DbAction_impl.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void InitSchema::actId(ptr<C>& value, const std::string& name, int size,
6969
"Wt::Dbo::dbo_traits<C>::surrogateIdField() != 0");
7070

7171
idField_ = true;
72-
actPtr(PtrRef<C>(value, name, size, fkConstraints));
72+
actPtr(PtrRef<C>(value, name, fkConstraints));
7373
idField_ = false;
7474
}
7575

@@ -326,7 +326,7 @@ template<class D>
326326
void LoadDbAction<C>::actId(ptr<D>& value, const std::string& name, int size,
327327
int fkConstraints)
328328
{
329-
actPtr(PtrRef<D>(value, name, size, fkConstraints));
329+
actPtr(PtrRef<D>(value, name, fkConstraints));
330330

331331
dbo_.setId(value);
332332
}
@@ -552,7 +552,7 @@ template<class D>
552552
void SaveDbAction<C>::actId(ptr<D>& value, const std::string& name, int size,
553553
int fkConstraints)
554554
{
555-
actPtr(PtrRef<D>(value, name, size, fkConstraints));
555+
actPtr(PtrRef<D>(value, name, fkConstraints));
556556

557557
/* Later, we may also want to support id changes ? */
558558
if (pass_ == Self && isInsert_)
@@ -580,7 +580,7 @@ template<class C>
580580
void TransactionDoneAction::actId(ptr<C>& value, const std::string& name,
581581
int size, int fkConstraints)
582582
{
583-
actPtr(PtrRef<C>(value, name, size, fkConstraints));
583+
actPtr(PtrRef<C>(value, name, fkConstraints));
584584
}
585585

586586
template<typename V>
@@ -641,7 +641,7 @@ template<class C>
641641
void SessionAddAction::actId(ptr<C>& value, const std::string& name,
642642
int size, int fkConstraints)
643643
{
644-
actPtr(PtrRef<C>(value, name, size, fkConstraints));
644+
actPtr(PtrRef<C>(value, name, fkConstraints));
645645
}
646646

647647
template<typename V>
@@ -686,7 +686,7 @@ template<class C>
686686
void SetReciproceAction::actId(ptr<C>& value, const std::string& name,
687687
int size, int fkConstraints)
688688
{
689-
actPtr(PtrRef<C>(value, name, size, fkConstraints));
689+
actPtr(PtrRef<C>(value, name, fkConstraints));
690690
}
691691

692692
template<typename V>
@@ -767,7 +767,7 @@ template<class C>
767767
void ToAnysAction::actId(ptr<C>& value, const std::string& name,
768768
int size, int fkConstraints)
769769
{
770-
actPtr(PtrRef<C>(value, name, size, fkConstraints));
770+
actPtr(PtrRef<C>(value, name, fkConstraints));
771771
}
772772

773773
template<typename V>
@@ -849,7 +849,7 @@ template<class C>
849849
void FromAnyAction::actId(ptr<C>& value, const std::string& name, int size,
850850
int fkConstraints)
851851
{
852-
actPtr(PtrRef<C>(value, name, size, fkConstraints));
852+
actPtr(PtrRef<C>(value, name, fkConstraints));
853853
}
854854

855855
template<typename V>

src/Wt/Dbo/Field

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ void field(Action& action, V& value, const std::string& name, int size = -1);
316316
* this method also to allow foreign key constraints.
317317
*/
318318
template <class Action, class C>
319-
void field(Action& action, ptr<C>& value, const std::string& name);
319+
void field(Action& action, ptr<C>& value, const std::string& name, int size = -1);
320320

321321
/*! \brief Maps the "One"-side (foreign key) of a ManyToOne or OneToOne relation.
322322
*

src/Wt/Dbo/Field_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void field(A& action, V& value, const std::string& name, int size)
183183
}
184184

185185
template <class A, class C>
186-
void field(A& action, ptr<C>& value, const std::string& name)
186+
void field(A& action, ptr<C>& value, const std::string& name, int)
187187
{
188188
action.actPtr(PtrRef<C>(value, name, 0));
189189
}

src/Wt/WStringUtil.C

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ std::string fromUTF8(const std::string& s, CharEncoding encoding)
291291
#ifndef WT_NO_STD_WSTRING
292292
case LocalEncoding: return narrow(fromUTF8(s));
293293
#else
294+
case DefaultEncoding:
294295
case LocalEncoding:
295296
{
296297
// You may want to rewrite this for your system

src/http/Configuration.C

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ void Configuration::createOptions(po::options_description& options,
111111

112112
("accesslog",
113113
po::value<std::string>(&accessLog_),
114-
"access log file (defaults to stdout)")
114+
"access log file (defaults to stdout), "
115+
"to disable access logging completely, use --accesslog=-")
115116

116117
("no-compression",
117118
"do not use compression")

src/js/WAxisSliderWidget.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ WT_DECLARE_WT_MEMBER
1010
(1, JavaScriptConstructor, "WAxisSliderWidget",
1111
function(APP, widget, target, config) {
1212
// draw area: inside of the margins of the widget
13-
// config: { chart:, rect:(function), transform:, drawArea:, series: }
13+
// config: { chart:, rect:(function), transform:, drawArea:, series:, updateYAxis: }
1414
var rqAnimFrame = (function(){
1515
return window.requestAnimationFrame ||
1616
window.webkitRequestAnimationFrame ||
@@ -177,7 +177,7 @@ WT_DECLARE_WT_MEMBER
177177
var drawArea = config.drawArea;
178178
var u = transform[4] / drawArea[2];
179179
var v = transform[0] + u;
180-
config.chart.setXRange(config.series, u, v);
180+
config.chart.setXRange(config.series, u, v, config.updateYAxis);
181181
}
182182
}
183183

src/js/WAxisSliderWidget.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)