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 |
( |
Wt::WContainerWidget * |
parent | ) |
|
Creates the scatter plot example.
Definition at line 284 of file ChartsExample.C.
285 WContainerWidget(parent)
287 new WText(WString::tr(
"scatter plot 2"),
this);
289 WStandardItemModel *model =
new WStandardItemModel(40, 2,
this);
290 model->setItemPrototype(
new NumericItem());
291 model->setHeaderData(0, WString(
"X"));
292 model->setHeaderData(1, WString(
"Y = sin(X)"));
294 for (
unsigned i = 0; i < 40; ++i) {
295 double x = (
static_cast<double>(i) - 20) / 4;
297 model->setData(i, 0, x);
298 model->setData(i, 1, sin(x));
304 WCartesianChart *chart =
new WCartesianChart(
this);
305 chart->setModel(model);
306 chart->setXSeriesColumn(0);
307 chart->setLegendEnabled(
true);
308 chart->setZoomEnabled(
true);
309 chart->setPanEnabled(
true);
310 chart->setCrosshairEnabled(
true);
312 chart->setBackground(WColor(200,200,200));
314 chart->setType(ScatterPlot);
318 chart->axis(XAxis).setLocation(ZeroValue);
319 chart->axis(YAxis).setLocation(ZeroValue);
322 chart->setAutoLayoutEnabled();
325 WDataSeries *s =
new WDataSeries(1, CurveSeries);
326 s->setShadow(WShadow(3, 3, WColor(0, 0, 0, 127), 3));
329 chart->resize(800, 300);
331 chart->setMargin(10, Top | Bottom);
332 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: