BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
The Plot1D class presents data of several 1D DataItems contained in a Data1DViewItem. Provides minimal functionality for data plotting and axes interaction. Should be a component for more complicated plotting widgets.
Public Types | |
enum class | PLOT_TYPE { Plot1D , Plot2D } |
Signals | |
void | statusString (const QString &text) |
Public Member Functions | |
Plot1D (QWidget *parent=nullptr) | |
virtual QList< QAction * > | actionList () |
bool | axesRangeContains (double xpos, double ypos) const |
Returns true if axes rectangle contains given in axes coordinates. More... | |
SessionItem * | currentItem () |
const SessionItem * | currentItem () const |
const QCustomPlot * | customPlot () const override |
QCustomPlot * | customPlot () override |
PlotEventInfo | eventInfo (double xpos, double ypos) const override |
Returns PlotEventInfo corresponding to given axes coordinates. More... | |
QSize | minimumSizeHint () const override |
double | pixelToXaxisCoord (double pixel) const |
transform widget coordinates to axes coordinates More... | |
double | pixelToYaxisCoord (double pixel) const |
ScientificPlotEvent * | plotEvent () |
PLOT_TYPE | plotType () const |
Returns the type of current plot. More... | |
void | resetView () |
reset all axes min,max to initial value More... | |
virtual void | setItem (SessionItem *item) |
void | setLog (bool log) |
sets logarithmic scale More... | |
void | setMouseTrackingEnabled (bool enable) |
Tracks move events (used when showing profile histograms and printing status string) More... | |
QSize | sizeHint () const override |
double | xAxisCoordToPixel (double axis_coordinate) const |
transform axes coordinates to CustomPlot widget coordinates More... | |
double | yAxisCoordToPixel (double axis_coordinate) const |
Protected Member Functions | |
void | hideEvent (QHideEvent *) override |
void | showEvent (QShowEvent *) override |
void | subscribeToItem () override |
void | unsubscribeFromItem () override |
Private Slots | |
void | onPropertyChanged (const QString &property_name) |
updates plot depending on IntensityDataItem properties More... | |
void | onTimeToReplot () |
Replots SpecularPlot. More... | |
void | onXaxisRangeChanged (QCPRange newRange) |
Propagate xmin, xmax back to IntensityDataItem. More... | |
void | onYaxisRangeChanged (QCPRange newRange) |
Propagate ymin, ymax back to IntensityDataItem. More... | |
Private Member Functions | |
void | initPlots () |
creates and initializes the color map More... | |
void | modifyAxesProperties (const QString &axisName, const QString &propertyName) |
void | refreshPlotData () |
Refresh axes' labels, range and graph data. More... | |
void | replot () |
Schedule replot for later execution by onTimeReplot() slot. More... | |
void | setAxesLabelsFromItem (Data1DViewItem *item) |
Sets X,Y axes labels from item. More... | |
void | setAxesRangeConnected (bool isConnected) |
Connects/disconnects signals related to SpecularPlot's X,Y axes rectangle change. More... | |
void | setAxesRangeFromItem (Data1DViewItem *item) |
Sets (xmin,xmax) and (ymin,ymax) of SpecularPlot from specular item. Also sets logarithmic scale on y-axis if necessary. More... | |
void | setConnected (bool isConnected) |
void | setLabel (const BasicAxisItem *item, QCPAxis *axis, QString label) |
Sets label to axis. More... | |
void | setUpdateTimerConnected (bool isConnected) |
void | updateAllGraphs () |
Sets data to graphs. More... | |
void | updateGraph (Data1DProperties *item) |
Sets data to the graph corresponding to the passed Data1DProperties. More... | |
Data1DViewItem * | viewItem () |
const Data1DViewItem * | viewItem () const |
Private Attributes | |
bool | m_block_update |
QCustomPlot * | m_custom_plot |
ScientificPlotEvent * | m_event |
std::map< Data1DProperties *, QCPGraph * > | m_graph_map |
SessionItemController * | m_itemController |
PLOT_TYPE | m_plot_type |
UpdateTimer * | m_update_timer |
|
stronginherited |
Enumerator | |
---|---|
Plot1D | |
Plot2D |
Definition at line 31 of file ScientificPlot.h.
|
explicit |
Definition at line 34 of file Plot1D.cpp.
References m_custom_plot, GUI::Constants::plot_tick_label_size(), and ScientificPlot::setMouseTrackingEnabled().
|
virtualinherited |
Reimplemented in IntensityDataProjectionsWidget, SpecularDataWidget, SpecularDataCanvas, FitComparisonWidget1D, FitComparisonWidget, IntensityDataWidget, IntensityDataCanvas, SpecularDataImportWidget, RealDataPresenter, and RealDataMaskWidget.
Definition at line 36 of file SessionItemWidget.cpp.
Referenced by ItemComboWidget::setPresentation().
|
inherited |
Returns true if axes rectangle contains given in axes coordinates.
Definition at line 52 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by eventInfo(), SpecularPlot::eventInfo(), and ColorMap::eventInfo().
|
inherited |
Definition at line 41 of file SessionItemWidget.cpp.
Referenced by FitFlowWidget::fitSuiteItem(), RealDataMaskWidget::intensityDataItem(), IntensityDataCanvas::intensityDataItem(), IntensityDataWidget::intensityDataItem(), IntensityDataProjectionsWidget::intensityDataItem(), ProjectionsPlot::intensityItem(), ColorMap::intensityItem(), JobResultsPresenter::itemPresentation(), FitParameterWidget::jobItem(), ParameterTuningWidget::jobItem(), RunFitControlWidget::jobItem(), FitComparisonWidget::jobItem(), FitComparisonWidget1D::jobItem(), IntensityDataPropertyWidget::jobItem(), SpecularDataPropertyWidget::jobItem(), SpecularDataImportWidget::realDataItem(), ItemComboWidget::setPresentation(), JobResultsPresenter::setPresentation(), SpecularDataImportWidget::specularDataItem(), SpecularDataCanvas::specularDataItem(), SpecularDataWidget::specularDataItem(), SpecularPlot::specularItem(), ItemComboWidget::subscribeToItem(), ProjectionsPlot::unsubscribeFromChildren(), and viewItem().
|
inherited |
Definition at line 46 of file SessionItemWidget.cpp.
References SessionItemController::currentItem(), and SessionItemWidget::m_itemController.
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Implements ScientificPlot.
Definition at line 44 of file Plot1D.h.
References m_custom_plot.
Referenced by Plot1DCanvas::customPlot().
|
overridevirtual |
Returns PlotEventInfo corresponding to given axes coordinates.
Implements ScientificPlot.
Definition at line 55 of file Plot1D.cpp.
References ScientificPlot::axesRangeContains(), m_custom_plot, ScientificPlot::plotType(), PlotEventInfo::setInAxesRange(), PlotEventInfo::setNx(), PlotEventInfo::setValue(), PlotEventInfo::setX(), viewItem(), and PlotEventInfo::x().
|
overrideprotectedinherited |
Definition at line 56 of file SessionItemWidget.cpp.
References SessionItemWidget::m_itemController, and SessionItemController::unsubscribe().
|
private |
creates and initializes the color map
Definition at line 148 of file Plot1D.cpp.
References Data1DViewItem::propertyContainerItem(), DataPropertyContainer::propertyItems(), and viewItem().
Referenced by subscribeToItem().
|
inlineoverride |
|
private |
Definition at line 270 of file Plot1D.cpp.
References BasicAxisItem::isBoundsPropertiesName(), AmplitudeAxisItem::isLogScalePropertyName(), BasicAxisItem::isTitlePropertyName(), BasicAxisItem::isTitleVisiblePropertyName(), Data1DViewItem::isXAxisPropertyName(), Data1DViewItem::isYAxisPropertyName(), m_block_update, m_custom_plot, replot(), setAxesLabelsFromItem(), setAxesRangeConnected(), setLog(), and viewItem().
Referenced by subscribeToItem().
|
privateslot |
updates plot depending on IntensityDataItem properties
Definition at line 81 of file Plot1D.cpp.
References Data1DViewItem::isAxesUnitsPropertyName(), m_block_update, replot(), setAxesRangeFromItem(), updateAllGraphs(), and viewItem().
Referenced by subscribeToItem().
|
privateslot |
Replots SpecularPlot.
Definition at line 109 of file Plot1D.cpp.
References m_custom_plot.
Referenced by setUpdateTimerConnected().
|
privateslot |
Propagate xmin, xmax back to IntensityDataItem.
Definition at line 93 of file Plot1D.cpp.
References m_block_update, Data1DViewItem::setLowerX(), Data1DViewItem::setUpperX(), and viewItem().
Referenced by setAxesRangeConnected().
|
privateslot |
Propagate ymin, ymax back to IntensityDataItem.
Definition at line 101 of file Plot1D.cpp.
References m_block_update, Data1DViewItem::setLowerY(), Data1DViewItem::setUpperY(), and viewItem().
Referenced by setAxesRangeConnected().
|
inherited |
transform widget coordinates to axes coordinates
Definition at line 37 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ScientificPlotEvent::currentPlotDescriptor(), and ColorMapSceneAdaptor::fromSceneX().
|
inherited |
Definition at line 42 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ScientificPlotEvent::currentPlotDescriptor(), and ColorMapSceneAdaptor::fromSceneY().
|
inlineinherited |
Definition at line 42 of file ScientificPlot.h.
References ScientificPlot::m_event.
Referenced by ProjectionsEditorCanvas::setConnected().
|
inlineinherited |
Returns the type of current plot.
Definition at line 59 of file ScientificPlot.h.
References ScientificPlot::m_plot_type.
Referenced by eventInfo(), SpecularPlot::eventInfo(), ColorMap::eventInfo(), and FontScalingEvent::setTickLabelFont().
|
private |
Refresh axes' labels, range and graph data.
Definition at line 197 of file Plot1D.cpp.
References m_block_update, replot(), setAxesLabelsFromItem(), setAxesRangeFromItem(), updateAllGraphs(), and viewItem().
Referenced by subscribeToItem().
|
private |
Schedule replot for later execution by onTimeReplot() slot.
Definition at line 301 of file Plot1D.cpp.
References m_update_timer, and UpdateTimer::scheduleUpdate().
Referenced by modifyAxesProperties(), onPropertyChanged(), and refreshPlotData().
void Plot1D::resetView | ( | ) |
reset all axes min,max to initial value
Definition at line 76 of file Plot1D.cpp.
References Data1DViewItem::resetView(), and viewItem().
|
private |
Sets X,Y axes labels from item.
Definition at line 228 of file Plot1D.cpp.
References Data1DViewItem::getXaxisTitle(), Data1DViewItem::getYaxisTitle(), m_custom_plot, setLabel(), Data1DViewItem::xAxisItem(), and Data1DViewItem::yAxisItem().
Referenced by modifyAxesProperties(), and refreshPlotData().
|
private |
Connects/disconnects signals related to SpecularPlot's X,Y axes rectangle change.
Definition at line 167 of file Plot1D.cpp.
References m_custom_plot, onXaxisRangeChanged(), and onYaxisRangeChanged().
Referenced by modifyAxesProperties(), setAxesRangeFromItem(), and setConnected().
|
private |
Sets (xmin,xmax) and (ymin,ymax) of SpecularPlot from specular item. Also sets logarithmic scale on y-axis if necessary.
Definition at line 216 of file Plot1D.cpp.
References Data1DViewItem::getLowerX(), Data1DViewItem::getLowerY(), Data1DViewItem::getUpperX(), Data1DViewItem::getUpperY(), Data1DViewItem::isLog(), m_custom_plot, setAxesRangeConnected(), and setLog().
Referenced by onPropertyChanged(), and refreshPlotData().
|
private |
Definition at line 161 of file Plot1D.cpp.
References setAxesRangeConnected(), and setUpdateTimerConnected().
Referenced by unsubscribeFromItem().
|
virtualinherited |
Reimplemented in SpecularPlotCanvas, SpecularDataImportWidget, SpecularDataWidget, IntensityDataWidget, JobResultsPresenter, ItemComboWidget, ProjectionsWidget, SpecularDataCanvas, IntensityDataCanvas, ColorMapCanvas, and Plot1DCanvas.
Definition at line 28 of file SessionItemWidget.cpp.
References SessionItemWidget::m_itemController, SessionItemController::setItem(), and SessionItemController::subscribe().
Referenced by MaskGraphicsProxy::setIntensityItem(), FitSessionWidget::setItem(), Plot1DCanvas::setItem(), ColorMapCanvas::setItem(), IntensityDataCanvas::setItem(), SpecularDataCanvas::setItem(), ProjectionsWidget::setItem(), ItemComboWidget::setItem(), IntensityDataWidget::setItem(), SpecularDataWidget::setItem(), SpecularDataImportWidget::setItem(), SpecularPlotCanvas::setItem(), ItemComboWidget::setPresentation(), FitComparisonWidget::subscribeToItem(), and FitComparisonWidget1D::subscribeToItem().
|
private |
Sets label to axis.
Definition at line 234 of file Plot1D.cpp.
References BasicAxisItem::isTitleVisible().
Referenced by setAxesLabelsFromItem().
void Plot1D::setLog | ( | bool | log | ) |
sets logarithmic scale
Definition at line 70 of file Plot1D.cpp.
References m_custom_plot, and GUI::View::RangeUtils::setLogz().
Referenced by modifyAxesProperties(), and setAxesRangeFromItem().
|
inherited |
Tracks move events (used when showing profile histograms and printing status string)
Definition at line 47 of file ScientificPlot.cpp.
References ScientificPlot::m_event, and ScientificPlotEvent::setMouseTrackingEnabled().
Referenced by ColorMap::ColorMap(), Plot1D(), SpecularPlot::SpecularPlot(), and PlotStatusLabel::setPlotLabelEnabled().
|
private |
Definition at line 188 of file Plot1D.cpp.
References m_update_timer, onTimeToReplot(), and UpdateTimer::timeToUpdate().
Referenced by setConnected().
|
overrideprotectedinherited |
Definition at line 51 of file SessionItemWidget.cpp.
References SessionItemWidget::m_itemController, and SessionItemController::subscribe().
|
inlineoverride |
|
signalinherited |
Referenced by ScientificPlotEvent::onCustomMouseMove(), and PlotStatusLabel::setConnected().
|
overrideprotectedvirtual |
Reimplemented from SessionItemWidget.
Definition at line 114 of file Plot1D.cpp.
References initPlots(), SessionItem::itemName(), m_graph_map, SessionItem::mapper(), modifyAxesProperties(), GUI::RealSpace::Particles::name(), onPropertyChanged(), refreshPlotData(), ModelMapper::setOnChildPropertyChange(), ModelMapper::setOnPropertyChange(), and viewItem().
|
overrideprotectedvirtual |
Reimplemented from SessionItemWidget.
Definition at line 138 of file Plot1D.cpp.
References m_custom_plot, m_graph_map, and setConnected().
|
private |
Sets data to graphs.
Definition at line 243 of file Plot1D.cpp.
References Data1DViewItem::propertyContainerItem(), DataPropertyContainer::propertyItems(), and viewItem().
Referenced by onPropertyChanged(), and refreshPlotData().
|
private |
Sets data to the graph corresponding to the passed Data1DProperties.
Definition at line 250 of file Plot1D.cpp.
References Data1DViewItem::graphData(), m_graph_map, and viewItem().
|
private |
Definition at line 258 of file Plot1D.cpp.
Referenced by eventInfo(), initPlots(), modifyAxesProperties(), onPropertyChanged(), onXaxisRangeChanged(), onYaxisRangeChanged(), refreshPlotData(), resetView(), subscribeToItem(), updateAllGraphs(), and updateGraph().
|
private |
Definition at line 263 of file Plot1D.cpp.
References SessionItemWidget::currentItem().
|
inherited |
transform axes coordinates to CustomPlot widget coordinates
Definition at line 27 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ColorMapSceneAdaptor::toSceneX(), and ColorMap::viewportRectangleInWidgetCoordinates().
|
inherited |
Definition at line 32 of file ScientificPlot.cpp.
References ScientificPlot::customPlot().
Referenced by ColorMapSceneAdaptor::toSceneY(), and ColorMap::viewportRectangleInWidgetCoordinates().
|
private |
Definition at line 112 of file Plot1D.h.
Referenced by modifyAxesProperties(), onPropertyChanged(), onXaxisRangeChanged(), onYaxisRangeChanged(), and refreshPlotData().
|
private |
Definition at line 108 of file Plot1D.h.
Referenced by Plot1D(), customPlot(), eventInfo(), modifyAxesProperties(), onTimeToReplot(), setAxesLabelsFromItem(), setAxesRangeConnected(), setAxesRangeFromItem(), setLog(), and unsubscribeFromItem().
|
privateinherited |
Definition at line 66 of file ScientificPlot.h.
Referenced by ScientificPlot::plotEvent(), and ScientificPlot::setMouseTrackingEnabled().
|
private |
Definition at line 110 of file Plot1D.h.
Referenced by subscribeToItem(), unsubscribeFromItem(), and updateGraph().
|
privateinherited |
Definition at line 49 of file SessionItemWidget.h.
Referenced by SessionItemWidget::SessionItemWidget(), SessionItemWidget::currentItem(), SessionItemWidget::hideEvent(), SessionItemWidget::setItem(), and SessionItemWidget::showEvent().
|
privateinherited |
Definition at line 65 of file ScientificPlot.h.
Referenced by ScientificPlot::plotType().
|
private |
Definition at line 109 of file Plot1D.h.
Referenced by replot(), and setUpdateTimerConnected().