Java 类org.jfree.chart.ChartColor 实例源码

项目:cooper    文件:PieChartCreater.java   
private static JFreeChart createPieChart(PieDataset piedataset, GraphDataItem item) {
    JFreeChart jfreechart = ChartFactory.createPieChart(item.getTitle(), piedataset, true, true, false);
    Font font = new Font("宋体", Font.PLAIN, 13);
    jfreechart.getTitle().setFont(font);
    jfreechart.getLegend().setItemFont(font);
    PiePlot pieplot = (PiePlot) jfreechart.getPlot();
    pieplot.setBackgroundPaint(ChartColor.WHITE);
    pieplot.setLabelFont(font);
    pieplot.setLabelGenerator(new StandardPieSectionLabelGenerator(("{0}: ({2})"),
            NumberFormat.getNumberInstance(), new DecimalFormat("0.00%")));
    pieplot.setLabelBackgroundPaint(new Color(220, 220, 220));
    pieplot.setSimpleLabels(true);
    pieplot.setInteriorGap(0.0D);

    int index = 0;
    for (Object name : item.getDatas().keySet()) {
        pieplot.setSectionPaint((String) name, COLORS[index % COLORS.length]);
        index++;

    }
    return jfreechart;
}
项目:jamel    文件:ColorParser.java   
/**
 * Parses the string and returns the specified color.
 * 
 * @param name
 *            the name of the color to be returned.
 * @return a color.
 */
public static Color getColor(String name) {
    Color result;
    try {
        result = (Color) ColorParser.class.getField(name).get(null);
    } catch (@SuppressWarnings("unused") NoSuchFieldException e1) {
        try {
            result = (Color) ChartColor.class.getField(name).get(null);
        } catch (@SuppressWarnings("unused") IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e2) {
            throw new IllegalArgumentException("Bad color: " + name);
        }
    } catch (@SuppressWarnings("unused") IllegalArgumentException | IllegalAccessException | SecurityException e3) {
        throw new IllegalArgumentException("Bad color: " + name);
    }

    return result;
}
项目:ts-benchmark    文件:ChartBizUtil.java   
private static  JFreeChart createBarChart(String title,String category,String value, CategoryDataset dataset) {   
        JFreeChart chart = ChartFactory.createBarChart3D(title, // chart title   
                    category, // domain axis label   
                    value, // range axis label   
                    dataset, // data   
                    PlotOrientation.VERTICAL, // 图标方向   
                    true, // 是否显示legend   
                    true, // 是否显示tooltips   
                    false // 是否显示URLs   
            );   
        CategoryPlot plot = chart.getCategoryPlot();//设置图的高级属性 
        plot.setBackgroundPaint(ChartColor.WHITE);
        NumberAxis na= (NumberAxis)plot.getRangeAxis();
//      na.setAutoTickUnitSelection(false);//设置小数点位数
        na.setNumberFormatOverride(df);
//      NumberTickUnit nt=new NumberTickUnit(1.22);
//      na.setTickUnit(nt);
//      plot.setRangeAxis(na);
        BarRenderer3D renderer = new BarRenderer3D();//3D属性修改 
        renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
        renderer.setBaseItemLabelsVisible(true);
        renderer.setItemLabelAnchorOffset(10);
        renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_CENTER));
        renderer.setSeriesPaint(0,new Color(34,139,34));
        renderer.setSeriesPaint(1,new Color(154,205,50));
        renderer.setSeriesPaint(2,new Color(0,255,0));
        renderer.setSeriesPaint(3,new Color(127,255,212));
        plot.setRenderer(renderer);//将修改后的属性值保存到图中 
        return chart;   
    }
项目:jmetrik    文件:JmetrikXYLineAndShapeRenderer.java   
public Paint getItemPaint(int row, int col){
    Paint[] altColors = {
            Color.BLACK,
            ChartColor.RED,
            ChartColor.DARK_BLUE,
            ChartColor.DARK_GREEN,
            ChartColor.DARK_MAGENTA,
            ChartColor.DARK_CYAN,
            ChartColor.LIGHT_RED,
            ChartColor.LIGHT_BLUE,
            ChartColor.LIGHT_GREEN,
            ChartColor.LIGHT_MAGENTA,
            ChartColor.LIGHT_CYAN,
            ChartColor.VERY_DARK_RED,
            ChartColor.VERY_DARK_BLUE,
            ChartColor.VERY_DARK_GREEN,
            ChartColor.VERY_DARK_YELLOW,
            ChartColor.VERY_DARK_MAGENTA,
            ChartColor.VERY_DARK_CYAN,
            ChartColor.VERY_LIGHT_RED,
            ChartColor.VERY_LIGHT_BLUE,
            ChartColor.VERY_LIGHT_GREEN,
            ChartColor.VERY_LIGHT_MAGENTA,
            ChartColor.VERY_LIGHT_CYAN
    };

    return altColors[row];
}
项目:cooper    文件:BarCreater.java   
private static JFreeChart createChart(GraphDataItem item, CategoryDataset categorydataset) {
        JFreeChart jfreechart = ChartFactory.createStackedBarChart(item.getTitle(), item.getLineXName(),
                item.getLineYName(), categorydataset, PlotOrientation.VERTICAL, true, true, false);

        Font font = new Font("宋体", Font.PLAIN, 13);
        jfreechart.getTitle().setFont(font);
        jfreechart.getLegend().setItemFont(font);

        CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
        categoryplot.getDomainAxis().setTickLabelFont(font);
        categoryplot.getDomainAxis().setLabelFont(font);
        categoryplot.getDomainAxis().setCategoryLabelPositions(
                CategoryLabelPositions.createUpRotationLabelPositions(0.392D));
        categoryplot.getRangeAxis().setTickLabelFont(font);
        categoryplot.getRangeAxis().setLabelFont(font);
        categoryplot.setBackgroundPaint(ChartColor.WHITE);

        StackedBarRenderer stackedbarrenderer = (StackedBarRenderer) categoryplot.getRenderer();
        stackedbarrenderer.setDrawBarOutline(false);
        stackedbarrenderer.setBaseItemLabelsVisible(true);
        stackedbarrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());

//      int index = 0;
//      for (Object name : item.getDatas().keySet()) {
//          stackedbarrenderer
//                  .setSeriesPaint(categorydataset.getRowIndex((String) name), COLORS[index % COLORS.length]);
//          index++;
//
//      }

        return jfreechart;
    }
项目:flink-perf    文件:KafkaFT.java   
private static void addKillEvent(XYPlot xyplot, long pos) {
    ValueMarker vm = new ValueMarker(pos);
    vm.setPaint(ChartColor.VERY_DARK_GREEN);
    vm.setLabelOffset(new RectangleInsets(10.0D, 1.0D, 1.0D, 1.0D));
    vm.setLabel("Container Kill Event");
    vm.setStroke(new BasicStroke(2));
    xyplot.addDomainMarker(vm);
}
项目:flink-perf    文件:KafkaFT.java   
private static void addIllegalEvent(XYPlot xyplot, long pos) {
    ValueMarker vm = new ValueMarker(pos);
    vm.setPaint(ChartColor.LIGHT_YELLOW);
    vm.setLabelOffset(new RectangleInsets(10.0D, 1.0D, 1.0D, 1.0D));
    vm.setLabel("Illegal State");
    vm.setStroke(new BasicStroke(2));
    xyplot.addDomainMarker(vm);
}
项目:flink-perf    文件:KafkaFT.java   
private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Flink Exactly-Once on Kafka with YARN Chaos Monkey", "Date", "Value", xydataset, true, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();

    XYLineAndShapeRenderer r0 = (XYLineAndShapeRenderer) xyplot.getRenderer(0);

    // draw data points as points
    r0.setSeriesShapesVisible(2, true);
    r0.setSeriesLinesVisible(2, true);
    // order elements as assed
    xyplot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);

    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();

    Number first = xydataset.getX(0, 0);
    Minute minute = new Minute(new Date((Long)first));
    System.out.println("first = "+first);
    RelativeDateFormat relativedateformat = new RelativeDateFormat(minute.getFirstMillisecond());
    relativedateformat.setSecondFormatter(new DecimalFormat("00"));
    dateaxis.setDateFormatOverride(relativedateformat);


    //dateaxis.setDateFormatOverride(new SimpleDateFormat("mm:ss"));
    ValueAxis valueaxis = xyplot.getRangeAxis();
    valueaxis.setAutoRangeMinimumSize(1.0D);
    valueaxis.setLabel("Elements/Core");

    xyplot.getRenderer().setSeriesPaint(2, ChartColor.DARK_MAGENTA);
    return jfreechart;
}
项目:cy-dataseries    文件:ChartUtils.java   
public static DrawingSupplier createDrawingSupplier()
{
    //Our paint sequence (the default contains very light yellow, which is not legible
    Paint[] paintSequence = new Paint[] {
            new Color(0xFF, 0x55, 0x55),
            new Color(0x55, 0x55, 0xFF),
            new Color(0x55, 0xFF, 0x55),
            new Color(0xFF, 0x55, 0xFF),
            new Color(0x55, 0xFF, 0xFF),
            Color.pink,
            Color.gray,
            ChartColor.DARK_RED,
            ChartColor.DARK_BLUE,
            ChartColor.DARK_GREEN,
            ChartColor.DARK_YELLOW,
            ChartColor.DARK_MAGENTA,
            ChartColor.DARK_CYAN,
            Color.darkGray,
            ChartColor.LIGHT_RED,
            ChartColor.LIGHT_BLUE,
            ChartColor.LIGHT_GREEN,
            ChartColor.LIGHT_YELLOW,
            ChartColor.LIGHT_MAGENTA,
            ChartColor.LIGHT_CYAN,
            Color.lightGray,
            ChartColor.VERY_DARK_RED,
            ChartColor.VERY_DARK_BLUE,
            ChartColor.VERY_DARK_GREEN,
            ChartColor.VERY_DARK_YELLOW,
            ChartColor.VERY_DARK_MAGENTA,
            ChartColor.VERY_DARK_CYAN,
            ChartColor.VERY_LIGHT_RED,
            ChartColor.VERY_LIGHT_BLUE,
            ChartColor.VERY_LIGHT_GREEN,
            ChartColor.VERY_LIGHT_YELLOW,
            ChartColor.VERY_LIGHT_MAGENTA,
            ChartColor.VERY_LIGHT_CYAN
        };      

    //Replace the drawing supplier with a supplier with all defaults, but a different paint sequence
    return new DefaultDrawingSupplier(paintSequence,
            DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE, 
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, 
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE);


}
项目:oceano    文件:Carro.java   
private void colorir(ChartColor color) {
    int a = 0;
}