本文整理汇总了Java中org.jfree.data.xy.XYSeries.getItemCount方法的典型用法代码示例。如果您正苦于以下问题:Java XYSeries.getItemCount方法的具体用法?Java XYSeries.getItemCount怎么用?Java XYSeries.getItemCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.xy.XYSeries
的用法示例。
在下文中一共展示了XYSeries.getItemCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSamplingIntervalMilliSeconds
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
* Gets the sampling interval in milliseconds.
*
* @param series the series
* @param from the sampling interval offset start value
* @param to the the sampling interval offset end value
* @return the sampling interval
*/
private double getSamplingIntervalMilliSeconds(XYSeries series, int from, int to){
double samplingInterval = this.getSimulationDurationMilliSeconds();
if(to > series.getItemCount()-1 || to < 0){
to = series.getItemCount()-1;
}
if(!(from < to)){
from = to;
}
if(this.threadInfoStorage != null && series.getItemCount() > from){
Number start = series.getX(from); //first value
Number end = series.getX(to); //last value
samplingInterval = end.doubleValue() - start.doubleValue();
}
return samplingInterval;
}
示例2: getMetrics
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
* Calculates the metrics for all agents.
*/
public void getMetrics(){
Iterator<Entry<String, ThreadInfoStorageMachine>> iteratorMachine = threadInfoStorage.getMapMachine().entrySet().iterator();
while (iteratorMachine.hasNext()){
ThreadInfoStorageMachine actualMachine = iteratorMachine.next().getValue();
XYSeries series = actualMachine.getXYSeriesMap().get(threadInfoStorage.TOTAL_CPU_SYSTEM_TIME);
samplingIntervalOffsetStart = 0; //(t0 start)
samplingIntervalOffsetEnd = series.getItemCount()-1; //(t1 end)
samplingInterval = getSamplingIntervalMilliSeconds(series, samplingIntervalOffsetStart, samplingIntervalOffsetEnd);
if (getCalcType().equals(CALC_TYPE_INTEGRAL_DELTA)) {
series = actualMachine.getXYSeriesMap().get(threadInfoStorage.DELTA_CPU_SYSTEM_TIME);
calcTypeValueMap.put(actualMachine.getName(), getIntegralForTimeSeries(series, samplingIntervalOffsetStart, samplingIntervalOffsetEnd ));
} else if (getCalcType().equals(CALC_TYPE_INTEGRAL_TOTAL)) {
series = actualMachine.getXYSeriesMap().get(threadInfoStorage.TOTAL_CPU_SYSTEM_TIME);
calcTypeValueMap.put(actualMachine.getName(), getIntegralForTimeSeries(series, samplingIntervalOffsetStart, samplingIntervalOffsetEnd));
} else if (getCalcType().equals(CALC_TYPE_LAST_TOTAL)) {
series = actualMachine.getXYSeriesMap().get(threadInfoStorage.TOTAL_CPU_SYSTEM_TIME);
calcTypeValueMap.put(actualMachine.getName(), series.getMaxY());
// calcTypeValueMap.put(actualMachine.getName(), (series.getY(samplingIntervalOffsetEnd).doubleValue() - series.getY(samplingIntervalOffsetStart).doubleValue()));
}
Iterator<Entry<String, ThreadInfoStorageAgent>> iteratorAgent = threadInfoStorage.getMapAgent().entrySet().iterator();
while (iteratorAgent.hasNext()){
ThreadInfoStorageAgent actualAgent = iteratorAgent.next().getValue();
if (actualAgent.getName().contains(actualMachine.getName())) {
actualAgent.setRealMetric(getMetricForAgent(actualAgent, actualMachine, samplingIntervalOffsetStart, samplingIntervalOffsetEnd));
}
}
}
addOrUpdateAgentClassRealMetrics();
}
示例3: getIntegralForTimeSeries
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
* Gets the integral for time series.
*
* @param series the series
* @param from the start
* @param to the end
* @return the integral for time series
*/
private double getIntegralForTimeSeries(XYSeries series, int from, int to){
//hint: all Values are stored in milliseconds
double integral = 0.0d;
if(to > series.getItemCount()-1 || to < 0){
to = series.getItemCount()-1;
}
if(!(from < to)){
from = to;
}
//--- simple calculation of area ---
for(int x = from; x < to; x++){
//--- difference of X
double xDiff = series.getX(x+1).doubleValue() - series.getX(x).doubleValue();
// --- Y value for first and second measurement
double yValue1 = series.getY(x).doubleValue();
double yValue2 = series.getY(x+1).doubleValue();
integral = integral + (xDiff * yValue2);
// --- Subtract or add area of triangle
double triangle = (xDiff * (Math.abs(yValue2 - yValue1)))/2;
if(yValue2 > yValue1){
integral = integral - triangle;
}else if (yValue2 < yValue1){
integral = integral + triangle;
}
}
return integral;
}
示例4: getLastDeltaForXYSeries
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
* Gets the last delta for XY series.
* @param series the series
* @return the last delta for XY series
*/
public double getLastDeltaForXYSeries(XYSeries series) {
double from, to;
int itemIndex = series.getItemCount()-1;
if(itemIndex >=1){
from = (Double) series.getDataItem(itemIndex-1).getY();
to = (Double) series.getDataItem(itemIndex).getY();
return Math.abs(to - from);
}
return 0.0d;
}
示例5: GenerateMassCalibrationRTMap
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
public void GenerateMassCalibrationRTMap() throws IOException {
String pngfile = FilenameUtils.getFullPath(ScanCollectionName) + "/" + FilenameUtils.getBaseName(ScanCollectionName) + "_masscaliRT.png";
XYSeries series = new XYSeries("PSM");
XYSeriesCollection xySeriesCollection = new XYSeriesCollection();
LoessInterpolator loessInterpolator = new LoessInterpolator(
0.75,//bandwidth,
2//robustnessIters
);
for (PSM psm : this.IDsummary.PSMList.values()) {
float ppm = InstrumentParameter.CalcSignedPPM(psm.ObserPrecursorMass, psm.NeutralPepMass);
series.add(new XYDataItem(psm.RetentionTime, ppm));
}
double x[] = new double[IDsummary.PSMList.size()];
double y[] = new double[x.length];
double currentmin = 0f;
for (int i = 0; i < series.getItemCount(); i++) {
x[i] = (double) series.getX(i);
if (x[i] <= currentmin) {
x[i] = currentmin + 0.0001f;
}
currentmin = x[i];
y[i] = (double) series.getY(i);
}
Masscalibrationfunction = loessInterpolator.interpolate(x, y);
XYSeries smoothline = new XYSeries("Loess Regression");
double xvalue = series.getMinX();
while (xvalue < series.getMaxX()) {
smoothline.add(xvalue, Masscalibrationfunction.value(xvalue));
xvalue += 0.05d;
}
xySeriesCollection.addSeries(smoothline);
xySeriesCollection.addSeries(series);
JFreeChart chart = ChartFactory.createScatterPlot("Mass calibration", "RT", "Mass error (ppm)", xySeriesCollection,
PlotOrientation.VERTICAL, true, true, false);
XYPlot xyPlot = (XYPlot) chart.getPlot();
xyPlot.setDomainCrosshairVisible(true);
xyPlot.setRangeCrosshairVisible(true);
XYItemRenderer renderer = xyPlot.getRenderer();
renderer.setSeriesPaint(1, Color.blue);
renderer.setSeriesPaint(0, Color.BLACK);
renderer.setSeriesShape(1, new Ellipse2D.Double(0, 0, 3, 3));
renderer.setSeriesStroke(1, new BasicStroke(1.0f));
xyPlot.setBackgroundPaint(Color.white);
ChartUtilities.saveChartAsPNG(new File(pngfile), chart, 1000, 600);
}