A Widget that demonstrates a Pie chart.
More...
#include <ChartsExample.h>
A Widget that demonstrates a Pie chart.
Definition at line 59 of file ChartsExample.h.
◆ PieExample()
PieExample::PieExample |
( |
| ) |
|
Creates the pie chart example.
Definition at line 352 of file ChartsExample.C.
352 :
353 WContainerWidget()
354{
355 this->addWidget(std::make_unique<WText>(WString::tr("pie chart")));
356
357 std::shared_ptr<WStandardItemModel>
model
358 = std::make_shared<WStandardItemModel>();
360 = std::make_unique<NumericItem>();
362
363
364 model->insertColumns(
model->columnCount(), 2);
367
368
373
390
391
394 model->item(
row,
col)->setFlags(ItemFlag::Selectable | ItemFlag::Editable);
395
396 WContainerWidget *
w = this->addWidget(std::make_unique<WContainerWidget>());
398
399 table->setMargin(10, Side::Top | Side::Bottom);
400 table->setMargin(WLength::Auto, Side::Left | Side::Right);
401 table->setSortingEnabled(
true);
403 table->setColumnWidth(1, 100);
404 table->setRowHeight(22);
405
407 table->resize(150 + 100 + 14, 20 + 6 * 22);
408 table->setEditTriggers(EditTrigger::SingleClicked);
409 } else {
410 table->resize(150 + 100 + 14, WLength::Auto);
411 table->setEditTriggers(EditTrigger::None);
412 }
413
414
415
416
417 WPieChart *
chart = this->addWidget(std::make_unique<WPieChart>());
419 chart->setLabelsColumn(0);
420 chart->setDataColumn(1);
421
422
423 chart->setDisplayLabels(LabelOption::Outside | LabelOption::TextLabel | LabelOption::TextPercentage);
424
425
426 chart->setPerspectiveEnabled(
true, 0.2);
427 chart->setShadowEnabled(
true);
428
429
430 chart->setExplode(0, 0.3);
431
432 chart->resize(800, 300);
433
434 chart->setMargin(10, Side::Top | Side::Bottom);
435 chart->setMargin(WLength::Auto, Side::Left | Side::Right);
436}
Wt::Auth::Dbo::UserDatabase< AuthInfo > UserDatabase
The documentation for this class was generated from the following files: