コード例 #1
0
ファイル: ScatterPlotData.cpp プロジェクト: DTidd/wt
#include <Wt/WContainerWidget>
#include <Wt/WDate>
#include <Wt/WEnvironment>
#include <Wt/WPaintedWidget>
#include <Wt/WItemDelegate>
#include <Wt/WShadow>
#include <Wt/WStandardItemModel>
#include <Wt/WTableView>

#include "../treeview-dragdrop/CsvUtil.h"

SAMPLE_BEGIN(ScatterPlotData)
Wt::WContainerWidget *container = new Wt::WContainerWidget();

Wt::WStandardItemModel *model
    = csvToModel(Wt::WApplication::appRoot() + "timeseries.csv", container);

if (!model)
    return container;

/*
 * Parses the first column as dates, to be able to use a date scale
 */
for (int row = 0; row < model->rowCount(); ++row) {
    Wt::WString s = Wt::asString(model->data(row, 0));
    Wt::WDate date = Wt::WDate::fromString(s, "dd/MM/yy");
    model->setData(row, 0, date);
  }

// Renders the data in a table.
Wt::WTableView *table = new Wt::WTableView(container);
コード例 #2
0
#include <Wt/WDate>
#include <Wt/WEnvironment>
#include <Wt/WPaintedWidget>
#include <Wt/WItemDelegate>
#include <Wt/WShadow>
#include <Wt/WStandardItemModel>
#include <Wt/WTableView>

#include "../treeview-dragdrop/CsvUtil.h"

SAMPLE_BEGIN(ScatterPlotData)

Wt::WContainerWidget *container = new Wt::WContainerWidget();

Wt::WStandardItemModel *model
    = csvToModel(Wt::WApplication::appRoot() + "timeseries.csv");

if (!model)
    return container;

/*
 * Parses the first column as dates, to be able to use a date scale
 */
for (int row = 0; row < model->rowCount(); ++row) {
    Wt::WString s = Wt::asString(model->data(row, 0));
    Wt::WDate date = Wt::WDate::fromString(s, "dd/MM/yy");
    model->setData(row, 0, date);
  }

// Renders the data in a table.
Wt::WTableView *table = new Wt::WTableView(container);
コード例 #3
0
ファイル: CategoryCharts3D.cpp プロジェクト: Unss/wt
SAMPLE_BEGIN(CatChart3d)

Wt::WContainerWidget *container = new Wt::WContainerWidget();

// create the chart and add a border to the widget
Wt::Chart::WCartesian3DChart *chart = new Wt::Chart::WCartesian3DChart(container);
chart->setType(Wt::Chart::CategoryChart);
Wt::WCssDecorationStyle style;
style.setBorder(Wt::WBorder(Wt::WBorder::Solid, Wt::WBorder::Medium, Wt::black));
chart->setDecorationStyle(style);
chart->resize(600, 600);

// load first set of data (horizontal plane)
Wt::WStandardItemModel *model1 = 
  csvToModel(Wt::WApplication::appRoot() + "hor_plane.csv", container, false);
Wt::Chart::WGridData *horPlane = new Wt::Chart::WGridData(model1);
horPlane->setType(Wt::Chart::BarSeries3D);

// load second set of data (stability of isotopes)
Wt::WStandardItemModel *model2 = 
  csvToModel(Wt::WApplication::appRoot() + "isotope_decay.csv", container, false);
Wt::Chart::WGridData *isotopes = new Wt::Chart::WGridData(model2);
isotopes->setType(Wt::Chart::BarSeries3D);

// add the dataseries to the chart

chart->addDataSeries(isotopes);
chart->addDataSeries(horPlane);
// Set up the WTabWidget for configuring the charts
CategoryDataSettings *settings1 = new CategoryDataSettings(horPlane, container);
コード例 #4
0
ファイル: CategoryCharts3D.cpp プロジェクト: devbazy/wt
chart->setType(Wt::Chart::CategoryChart);
Wt::WCssDecorationStyle style;
style.setBorder(Wt::WBorder(Wt::WBorder::Solid, Wt::WBorder::Medium, Wt::black));
chart->setDecorationStyle(style);
chart->resize(800, 600);
chart->setTitle("Fish consumption in western Europe");
chart->axis(Wt::Chart::ZAxis_3D).setTitle("Consumption (pcs/year)");
chart->setLegendStyle(Wt::WFont(), Wt::WPen(),
		      Wt::WBrush(Wt::WColor(Wt::lightGray)));
chart->setLegendEnabled(true);
chart->setGridEnabled(Wt::Chart::XZ_Plane, Wt::Chart::ZAxis_3D, true);
chart->setGridEnabled(Wt::Chart::YZ_Plane, Wt::Chart::ZAxis_3D, true);

// load data
Wt::WStandardItemModel *model = 
  csvToModel(Wt::WApplication::appRoot() + "fish_consumption.csv", container, false);
// highlight Belgian codfish consumption
for (unsigned i=0; i < model->rowCount(); i++) {
  for (unsigned j=0; j < model->columnCount(); j++) {
    if (Wt::asString(model->data(0, j)) == Wt::WString("codfish") &&
	Wt::asString(model->data(i, 0)) == Wt::WString("Belgium"))
      model->setData(i, j, Wt::WColor(Wt::cyan), Wt::MarkerBrushColorRole);
  }
 }
Wt::Chart::WGridData *isotopes = new Wt::Chart::WGridData(model);
isotopes->setTitle("made-up data");
isotopes->setType(Wt::Chart::BarSeries3D);

// add the dataseries to the chart
chart->addDataSeries(isotopes);
コード例 #5
0
ファイル: CategoryChart.cpp プロジェクト: Unss/wt
#include <Wt/WAbstractItemView>
#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WEnvironment>
#include <Wt/WItemDelegate>
#include <Wt/WStandardItemModel>
#include <Wt/WStandardItem>
#include <Wt/WTableView>

#include "../treeview-dragdrop/CsvUtil.h"

SAMPLE_BEGIN(CategoryChart)
Wt::WContainerWidget *container = new Wt::WContainerWidget();

Wt::WStandardItemModel *model
    = csvToModel(Wt::WApplication::appRoot() + "category.csv", container);

if (!model)
    return container;

/*
 * Configure all model items as selectable and editable.
 */
for (int row = 0; row < model->rowCount(); ++row)
    for (int col = 0; col < model->columnCount(); ++col)
        model->item(row, col)->setFlags(Wt::ItemIsEditable);

/*
 * Shows a table, allowing editing of the model
 */
Wt::WTableView *table = new Wt::WTableView(container);