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 278 of file ChartsExample.C.
279 WContainerWidget(parent)
281 new WText(WString::tr(
"scatter plot 2"),
this);
283 WStandardItemModel *model =
new WStandardItemModel(40, 2,
this);
284 model->setItemPrototype(
new NumericItem());
285 model->setHeaderData(0, WString(
"X"));
286 model->setHeaderData(1, WString(
"Y = sin(X)"));
288 for (
unsigned i = 0; i < 40; ++i) {
289 double x = (
static_cast<double>(i) - 20) / 4;
291 model->setData(i, 0, x);
292 model->setData(i, 1, sin(x));
298 WCartesianChart *chart =
new WCartesianChart(
this);
299 chart->setModel(model);
300 chart->setXSeriesColumn(0);
301 chart->setLegendEnabled(
true);
303 chart->setType(ScatterPlot);
307 chart->axis(XAxis).setLocation(ZeroValue);
308 chart->axis(YAxis).setLocation(ZeroValue);
311 chart->setAutoLayoutEnabled();
314 WDataSeries s(1, CurveSeries);
315 s.setShadow(WShadow(3, 3, WColor(0, 0, 0, 127), 3));
318 chart->resize(800, 300);
320 chart->setMargin(10, Top | Bottom);
321 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: