Hi everyone
I am attempting to build Histogram using the qwtlotHistogram class.
However, my source data to generate the histogram contains negative values, therefore I am interested in the bins of the histogram to go from say -100 to +100.
The code below Works as long as my variable "min" us equal or grater to zero since QVector takes no negative indexes.
Is there a way to:
1 - Feed histogram data to qwtPlotHistogram with negative bin index values?
2 - I attempted to change the qwtPlot X axis either by using "setAxisScale" or generating a QwtScaleDiv and QwtScaleDraw but it only shifts the qwtPlot canvas and my histogram does not correspond to the modified axis.
Any suggestions are appreciated.
Thank you,
Sergio
QwtPlotHistogram *eHisto = new QwtPlotHistogram(title);
eHisto->setStyle(QwtPlotHistogram::Columns);
QVector<QwtIntervalSample> samples(size);// vector of interval samples
for ( int i = min; i < max; i++ )
{
QwtInterval interval(double(i), i + 1.0);
interval.setBorderFlags(QwtInterval::ExcludeMaximu m);
samples[i] = QwtIntervalSample(histogram->GetFrequency(i), interval);
}
QwtIntervalSeriesData *data = new QwtIntervalSeriesData;
data->setSamples(samples);
eHisto->setData(data);


Reply With Quote

Bookmarks