本文整理汇总了Java中org.jfree.chart.renderer.category.BoxAndWhiskerRenderer.setMeanVisible方法的典型用法代码示例。如果您正苦于以下问题:Java BoxAndWhiskerRenderer.setMeanVisible方法的具体用法?Java BoxAndWhiskerRenderer.setMeanVisible怎么用?Java BoxAndWhiskerRenderer.setMeanVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.category.BoxAndWhiskerRenderer
的用法示例。
在下文中一共展示了BoxAndWhiskerRenderer.setMeanVisible方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDumyChart
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
public static JFreeChart createDumyChart()
{
final BoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();
final CategoryAxis xAxis = new CategoryAxis( "Type" );
final NumberAxis yAxis = new NumberAxis( "Value" );
yAxis.setAutoRangeIncludesZero( false );
final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setFillBox( true );
renderer.setMeanVisible( false );
renderer.setMedianVisible( false );
// renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
final CategoryPlot plot = new CategoryPlot( dataset, xAxis, yAxis, renderer );
return new JFreeChart( plot );
}
示例2: createWhiskerChart
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
public static JFreeChart createWhiskerChart( SuccessfulAttack sa )
{
BoxAndWhiskerCategoryDataset boxandwhiskercategorydataset = createDataset( sa );
final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setMaximumBarWidth( 0.05 );
renderer.setMeanVisible( false );
renderer.setSeriesPaint( 0, Color.GREEN );
renderer.setSeriesPaint( 1, Color.RED );
renderer.setSeriesPaint( 2, Color.BLUE );
NumberAxis numberAxis = new NumberAxis( "duration in ms" );
CategoryPlot categoryplot =
new CategoryPlot( boxandwhiskercategorydataset, new CategoryAxis( "" ), numberAxis, renderer );
categoryplot.setDomainGridlinesVisible( true );
categoryplot.setRangePannable( true );
NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
numberaxis.setStandardTickUnits( NumberAxis.createIntegerTickUnits() );
JFreeChart jFreeChart = new JFreeChart( "", new Font( "SansSerif", Font.BOLD, 14 ), categoryplot, true );
jFreeChart.removeLegend();
return jFreeChart;
}
示例3: createChart
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
@Override
protected JFreeChart createChart(String title, Dataset dataset) {
JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(title, X_AXIS_LABEL, getYAxisLabel(), (BoxAndWhiskerCategoryDataset) dataset, false);
CategoryPlot p = chart.getCategoryPlot();
p.setForegroundAlpha(0.5f);
p.setBackgroundPaint(Color.lightGray);
p.setDomainGridlinesVisible(true);
p.setDomainGridlinePaint(Color.white);
p.setRangeGridlinesVisible(true);
p.setRangeGridlinePaint(Color.white);
BoxAndWhiskerRenderer renderer = (BoxAndWhiskerRenderer)p.getRenderer();
renderer.setSeriesPaint(0, new Color(40,234,115));
renderer.setMeanVisible(false);
return chart;
}
示例4: MainView
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
/** Creates new form MainPanel */
public MainView(MainViewController controller) {
this.controller = controller;
this.resultsTableModel = new ResultsTableModel();
this.teamsChart = ChartFactory.createBoxAndWhiskerChart("Teams at checkpoints", "checkpoint", "teams",
(BoxAndWhiskerCategoryDataset) null, false);
CategoryPlot plot = this.teamsChart.getCategoryPlot();
plot.setRangeGridlinePaint(Color.DARK_GRAY);
plot.setBackgroundPaint(Color.WHITE);
plot.getRangeAxis().setAutoRange(false);
BoxAndWhiskerRenderer renderer = (BoxAndWhiskerRenderer) this.teamsChart.getCategoryPlot().getRenderer();
renderer.setMeanVisible(false);
initComponents();
}
示例5: createRenderer
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
/**
* Creates a Renderer object to that can draw the BoxPlot.
*
* @return a BoxAndWhiskerRenderer that can render the boxplot
*/
private static BoxAndWhiskerRenderer createRenderer(
final boolean meanVisible, final boolean fillBox) {
BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setMeanVisible(meanVisible);
renderer.setFillBox(fillBox);
renderer.setBaseToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
return renderer;
}
示例6: testEquals
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
/**
* Test that the equals() method distinguishes all fields.
*/
public void testEquals() {
BoxAndWhiskerRenderer r1 = new BoxAndWhiskerRenderer();
BoxAndWhiskerRenderer r2 = new BoxAndWhiskerRenderer();
assertEquals(r1, r2);
r1.setArtifactPaint(new GradientPaint(1.0f, 2.0f, Color.yellow,
3.0f, 4.0f, Color.blue));
assertFalse(r1.equals(r2));
r2.setArtifactPaint(new GradientPaint(1.0f, 2.0f, Color.yellow,
3.0f, 4.0f, Color.blue));
assertEquals(r1, r2);
r1.setFillBox(!r1.getFillBox());
assertFalse(r1.equals(r2));
r2.setFillBox(!r2.getFillBox());
assertEquals(r1, r2);
r1.setItemMargin(0.11);
assertFalse(r1.equals(r2));
r2.setItemMargin(0.11);
assertEquals(r1, r2);
r1.setMaximumBarWidth(0.99);
assertFalse(r1.equals(r2));
r2.setMaximumBarWidth(0.99);
assertTrue(r1.equals(r2));
// the default for meanVisible is false in 1.2.x
r1.setMeanVisible(true);
assertFalse(r1.equals(r2));
r2.setMeanVisible(true);
assertTrue(r1.equals(r2));
r1.setMedianVisible(false);
assertFalse(r1.equals(r2));
r2.setMedianVisible(false);
assertTrue(r1.equals(r2));
}
示例7: getChart
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
public JFreeChart getChart() {
if (chart == null) {
createDataset();
chart = ChartFactory.createBarChart(getTitle(),
// chart title
"Category",
// domain axis label
"Value",
// range axis label
dataset,
// data
PlotOrientation.VERTICAL,
// orientation
false,
// include legend
true,
// tooltips?
false
// URLs?
);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
CategoryAxis rangeAxis = plot.getDomainAxis();
rangeAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
renderer.setFillBox(true);
renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
renderer.setMeanVisible(isMeanVisible);
plot.setRenderer(renderer);
}
return chart;
}
示例8: writeToFile
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
public void writeToFile(String outName) throws FileNotFoundException, UnsupportedEncodingException, IOException
{
//calcMeans();
// Create JFreeChart Dataset
DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset( );
HashMap<String, ArrayList<Double> > measuresFirst = algorithmMeasures.entrySet().iterator().next().getValue();
for (Map.Entry<String, ArrayList<Double> > measure : measuresFirst.entrySet())
{
String measureName = measure.getKey();
//Double measureValue = measure.getValue();
dataset.clear();
for (Map.Entry<String, HashMap<String, ArrayList<Double> >> entry : algorithmMeasures.entrySet())
{
String alg = entry.getKey();
ArrayList<Double> measureValues = entry.getValue().get(measureName);
// Parse algorithm name to show it correctly
String aName = alg.substring(0, alg.length()-1);
int startAlgName = aName.lastIndexOf("/");
aName = aName.substring(startAlgName + 1);
dataset.add(measureValues, aName, measureName);
}
// Tutorial: http://www.java2s.com/Code/Java/Chart/JFreeChartBoxAndWhiskerDemo.htm
final CategoryAxis xAxis = new CategoryAxis("Algorithm");
final NumberAxis yAxis = new NumberAxis("Value");
yAxis.setAutoRangeIncludesZero(false);
final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
// Black and White
int numItems = algorithmMeasures.size();
for(int i=0;i<numItems;i++)
{
Color color = Color.DARK_GRAY;
if(i%2 == 1)
{
color = Color.LIGHT_GRAY;
}
renderer.setSeriesPaint(i, color);
renderer.setSeriesOutlinePaint(i, Color.BLACK);
}
renderer.setMeanVisible(false);
renderer.setFillBox(false);
renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
Font font = new Font("SansSerif", Font.BOLD, 10);
//ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
JFreeChart jchart = new JFreeChart("Assotiation Rules Measures - BoxPlot", font, plot, true);
//StandardChartTheme.createLegacyTheme().apply(jchart);
int width = 640 * 2; /* Width of the image */
int height = 480 * 2; /* Height of the image */
// JPEG
File chart = new File( outName + "_" + measureName + "_boxplot.jpg" );
ChartUtilities.saveChartAsJPEG( chart , jchart , width , height );
// SVG
SVGGraphics2D g2 = new SVGGraphics2D(width, height);
Rectangle r = new Rectangle(0, 0, width, height);
jchart.draw(g2, r);
File BarChartSVG = new File( outName + "_" + measureName + "_boxplot.svg" );
SVGUtils.writeToSVG(BarChartSVG, g2.getSVGElement());
}
}
示例9: Evaluation
import org.jfree.chart.renderer.category.BoxAndWhiskerRenderer; //导入方法依赖的package包/类
public Evaluation(){
String[] nameOfTestInstances = {"att48","brg180","ch150","gr202"};
int[] numberOfTestRuns = {100,100,50,20};
int[] timeLimits = {1,2,15,120};
LinkedList<Double> ilsResults = new LinkedList<Double>();
LinkedList<Double> memeResults = new LinkedList<Double>();
final DefaultBoxAndWhiskerCategoryDataset dataset
= new DefaultBoxAndWhiskerCategoryDataset();
try {
for(int j = 0; j < nameOfTestInstances.length; j++)
{
// dataset.clear();
for(int i = 0; i<numberOfTestRuns[j]; i++)
{
String[] arguments = {nameOfTestInstances[j], String.valueOf(timeLimits[j]), String.valueOf(50), "noDiagrams"};
double[] results = TSP_Main.main(arguments);
ilsResults.add(results[0]);
memeResults.add(results[1]);
}
dataset.add(ilsResults, "Iterated Local Search", nameOfTestInstances[j]);
dataset.add(memeResults, "Memetic Algorithm", nameOfTestInstances[j]);
ilsResults.clear();
memeResults.clear();
}
final CategoryAxis xAxis = new CategoryAxis("Name of TSPLIB instance");
final NumberAxis yAxis = new NumberAxis("deviation from optimum in %");
// yAxis.setAutoRangeIncludesZero(false);
final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
// renderer.setFillBox(false);
renderer.setToolTipGenerator(new BoxAndWhiskerToolTipGenerator());
renderer.setMeanVisible(false);
renderer.setMaximumBarWidth(10);
final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer);
final NumberAxis axis = (NumberAxis) plot.getRangeAxis();
axis.setRange(Range.expandToInclude(axis.getRange(), -0.2));
final JFreeChart chart = new JFreeChart(
"Comparison of ILS and Memetic Algorithm",
new Font("SansSerif", Font.BOLD, 16),
plot,
true
);
final ChartPanel chartPanel = new ChartPanel(chart);
// chartPanel.setPreferredSize(new java.awt.Dimension(900, 540));
ChartUtilities.saveChartAsJPEG(new File("evaluation"), chart, 500, 400);
setContentPane(chartPanel);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}