--- /dev/null
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+#include "bbwtChart.h"
+#include "bbwtPackage.h"
+
+
+#include <Wt/WStandardItemModel>
+#include <Wt/WContainerWidget>
+#include <Wt/WTimer>
+#include <cmath>
+
+
+namespace bbwt
+{
+
+BBTK_ADD_BLACK_BOX_TO_PACKAGE(wt,Chart)
+BBTK_BLACK_BOX_IMPLEMENTATION(Chart,bbtk::WtBlackBox);
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+void Chart::Process()
+{
+
+/*
+ int lstSize = bbGetInputlstX().size();
+ Wt::WStandardItemModel *model = new Wt::WStandardItemModel(lstSize, 2, bbGetOutputWidget() );
+ model->setHeaderData(0, Wt::WString("X"));
+ model->setHeaderData(1, Wt::WString("Y = cos(X)"));
+
+ for (unsigned i = 0; i < lstSize; ++i) {
+// double x = (static_cast<double>(i) - 20) / 4;
+
+ model->setData(i, 0, bbGetInputlstX()[i] );
+ model->setData(i, 1, bbGetInputlstY()[i]);
+ }
+
+ chart->setModel(model);
+ Wt::Chart::WDataSeries s(1, Wt::Chart::CurveSeries);
+ s.setShadow(Wt::WShadow(3, 3, Wt::WColor(0, 0, 0, 127), 3));
+ chart->addSeries(s);
+*/
+
+
+ Wt::WStandardItemModel *model = new Wt::WStandardItemModel(40, 2, bbGetOutputWidget() );
+ model->setHeaderData(0, Wt::WString("X"));
+ model->setHeaderData(1, Wt::WString("Y = cos(X)"));
+
+ for (unsigned i = 0; i < 40; ++i) {
+ double x = (static_cast<double>(i) - 20) / 4;
+
+ model->setData(i, 0, x);
+ model->setData(i, 1, std::cos(x));
+ }
+
+ chart->setModel(model);
+ Wt::Chart::WDataSeries s(2, Wt::Chart::CurveSeries);
+ s.setShadow(Wt::WShadow(3, 3, Wt::WColor(0, 0, 255, 127), 3));
+ chart->addSeries(s);
+
+}
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+void Chart::CreateWidget(Wt::WContainerWidget* parent)
+{
+
+ Wt::WContainerWidget *container = new Wt::WContainerWidget( parent );
+
+
+ Wt::WStandardItemModel *model = new Wt::WStandardItemModel(40, 2, container);
+ model->setHeaderData(0, Wt::WString("X"));
+ model->setHeaderData(1, Wt::WString("Y = sin(X)"));
+
+ for (unsigned i = 0; i < 40; ++i) {
+ double x = (static_cast<double>(i) - 20) / 4;
+
+ model->setData(i, 0, x);
+ model->setData(i, 1, std::sin(x));
+ }
+
+ /*
+ * Create the scatter plot.
+ */
+ chart = new Wt::Chart::WCartesianChart(container);
+ chart->setModel(model); // Set the model.
+ chart->setXSeriesColumn(0); // Set the column that holds the X data.
+ chart->setLegendEnabled(true); // Enable the legend.
+
+ chart->setType(Wt::Chart::ScatterPlot); // Set type to ScatterPlot.
+
+ // Typically, for mathematical functions, you want the axes to cross
+ // at the 0 mark:
+ chart->axis(Wt::Chart::XAxis).setLocation(Wt::Chart::ZeroValue);
+ chart->axis(Wt::Chart::YAxis).setLocation(Wt::Chart::ZeroValue);
+
+ // Provide space for the X and Y axis and title.
+ chart->setPlotAreaPadding(80, Wt::Left);
+ chart->setPlotAreaPadding(40, Wt::Top | Wt::Bottom);
+
+ // Add the curves
+ Wt::Chart::WDataSeries s(1, Wt::Chart::CurveSeries);
+ s.setShadow(Wt::WShadow(3, 3, Wt::WColor(0, 0, 0, 127), 3));
+ chart->addSeries(s);
+
+ chart->resize(800, 300); // WPaintedWidget must be given explicit size.
+
+ chart->setMargin(10, Wt::Top | Wt::Bottom); // Add margin vertically
+ chart->setMargin(Wt::WLength::Auto, Wt::Left | Wt::Right); // Center horizontally
+/*
+
+ Wt::WTimer *t = new Wt::WTimer(chart);
+ t->setInterval(25);
+ t->start();
+
+ double *phi = new double(0);
+ t->timeout().connect(std::bind([=] () {
+ *phi += 0.1;
+
+ for (unsigned i = 0; i < 40; ++i) {
+ double x = (static_cast<double>(i) - 20) / 4;
+
+ model->setData(i, 0, x);
+ model->setData(i, 1, std::sin(x + *phi));
+ }
+ }));
+*/
+
+ bbSetOutputWidget( container );
+ // Process();
+
+
+
+}
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+void Chart::bbUserSetDefaultValues()
+{
+
+}
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+void Chart::bbUserInitializeProcessing()
+{
+
+}
+//=====
+// Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
+//=====
+void Chart::bbUserFinalizeProcessing()
+{
+
+}
+}
+// EO namespace bbwt
+
+