MCPcopy Create free account
hub / github.com/KDE/labplot / plot

Method plot

src/frontend/spreadsheet/PlotDataDialog.cpp:390–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

388}
389
390void PlotDataDialog::plot() {
391 WAIT_CURSOR;
392 m_parentAspect->project()->setSuppressAspectAddedSignal(true);
393 m_lastAddedCurve = nullptr;
394
395 if (ui->rbPlotPlacementExistingPlotArea->isChecked()) {
396 // add curves to an existing plot
397 auto* aspect = static_cast<AbstractAspect*>(cbExistingPlots->currentModelIndex().internalPointer());
398 auto* plot = static_cast<CartesianPlot*>(aspect);
399 plot->beginMacro(i18n("Plot Area - %1", m_parentAspect->name()));
400 addCurvesToPlot(plot);
401 plot->endMacro();
402 } else if (ui->rbPlotPlacementExistingWorksheet->isChecked()) {
403 // add curves to a new plot in an existing worksheet
404 auto* aspect = static_cast<AbstractAspect*>(cbExistingWorksheets->currentModelIndex().internalPointer());
405 auto* worksheet = static_cast<Worksheet*>(aspect);
406 worksheet->beginMacro(i18n("Worksheet - %1", m_parentAspect->name()));
407
408 if (ui->rbCurvePlacementAllInOnePlotArea->isChecked()) {
409 // all curves in one plot
410 auto* plot = new CartesianPlot(i18n("Plot Area - %1", m_parentAspect->name()));
411 plot->setType(CartesianPlot::Type::FourAxes);
412 worksheet->addChild(plot);
413 if (m_columnComboBoxes.count() == 2)
414 setAxesColumnLabels(plot, m_columnComboBoxes.at(1)->currentText());
415
416 addCurvesToPlot(plot);
417 setAxesTitles(plot);
418 } else {
419 // one plot per curve
420 addCurvesToPlots(worksheet);
421 }
422 worksheet->endMacro();
423 } else {
424 // add curves to a new plot(s) in a new worksheet
425 auto* parent = m_parentAspect->parentAspect();
426 if (parent->type() == AspectType::DatapickerCurve)
427 parent = parent->parentAspect()->parentAspect();
428 else if (parent->type() == AspectType::Workbook)
429 parent = parent->parentAspect();
430#ifdef HAVE_MQTT
431 else if (dynamic_cast<MQTTTopic*>(m_parentAspect))
432 parent = m_parentAspect->project();
433#endif
434 parent->beginMacro(i18n("Plot data from %1", m_parentAspect->name()));
435 auto* worksheet = new Worksheet(i18n("Worksheet - %1", m_parentAspect->name()));
436 parent->addChild(worksheet);
437
438 if (ui->rbCurvePlacementAllInOnePlotArea->isChecked()) {
439 // all curves in one plot
440 auto* plot = new CartesianPlot(i18n("Plot Area - %1", m_parentAspect->name()));
441 plot->setType(CartesianPlot::Type::FourAxes);
442 worksheet->addChild(plot);
443 if (m_columnComboBoxes.count() == 2)
444 setAxesColumnLabels(plot, m_columnComboBoxes.at(1)->currentText());
445 addCurvesToPlot(plot);
446 setAxesTitles(plot);
447 } else {

Callers 15

setInfoElementsMethod · 0.45
curveSelectionChangedMethod · 0.45
updatePlotRangeListMethod · 0.45
setTickOffsetDataMethod · 0.45
plotRangeChangedMethod · 0.45
initGeneralTabMethod · 0.45
setCurvesMethod · 0.45
addVariableMethod · 0.45
loadMethod · 0.45
loadMethod · 0.45
loadMethod · 0.45

Calls 13

currentModelIndexMethod · 0.80
beginMacroMethod · 0.80
endMacroMethod · 0.80
currentTextMethod · 0.80
parentAspectMethod · 0.80
projectMethod · 0.45
nameMethod · 0.45
setTypeMethod · 0.45
addChildMethod · 0.45
countMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected