コード例 #1
1
 private static JFreeChart createChart(CategoryDataset categorydataset) {
   JFreeChart jfreechart =
       ChartFactory.createBarChart(
           "Bar Chart Demo 1",
           "Category",
           "Value",
           categorydataset,
           PlotOrientation.VERTICAL,
           true,
           true,
           false);
   CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
   categoryplot.setDomainGridlinesVisible(true);
   categoryplot.setRangeCrosshairVisible(true);
   categoryplot.setRangeCrosshairPaint(Color.blue);
   NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
   numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
   BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
   barrenderer.setDrawBarOutline(false);
   GradientPaint gradientpaint =
       new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, new Color(0, 0, 64));
   GradientPaint gradientpaint1 =
       new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, new Color(0, 64, 0));
   GradientPaint gradientpaint2 =
       new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, new Color(64, 0, 0));
   barrenderer.setSeriesPaint(0, gradientpaint);
   barrenderer.setSeriesPaint(1, gradientpaint1);
   barrenderer.setSeriesPaint(2, gradientpaint2);
   barrenderer.setLegendItemToolTipGenerator(
       new StandardCategorySeriesLabelGenerator("Tooltip: {0}"));
   CategoryAxis categoryaxis = categoryplot.getDomainAxis();
   categoryaxis.setCategoryLabelPositions(
       CategoryLabelPositions.createUpRotationLabelPositions(0.52359877559829882D));
   return jfreechart;
 }