本文整理汇总了Java中org.jfree.data.statistics.SimpleHistogramBin类的典型用法代码示例。如果您正苦于以下问题:Java SimpleHistogramBin类的具体用法?Java SimpleHistogramBin怎么用?Java SimpleHistogramBin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleHistogramBin类属于org.jfree.data.statistics包,在下文中一共展示了SimpleHistogramBin类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testAccepts
import org.jfree.data.statistics.SimpleHistogramBin; //导入依赖的package包/类
/**
* Some checks for the accepts() method.
*/
public void testAccepts() {
SimpleHistogramBin bin1 = new SimpleHistogramBin(1.0, 2.0);
assertFalse(bin1.accepts(0.0));
assertTrue(bin1.accepts(1.0));
assertTrue(bin1.accepts(1.5));
assertTrue(bin1.accepts(2.0));
assertFalse(bin1.accepts(2.1));
assertFalse(bin1.accepts(Double.NaN));
SimpleHistogramBin bin2
= new SimpleHistogramBin(1.0, 2.0, false, false);
assertFalse(bin2.accepts(0.0));
assertFalse(bin2.accepts(1.0));
assertTrue(bin2.accepts(1.5));
assertFalse(bin2.accepts(2.0));
assertFalse(bin2.accepts(2.1));
assertFalse(bin2.accepts(Double.NaN));
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:SimpleHistogramBinTests.java
示例2: testOverlapsWidth
import org.jfree.data.statistics.SimpleHistogramBin; //导入依赖的package包/类
/**
* Some checks for the overlapsWith() method.
*/
public void testOverlapsWidth() {
SimpleHistogramBin b1 = new SimpleHistogramBin(1.0, 2.0);
SimpleHistogramBin b2 = new SimpleHistogramBin(2.0, 3.0);
SimpleHistogramBin b3 = new SimpleHistogramBin(3.0, 4.0);
SimpleHistogramBin b4 = new SimpleHistogramBin(0.0, 5.0);
SimpleHistogramBin b5 = new SimpleHistogramBin(2.0, 3.0, false, true);
SimpleHistogramBin b6 = new SimpleHistogramBin(2.0, 3.0, true, false);
assertTrue(b1.overlapsWith(b2));
assertTrue(b2.overlapsWith(b1));
assertFalse(b1.overlapsWith(b3));
assertFalse(b3.overlapsWith(b1));
assertTrue(b1.overlapsWith(b4));
assertTrue(b4.overlapsWith(b1));
assertFalse(b1.overlapsWith(b5));
assertFalse(b5.overlapsWith(b1));
assertTrue(b1.overlapsWith(b6));
assertTrue(b6.overlapsWith(b1));
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:SimpleHistogramBinTests.java
示例3: testAccepts
import org.jfree.data.statistics.SimpleHistogramBin; //导入依赖的package包/类
/**
* Some checks for the accepts() method.
*/
public void testAccepts() {
SimpleHistogramBin bin1 = new SimpleHistogramBin(1.0, 2.0);
assertFalse(bin1.accepts(0.0));
assertTrue(bin1.accepts(1.0));
assertTrue(bin1.accepts(1.5));
assertTrue(bin1.accepts(2.0));
assertFalse(bin1.accepts(2.1));
assertFalse(bin1.accepts(Double.NaN));
SimpleHistogramBin bin2
= new SimpleHistogramBin(1.0, 2.0, false, false);
assertFalse(bin2.accepts(0.0));
assertFalse(bin2.accepts(1.0));
assertTrue(bin2.accepts(1.5));
assertFalse(bin2.accepts(2.0));
assertFalse(bin2.accepts(2.1));
assertFalse(bin2.accepts(Double.NaN));
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:22,代码来源:SimpleHistogramBinTests.java
示例4: testEquals
import org.jfree.data.statistics.SimpleHistogramBin; //导入依赖的package包/类
/**
* Ensure that the equals() method can distinguish all fields.
*/
public void testEquals() {
SimpleHistogramDataset d1 = new SimpleHistogramDataset("Dataset 1");
SimpleHistogramDataset d2 = new SimpleHistogramDataset("Dataset 1");
assertTrue(d1.equals(d2));
d1.addBin(new SimpleHistogramBin(1.0, 2.0));
assertFalse(d1.equals(d2));
d2.addBin(new SimpleHistogramBin(1.0, 2.0));
assertTrue(d1.equals(d2));
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:SimpleHistogramDatasetTests.java
示例5: processMatchingData
import org.jfree.data.statistics.SimpleHistogramBin; //导入依赖的package包/类
@Override
public Data processMatchingData(Data data) {
// Utils.isKeyValid( data, key, Double.class);
double[] v;
if (data.containsKey(key)) {
v = Utils.toDoubleArray(data.get(key));
} else {
throw new RuntimeException("Key not found in event. " + key);
}
for (int i = 0; i < v.length; i++) {
if (Double.isNaN(v[i])) {
log.warn("This doesnt handle NaNs very well.");
}
try {
dataset.addObservation(v[i]);
chart.setTitle(title + " " + key + " " + counter++ + " entries");
} catch (RuntimeException e) {
//log.debug("RuntimeException while trying to add observation. Probably a missing bin for the value. Trying to create a new bin");
SimpleHistogramBin bin = new SimpleHistogramBin(Math.floor(v[i] / binWidth) * binWidth, Math.floor(v[i] / binWidth) * binWidth + binWidth - 1e-15, true, false);
//The 1e-15 in the upper limit avoids rounding errors which lead to overlapping bins and therefore missing histogram entries
try {
dataset.addBin(bin);
dataset.addObservation(v[i]);
chart.setTitle("Histogram " + key + " " + counter++ + " entries");
} catch (Exception ee) {
log.warn("Overlapping bin");
}
}
}
return data;
}
开发者ID:fact-project,项目名称:fact-tools,代码行数:34,代码来源:HistogramArrayPlotter.java
示例6: createDataset
import org.jfree.data.statistics.SimpleHistogramBin; //导入依赖的package包/类
public IntervalXYDataset createDataset(){
SimpleHistogramDataset dataset=new SimpleHistogramDataset("Claves");
SimpleHistogramBin histogramBin=new SimpleHistogramBin(0D, 1.0D,true,false);
histogramBin.setItemCount(10);
dataset.addBin(histogramBin);
return dataset;
}
开发者ID:dlfinis,项目名称:PSimulacion,代码行数:8,代码来源:dlgGrafico.java
示例7: testEquals
import org.jfree.data.statistics.SimpleHistogramBin; //导入依赖的package包/类
/**
* Ensure that the equals() method can distinguish all fields.
*/
public void testEquals() {
SimpleHistogramDataset d1 = new SimpleHistogramDataset("Dataset 1");
SimpleHistogramDataset d2 = new SimpleHistogramDataset("Dataset 1");
assertTrue(d1.equals(d2));
d1.addBin(new SimpleHistogramBin(1.0, 2.0));
assertFalse(d1.equals(d2));
d2.addBin(new SimpleHistogramBin(1.0, 2.0));
assertTrue(d1.equals(d2));
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:14,代码来源:SimpleHistogramDatasetTests.java
示例8: testClearObservations
import org.jfree.data.statistics.SimpleHistogramBin; //导入依赖的package包/类
/**
* Some checks for the clearObservations() method.
*/
public void testClearObservations() {
SimpleHistogramDataset d1 = new SimpleHistogramDataset("D1");
d1.clearObservations();
assertEquals(0, d1.getItemCount(0));
d1.addBin(new SimpleHistogramBin(0.0, 1.0));
d1.addObservation(0.5);
assertEquals(1.0, d1.getYValue(0, 0), EPSILON);
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:SimpleHistogramDatasetTests.java
示例9: testRemoveAllBins
import org.jfree.data.statistics.SimpleHistogramBin; //导入依赖的package包/类
/**
* Some checks for the removeAllBins() method.
*/
public void testRemoveAllBins() {
SimpleHistogramDataset d1 = new SimpleHistogramDataset("D1");
d1.addBin(new SimpleHistogramBin(0.0, 1.0));
d1.addObservation(0.5);
d1.addBin(new SimpleHistogramBin(2.0, 3.0));
assertEquals(2, d1.getItemCount(0));
d1.removeAllBins();
assertEquals(0, d1.getItemCount(0));
}
开发者ID:SpoonLabs,项目名称:astor,代码行数:13,代码来源:SimpleHistogramDatasetTests.java
示例10: processMatchingData
import org.jfree.data.statistics.SimpleHistogramBin; //导入依赖的package包/类
@Override
public Data processMatchingData(Data data) {
// Utils.isKeyValid( data, key, Double.class);
double v = 0;
if (data.containsKey(key)) {
v = Utils.valueToDouble(data.get(key));
} else {
throw new RuntimeException("Key not found in event. " + key);
}
if (Double.isNaN(v)) {
log.warn("This doesnt handle NaNs very well.");
}
try {
dataset.addObservation(v);
chart.setTitle(title + " " + key + " " + counter++ + " entries");
} catch (RuntimeException e) {
//log.debug("RuntimeException while trying to add observation. Probably a missing bin for the value. Trying to create a new bin");
SimpleHistogramBin bin = new SimpleHistogramBin(Math.floor(v / binWidth) * binWidth, Math.floor(v / binWidth) * binWidth + binWidth - 1e-17, true, false);
//The 1e-17 in the upper limit avoids rounding errors which lead to overlapping bins and therefore missing histogram entries
try {
dataset.addBin(bin);
dataset.addObservation(v);
chart.setTitle("Histogram " + key + " " + counter++ + " entries");
} catch (Exception ee) {
log.warn("Overlapping bin");
}
}
//else if ( Utils.isKeyValid(data, key, Double.class) ) {
//dataset.addObservation(((Double) data.get(key)).floatValue());
//}
//dataset.addObservations(Utils.toDoubleArray(data.get(key)));
// try{
// if (data.containsKey(key)) {
// int[] hist = (int[]) data.get(key);
// binSize = max/(hist.length);
// fillDataSet(hist);
// xyplot.getDomainAxis().setRange(min - binSize, max + binSize);
// }
// } catch (ClassCastException e){
// log.error("Key did not refer to an int array");
// return null;
// }
return data;
}
开发者ID:fact-project,项目名称:fact-tools,代码行数:46,代码来源:HistogramPlotter.java
注:本文中的org.jfree.data.statistics.SimpleHistogramBin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论