本文整理汇总了Java中org.jfree.chart.ChartColor类的典型用法代码示例。如果您正苦于以下问题:Java ChartColor类的具体用法?Java ChartColor怎么用?Java ChartColor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChartColor类属于org.jfree.chart包,在下文中一共展示了ChartColor类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPieChart
import org.jfree.chart.ChartColor; //导入依赖的package包/类
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;
}
示例2: getColor
import org.jfree.chart.ChartColor; //导入依赖的package包/类
/**
* 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;
}
示例3: createBarChart
import org.jfree.chart.ChartColor; //导入依赖的package包/类
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;
}
示例4: getItemPaint
import org.jfree.chart.ChartColor; //导入依赖的package包/类
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];
}
示例5: createChart
import org.jfree.chart.ChartColor; //导入依赖的package包/类
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;
}
示例6: addKillEvent
import org.jfree.chart.ChartColor; //导入依赖的package包/类
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);
}
示例7: addIllegalEvent
import org.jfree.chart.ChartColor; //导入依赖的package包/类
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);
}
示例8: createChart
import org.jfree.chart.ChartColor; //导入依赖的package包/类
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;
}
示例9: createDrawingSupplier
import org.jfree.chart.ChartColor; //导入依赖的package包/类
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);
}
示例10: colorir
import org.jfree.chart.ChartColor; //导入依赖的package包/类
private void colorir(ChartColor color) {
int a = 0;
}