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 |
( |
Wt::WContainerWidget * |
parent | ) |
|
Creates the scatter plot example.
Definition at line 280 of file ChartsExample.C.
281 WContainerWidget(parent)
283 new WText(WString::tr(
"scatter plot 2"),
this);
285 WStandardItemModel *model =
new WStandardItemModel(40, 2,
this);
286 model->setItemPrototype(
new NumericItem());
287 model->setHeaderData(0, WString(
"X"));
288 model->setHeaderData(1, WString(
"Y = sin(X)"));
290 for (
unsigned i = 0; i < 40; ++i) {
291 double x = (
static_cast<double>(i) - 20) / 4;
293 model->setData(i, 0, x);
294 model->setData(i, 1, sin(x));
300 WCartesianChart *chart =
new WCartesianChart(
this);
301 chart->setModel(model);
302 chart->setXSeriesColumn(0);
303 chart->setLegendEnabled(
true);
305 chart->setType(ScatterPlot);
309 chart->axis(XAxis).setLocation(ZeroValue);
310 chart->axis(YAxis).setLocation(ZeroValue);
313 chart->setPlotAreaPadding(80, Left);
314 chart->setPlotAreaPadding(40, Top | Bottom);
317 WDataSeries s(1, CurveSeries);
318 s.setShadow(WShadow(3, 3, WColor(0, 0, 0, 127), 3));
321 chart->resize(800, 300);
323 chart->setMargin(10, Top | Bottom);
324 chart->setMargin(WLength::Auto, Left | Right);
void setValueFill(Wt::Chart::FillRangeType fill)
A class that allows configuration of a cartesian chart.
The documentation for this class was generated from the following files: