25 const int replot_update_interval = 10;
27 int bin(
double x,
const QCPGraph* graph);
32 , m_custom_plot(new QCustomPlot)
33 , m_update_timer(new
UpdateTimer(replot_update_interval, this))
34 , m_block_update(true)
38 QVBoxLayout* vlayout =
new QVBoxLayout(
this);
39 vlayout->setContentsMargins(0, 0, 0, 0);
40 vlayout->setSpacing(0);
134 QPen pen(QColor(0, 0, 255, 200));
154 static_cast<void (QCPAxis::*)(
const QCPRange&)
>(&QCPAxis::rangeChanged),
this,
158 static_cast<void (QCPAxis::*)(
const QCPRange&)
>(&QCPAxis::rangeChanged),
this,
163 static_cast<void (QCPAxis::*)(
const QCPRange&)
>(&QCPAxis::rangeChanged),
this,
167 static_cast<void (QCPAxis::*)(
const QCPRange&)
>(&QCPAxis::rangeChanged),
this,
176 Qt::UniqueConnection);
199 m_custom_plot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
219 axis->setLabel(std::move(label));
221 axis->setLabel(QString());
231 for (
size_t i = 0, size = data->getAllocatedSize(); i < size; ++i) {
233 double y = data->operator[](i);
288 int bin(
double x,
const QCPGraph* graph)
290 const int key_start = graph->findBegin(x);
291 const int key_end = graph->findBegin(x,
false);
292 if (key_end == key_start || key_end == graph->dataCount())
294 return (x - graph->dataSortKey(key_start)) <= (graph->dataSortKey(key_end) - x) ? key_start
#define ASSERT(condition)
Defines various axis items.
Defines ColorMapUtils namespace.
Defines M_PI and some more mathematical constants.
Defines the class PlotEventInfo.
Defines class SpecularDataItem.
Defines class SpecularPlot.
Defines class UpdateTimer.
static const QString P_IS_LOGSCALE
static const QString P_MAX_DEG
static const QString P_TITLE
static const QString P_TITLE_IS_VISIBLE
static const QString P_MIN_DEG
OutputData< double > * getOutputData()
static const QString P_AXES_UNITS
void setOnValueChange(std::function< void(void)> f, const void *caller=0)
void setOnChildPropertyChange(std::function< void(SessionItem *, QString)> f, const void *caller=0)
Calls back on child property change, report childItem and property name.
void setOnPropertyChange(std::function< void(QString)> f, const void *caller=0)
double getAxisValue(size_t global_index, size_t i_selected_axis) const
Returns the value of selected axis for given global_index.
The Plot1D class presents data of several 1D DataItems contained in a Data1DViewItem.
Contains parameters of mouse position in 1D or 2D plot.
void setInAxesRange(bool flag)
void setValue(double value)
Common interface for plot-descriptor interaction.
PLOT_TYPE plotType() const
Returns the type of current plot.
bool axesRangeContains(double xpos, double ypos) const
Returns true if axes rectangle contains given in axes coordinates.
void setMouseTrackingEnabled(bool enable)
Tracks move events (used when showing profile histograms and printing status string)
QString itemName() const
Get item name, return display name if no name is set.
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
QString modelType() const
Get model type.
double getLowerY() const
returns lower and upper zoom ranges of y-axis
QString getXaxisTitle() const
void setUpperY(double value)
void setUpperX(double value)
void setLowerX(double value)
static const QString P_YAXIS
static const QString P_XAXIS
void setLowerY(double value)
double getLowerX() const
returns lower and upper zoom ranges of x-axis
QString getYaxisTitle() const
void resetView()
Set axes viewport to original data.
const AmplitudeAxisItem * yAxisItem() const
const BasicAxisItem * xAxisItem() const
The SpecularPlot class presents 1D intensity data from SpecularDataItem.
void initPlot()
creates and initializes the color map
void setAxesRangeConnected(bool isConnected)
Connects/disconnects signals related to SpecularPlot's X,Y axes rectangle change.
void setConnected(bool isConnected)
void setPlotFromItem(SpecularDataItem *intensityItem)
Sets initial state of SpecularPlot to match given intensity item.
void setAxesLabelsFromItem(SpecularDataItem *item)
Sets X,Y axes labels from item.
SpecularPlot(QWidget *parent=nullptr)
void setLog(bool log)
sets logarithmic scale
PlotEventInfo eventInfo(double xpos, double ypos) const override
Returns PlotEventInfo corresponding to given axes coordinates.
UpdateTimer * m_update_timer
void setUpdateTimerConnected(bool isConnected)
void onXaxisRangeChanged(QCPRange newRange)
Propagate xmin, xmax back to IntensityDataItem.
void setAxesRangeFromItem(SpecularDataItem *item)
Sets (xmin,xmax) and (ymin,ymax) of SpecularPlot from specular item.
void modifyAxesProperties(const QString &axisName, const QString &propertyName)
void onTimeToReplot()
Replots SpecularPlot.
void setLabel(const BasicAxisItem *item, QCPAxis *axis, QString label)
Sets label to axis.
void onPropertyChanged(const QString &property_name)
updates plot depending on IntensityDataItem properties
QCustomPlot * m_custom_plot
void setDataFromItem(SpecularDataItem *item)
Sets the intensity values to SpecularPlot.
void subscribeToItem() override
SpecularDataItem * specularItem()
void replot()
Schedule replot for later execution by onTimeReplot() slot.
void unsubscribeFromItem() override
void onYaxisRangeChanged(QCPRange newRange)
Propagate ymin, ymax back to IntensityDataItem.
void resetView()
reset all axes min,max to initial value
The UpdateTimer class accumulates update requests during certain period of time, and at the end of th...
void setLogz(QCPColorScale *scale, bool isLogz)
int plot_tick_label_size()
QString const & name(EShape k)
Defines various constants for plotting.