本文整理汇总了Java中de.erichseifert.gral.plots.lines.LineRenderer.setColor方法的典型用法代码示例。如果您正苦于以下问题:Java LineRenderer.setColor方法的具体用法?Java LineRenderer.setColor怎么用?Java LineRenderer.setColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.erichseifert.gral.plots.lines.LineRenderer
的用法示例。
在下文中一共展示了LineRenderer.setColor方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: formatFilledArea
import de.erichseifert.gral.plots.lines.LineRenderer; //导入方法依赖的package包/类
private static void formatFilledArea(XYPlot plot, DataSource data, Color color) {
PointRenderer point = new DefaultPointRenderer2D();
point.setShape(new Ellipse2D.Double(-3,-3,6,6));
point.setColor(color);
plot.setPointRenderer(data, point);
LineRenderer line = new DefaultLineRenderer2D();
line.setColor(color);
float[] DOT_DOT = {4.0f, 4.0f};
line.setStroke(new BasicStroke(4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.f, DOT_DOT, 0.f));
line.setGap(3.0);
line.setGapRounded(true);
plot.setLineRenderer(data, line);
AreaRenderer area = new DefaultAreaRenderer2D();
area.setColor(GraphicsUtils.deriveWithAlpha(color, 64));
plot.setAreaRenderer(data, area);
}
示例2: formatFilledArea
import de.erichseifert.gral.plots.lines.LineRenderer; //导入方法依赖的package包/类
private static void formatFilledArea(XYPlot plot, DataSource data, Color color) {
PointRenderer point = new DefaultPointRenderer2D();
point.setColor(color);
plot.setPointRenderer(data, point);
LineRenderer line = new DefaultLineRenderer2D();
line.setColor(color);
line.setGap(3.0);
line.setGapRounded(true);
plot.setLineRenderer(data, line);
AreaRenderer area = new DefaultAreaRenderer2D();
area.setColor(GraphicsUtils.deriveWithAlpha(color, 64));
plot.setAreaRenderer(data, area);
}
示例3: render
import de.erichseifert.gral.plots.lines.LineRenderer; //导入方法依赖的package包/类
@Override
public void render(Canvas componentCanvas, PLLineChartBlock component) {
PLLinePlotData data = component.getData();
if(data != null){
int linesCount = data.getY().size();
Class[] classes = Arrays.stream((new Class[linesCount + 1])).map(v -> Double.class).toArray(Class[]::new);
DataTable dataTable = new DataTable(classes);
for(int i = 0;i < linesCount;i++){
final int index = i;
Double[] points = Stream.concat(Stream.of(data.getX().get(index)),
data.getY().stream().map(lineData -> lineData.getY().get(index))).toArray(Double[]::new);
dataTable.add(points);
}
DataSeries[] dataSeries = IntStream.range(0, linesCount).mapToObj(index -> new DataSeries(data.getY().get(index).getName(), dataTable, 0, index + 1)).toArray(DataSeries[]::new);
XYPlot plot = new XYPlot(dataSeries);
super.preparePlot(plot, component);
plot.getAxisRenderer(XYPlot.AXIS_X).setIntersection(-Double.MAX_VALUE);
plot.getAxisRenderer(XYPlot.AXIS_Y).setIntersection(-Double.MAX_VALUE);
Color[] seriesColor = (component.getData().getY() == null)?null:component.getData().getY().stream().map(point -> PLColor.create(point.getColor(), Color.class)).toArray(Color[]::new);
if(seriesColor != null){
for(int i = 0;i < seriesColor.length;i++){
try{
PointRenderer ptRenderer = new DefaultPointRenderer2D();
LineRenderer lineRenderer = new DefaultLineRenderer2D();
Color lineColor = seriesColor[i];
ptRenderer.setColor(lineColor);
lineRenderer.setColor(lineColor);
plot.setPointRenderers(dataSeries[i], ptRenderer);
plot.setLineRenderers(dataSeries[i], lineRenderer);
}catch(Exception e){
logger.error("Error caused when trying to set color for a series", e);
}
}
}
super.drawPlot(plot, component, componentCanvas);
}else{
logger.warn("data not set, not rendering " + component);
}
}
示例4: formatFilledArea
import de.erichseifert.gral.plots.lines.LineRenderer; //导入方法依赖的package包/类
private static void formatFilledArea(XYPlot plot, DataSource data, Color color) {
PointRenderer point = new DefaultPointRenderer2D();
point.setColor(color);
plot.setPointRenderers(data, point);
LineRenderer line = new DefaultLineRenderer2D();
line.setColor(color);
line.setGap(3.0);
line.setGapRounded(true);
plot.setLineRenderers(data, line);
AreaRenderer area = new DefaultAreaRenderer2D();
area.setColor(GraphicsUtils.deriveWithAlpha(color, 64));
plot.setAreaRenderers(data, area);
}
示例5: DrawableWriterTest
import de.erichseifert.gral.plots.lines.LineRenderer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public DrawableWriterTest() {
DataTable data = new DataTable(Double.class, Double.class, Double.class, Double.class);
data.add(1.0, 4.5, 4.3, 4.0);
data.add(1.5, 5.5, 5.3, 5.0);
data.add(3.0, 3.5, 3.7, 4.0);
data.add(4.0, 4.7, 4.5, 4.3);
DataSeries s1 = new DataSeries(data, 0, 1);
DataSeries s2 = new DataSeries(data, 0, 2);
DataSeries s3 = new DataSeries(data, 0, 3);
plot = new XYPlot(s1, s2, s3);
plot.setInsets(new Insets2D.Double(20, 50, 50, 20));
LineRenderer lr1 = new DefaultLineRenderer2D();
lr1.setColor(Color.RED);
plot.setLineRenderers(s1, lr1);
LineRenderer lr2 = new DefaultLineRenderer2D();
lr2.setColor(Color.GREEN);
plot.setLineRenderers(s2, lr2);
LineRenderer lr3 = new DefaultLineRenderer2D();
lr3.setColor(Color.BLUE);
plot.setLineRenderers(s3, lr3);
}
示例6: DrawableWriterTest
import de.erichseifert.gral.plots.lines.LineRenderer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public DrawableWriterTest() {
data = new DataTable(Double.class, Double.class, Double.class, Double.class);
data.add(1.0, 4.5, 4.3, 4.0);
data.add(1.5, 5.5, 5.3, 5.0);
data.add(3.0, 3.5, 3.7, 4.0);
data.add(4.0, 4.7, 4.5, 4.3);
DataSeries s1 = new DataSeries(data, 0, 1);
DataSeries s2 = new DataSeries(data, 0, 2);
DataSeries s3 = new DataSeries(data, 0, 3);
plot = new XYPlot(s1, s2, s3);
plot.setInsets(new Insets2D.Double(20, 50, 50, 20));
LineRenderer lr1 = new DefaultLineRenderer2D();
lr1.setColor(Color.RED);
plot.setLineRenderer(s1, lr1);
LineRenderer lr2 = new DefaultLineRenderer2D();
lr2.setColor(Color.GREEN);
plot.setLineRenderer(s2, lr2);
LineRenderer lr3 = new DefaultLineRenderer2D();
lr3.setColor(Color.BLUE);
plot.setLineRenderer(s3, lr3);
}
示例7: formatFilledArea
import de.erichseifert.gral.plots.lines.LineRenderer; //导入方法依赖的package包/类
private void formatFilledArea(XYPlot plot, DataSource data, Color color) {
LineRenderer line = new DefaultLineRenderer2D();
line.setColor(color);
line.setGap(3.0);
line.setGapRounded(true);
plot.setLineRenderer(data, line);
AreaRenderer area = new DefaultAreaRenderer2D();
area.setColor(GraphicsUtils.deriveWithAlpha(color, 64));
plot.setAreaRenderer(data, area);
}
示例8: formatFilledArea
import de.erichseifert.gral.plots.lines.LineRenderer; //导入方法依赖的package包/类
private static void formatFilledArea(XYPlot plot, DataSource data, Color color) {
plot.setPointRenderer(data, null);
LineRenderer line = new DefaultLineRenderer2D();
line.setColor(color);
line.setGap(3.0);
line.setGapRounded(true);
plot.setLineRenderer(data, line);
AreaRenderer area = new DefaultAreaRenderer2D();
area.setColor(GraphicsUtils.deriveWithAlpha(color, 64));
plot.setAreaRenderer(data, area);
}
示例9: StackedPlots
import de.erichseifert.gral.plots.lines.LineRenderer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public StackedPlots() {
// Generate data
DataTable data = new DataTable(Double.class, Double.class);
double x=0.0, y=0.0;
for (x=0.0; x<100.0; x+=2.0) {
y += 10.0*random.nextGaussian();
data.add(x, Math.abs(y));
}
// Create and format upper plot
XYPlot plotUpper = new XYPlot(data);
Color colorUpper = COLOR1;
plotUpper.setPointRenderers(data, null);
LineRenderer lineUpper = new DefaultLineRenderer2D();
lineUpper.setColor(colorUpper);
plotUpper.setLineRenderers(data, lineUpper);
AreaRenderer areaUpper = new DefaultAreaRenderer2D();
areaUpper.setColor(GraphicsUtils.deriveWithAlpha(colorUpper, 64));
plotUpper.setAreaRenderers(data, areaUpper);
plotUpper.setInsets(new Insets2D.Double(20.0, 50.0, 40.0, 20.0));
// Create and format lower plot
XYPlot plotLower = new XYPlot(data);
Color colorLower = COLOR1;
PointRenderer pointsLower = plotLower.getPointRenderers(data).get(0);
pointsLower.setColor(colorLower);
pointsLower.setShape(new Ellipse2D.Double(-3, -3, 6, 6));
LineRenderer lineLower = new DefaultLineRenderer2D();
lineLower.setStroke(new BasicStroke(2f));
lineLower.setGap(1.0);
lineLower.setColor(colorLower);
plotLower.setLineRenderers(data, lineLower);
plotLower.setInsets(new Insets2D.Double(20.0, 50.0, 40.0, 20.0));
DrawableContainer plots = new DrawableContainer(new TableLayout(1));
plots.add(plotUpper);
plots.add(plotLower);
// Connect the two plots, i.e. user (mouse) actions affect both plots
plotUpper.getNavigator().connect(plotLower.getNavigator());
InteractivePanel panel = new InteractivePanel(plots);
add(panel);
}
示例10: StackedPlots
import de.erichseifert.gral.plots.lines.LineRenderer; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public StackedPlots() {
// Generate data
DataTable data = new DataTable(Double.class, Double.class);
double x=0.0, y=0.0;
for (x=0.0; x<100.0; x+=2.0) {
y += 10.0*random.nextGaussian();
data.add(x, Math.abs(y));
}
// Create and format upper plot
XYPlot plotUpper = new XYPlot(data);
Color colorUpper = COLOR1;
plotUpper.setPointRenderer(data, null);
LineRenderer lineUpper = new DefaultLineRenderer2D();
lineUpper.setColor(colorUpper);
plotUpper.setLineRenderer(data, lineUpper);
AreaRenderer areaUpper = new DefaultAreaRenderer2D();
areaUpper.setColor(GraphicsUtils.deriveWithAlpha(colorUpper, 64));
plotUpper.setAreaRenderer(data, areaUpper);
plotUpper.setInsets(new Insets2D.Double(20.0, 50.0, 40.0, 20.0));
// Create and format lower plot
XYPlot plotLower = new XYPlot(data);
Color colorLower = COLOR1;
PointRenderer pointsLower = plotLower.getPointRenderer(data);
pointsLower.setColor(colorLower);
pointsLower.setShape(new Ellipse2D.Double(-3, -3, 6, 6));
LineRenderer lineLower = new DefaultLineRenderer2D();
lineLower.setStroke(new BasicStroke(2f));
lineLower.setGap(1.0);
lineLower.setColor(colorLower);
plotLower.setLineRenderer(data, lineLower);
plotLower.setInsets(new Insets2D.Double(20.0, 50.0, 40.0, 20.0));
DrawableContainer plots = new DrawableContainer(new TableLayout(1));
plots.add(plotUpper);
plots.add(plotLower);
// Connect the two plots, i.e. user (mouse) actions affect both plots
plotUpper.getNavigator().connect(plotLower.getNavigator());
InteractivePanel panel = new InteractivePanel(plots);
add(panel);
}