A Widget that demonstrates a scatter plot.
More...
#include <ChartsExample.h>
A Widget that demonstrates a scatter plot.
Definition at line 49 of file ChartsExample.h.
◆ ScatterPlotExample()
ScatterPlotExample::ScatterPlotExample |
( |
| ) |
|
Creates the scatter plot example.
Definition at line 294 of file ChartsExample.C.
294 :
295 WContainerWidget()
296{
297 this->addWidget(std::make_unique<WText>(WString::tr("scatter plot 2")));
298
299 std::shared_ptr<WStandardItemModel>
model
300 = std::make_shared<WStandardItemModel>(40, 2);
302 = std::make_unique<NumericItem>();
306
307 for (
unsigned i = 0;
i < 40; ++
i) {
308 double x = (
static_cast<double>(
i) - 20) / 4;
309
312 }
313
314
315
316
319 chart->setXSeriesColumn(0);
320 chart->setLegendEnabled(
true);
321 chart->setZoomEnabled(
true);
322 chart->setPanEnabled(
true);
323 chart->setCrosshairEnabled(
true);
324
326
327 chart->setType(ChartType::Scatter);
328
329
330
331 chart->axis(Axis::X).setLocation(AxisValue::Zero);
332 chart->axis(Axis::Y).setLocation(AxisValue::Zero);
333
334
335 chart->setAutoLayoutEnabled();
336
337
338 std::unique_ptr<WDataSeries>
s
339 = std::make_unique<WDataSeries>(1, SeriesType::Curve);
341 chart->addSeries(std::move(
s));
342
343 chart->resize(800, 300);
344
345 chart->setMargin(10, Side::Top | Side::Bottom);
346 chart->setMargin(WLength::Auto, Side::Left | Side::Right);
347
349 config->setValueFill(FillRangeType::ZeroValue);
350}
Wt::Auth::Dbo::UserDatabase< AuthInfo > UserDatabase
A class that allows configuration of a cartesian chart.
The documentation for this class was generated from the following files: