本文整理汇总了Java中org.jfree.chart.renderer.xy.XYLineAndShapeRenderer.setSeriesPaint方法的典型用法代码示例。如果您正苦于以下问题:Java XYLineAndShapeRenderer.setSeriesPaint方法的具体用法?Java XYLineAndShapeRenderer.setSeriesPaint怎么用?Java XYLineAndShapeRenderer.setSeriesPaint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
的用法示例。
在下文中一共展示了XYLineAndShapeRenderer.setSeriesPaint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
private JFreeChart createChart(XYSeriesCollection xySeriesCollection) {
JFreeChart chart = ChartFactory.createXYLineChart(
"PlotDemo",
"X",
"Y",
xySeriesCollection,
PlotOrientation.VERTICAL,
true,
true,
false);
chart.setBackgroundPaint(Color.white);
//...Устанавливаем правила для серий
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setSeriesLinesVisible(2, false);
renderer.setSeriesShapesVisible(1, false);
renderer.setSeriesPaint(0, Color.orange);
renderer.setSeriesPaint(1, Color.red);
renderer.setSeriesPaint(2, Color.blue);
XYPlot plot = chart.getXYPlot();
plot.setOutlinePaint(Color.cyan);
plot.setRenderer(renderer);
return chart;
}
示例2: setMin
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public void setMin(float min)
{
for (int i = 0; i < minData.length; i++)
{
minData[i] = min;
}
XYSeriesCollection minCol = PlotingToolkit
.getCollection(xData, minData, "Min");
XYLineAndShapeRenderer minRender = new XYLineAndShapeRenderer(true,
false);
minRender.setSeriesPaint(0, Color.RED);
previewPlot.getXYPlot().setRenderer(1, minRender);
dataPlot.getXYPlot().setRenderer(1, minRender);
dataPlot.getXYPlot().setDataset(1, minCol);
previewPlot.getXYPlot().setDataset(1, minCol);
}
示例3: TwoHistChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public TwoHistChart(MakamBox obj,MakamBox recObj,boolean withTemplate) throws Exception{
chartSong = obj.getHistogramChart();
chartRec = recObj.getHistogramChart();
chartSong.createOnlyChart(withTemplate);
chartRec.createOnlyChart(false);
renderer = new XYLineAndShapeRenderer();
renderer.setSeriesPaint(0, Color.BLACK);
renderer.setSeriesLinesVisible(0, true);
renderer.setSeriesShapesVisible(0, false);
renderer.setSeriesLinesVisible(1, false);
renderer.setSeriesShapesVisible(1, true);
renderer.setSeriesLinesVisible(2, false);
renderer.setSeriesShapesVisible(2, true);
renderer.setSeriesLinesVisible(3, false);
renderer.setSeriesShapesVisible(3, true);
collectionRec = chartRec.getCollection();
plot = (XYPlot) chartSong.getChart().getPlot();
plot.setDataset(1,collectionRec);
plot.setRenderer(1,renderer);
frameName = "Song Histogram & Record Histogram";
repaint();
}
示例4: createXYLineChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
private static JFreeChart createXYLineChart(String title,String category,String value, XYSeriesCollection dataset) {
JFreeChart mChart = ChartFactory.createXYLineChart(
title,
category,
value,
dataset,
PlotOrientation.VERTICAL,
true,
true,
false);
// ChartPanel chartPanel = new ChartPanel( mChart);
// chartPanel.setPreferredSize( new java.awt.Dimension( 560 , 367 ) );
final XYPlot plot = mChart.getXYPlot();// 获取折线图plot对象
plot.setBackgroundPaint(new Color(240,240,240));
NumberAxis na= (NumberAxis)plot.getRangeAxis();
NumberAxis domainAxis = (NumberAxis)plot.getDomainAxis();
// na.setAutoTickUnitSelection(false);
na.setNumberFormatOverride(df);//设置轴坐标
domainAxis.setNumberFormatOverride(df);
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer( );// 设置样式
renderer.setBaseShapesVisible(false);
renderer.setSeriesPaint(0,Color.RED);
renderer.setSeriesPaint(1,Color.GREEN);
renderer.setSeriesPaint(2,new Color(255,150,24));
renderer.setSeriesPaint(3,new Color(82,101,115));
plot.setRenderer( renderer );
return mChart;
}
示例5: addSerie
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public void addSerie(int indexSerie, Color color, XYSeries localXYSeries){
XYSeriesCollection localXYSeriesCollection = new XYSeriesCollection();
localXYSeriesCollection.addSeries(localXYSeries); //Se aniade la serie
Ellipse2D.Double localDouble = new Ellipse2D.Double(-4.0D, -4.0D, 8.0D, 8.0D); //Forma de la anotacion del punto x,y
XYLineAndShapeRenderer localXYLineAndShapeRenderer = new XYLineAndShapeRenderer();
localXYLineAndShapeRenderer.setSeriesLinesVisible(indexSerie,true); //provoca que se pinten lineas rectas que unen los puntos x,y que conforman la serie
localXYLineAndShapeRenderer.setSeriesShapesVisible(indexSerie,false); //provoca que se pinte la forma asociada al punto x,y
plot.setDataset(indexSerie, localXYSeriesCollection); //Se aniade la serie al plot
plot.setRenderer(indexSerie, localXYLineAndShapeRenderer);
localXYLineAndShapeRenderer.setSeriesShape(indexSerie, new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0));
// localXYLineAndShapeRenderer.setSeriesShape(indexSerie, localDouble);
localXYLineAndShapeRenderer.setSeriesPaint(indexSerie, color);
//localXYLineAndShapeRenderer.setSeriesFillPaint(indexSerie, Color.yellow);
//localXYLineAndShapeRenderer.setSeriesOutlinePaint(indexSerie, Color.gray);
localXYLineAndShapeRenderer.setUseFillPaint(false);//true
localXYLineAndShapeRenderer.setUseOutlinePaint(false);//true
localXYLineAndShapeRenderer.setDrawOutlines(false);
localXYLineAndShapeRenderer.setDrawSeriesLineAsPath(true);
}
示例6: addSerie
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public void addSerie(int indexSerie, Color color, XYSeries localXYSeries){
XYPlot plot=null;
XYSeriesCollection localXYSeriesCollection = new XYSeriesCollection();
localXYSeriesCollection.addSeries(localXYSeries); //Se aniade la serie
Ellipse2D.Double localDouble = new Ellipse2D.Double(-4.0D, -4.0D, 8.0D, 8.0D); //Forma de la anotacion del punto x,y
XYLineAndShapeRenderer localXYLineAndShapeRenderer = new XYLineAndShapeRenderer();
localXYLineAndShapeRenderer.setSeriesLinesVisible(indexSerie,true); //provoca que se pinten lineas rectas que unen los puntos x,y que conforman la serie
localXYLineAndShapeRenderer.setSeriesShapesVisible(indexSerie,false); //provoca que se pinte la forma asociada al punto x,y
plot.setDataset(indexSerie, localXYSeriesCollection); //Se aniade la serie al plot
plot.setRenderer(indexSerie, localXYLineAndShapeRenderer);
localXYLineAndShapeRenderer.setSeriesShape(indexSerie, new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0));
// localXYLineAndShapeRenderer.setSeriesShape(indexSerie, localDouble);
localXYLineAndShapeRenderer.setSeriesPaint(indexSerie, color);
//localXYLineAndShapeRenderer.setSeriesFillPaint(indexSerie, Color.yellow);
//localXYLineAndShapeRenderer.setSeriesOutlinePaint(indexSerie, Color.gray);
localXYLineAndShapeRenderer.setUseFillPaint(false);//true
localXYLineAndShapeRenderer.setUseOutlinePaint(false);//true
localXYLineAndShapeRenderer.setDrawOutlines(false);
localXYLineAndShapeRenderer.setDrawSeriesLineAsPath(true);
}
示例7: editRenderer
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
/**
* Edit the parameters in the renderer
* @param i
* @param dotSize
* @param p
*/
public void editRenderer(int i, int dotSize, Paint p, boolean drawLines, boolean drawShapes){
XYLineAndShapeRenderer rend = renderers.get(i);
rend.setSeriesPaint(0, p);
rend.setSeriesShape(0, new Ellipse2D.Double(0, 0, dotSize, dotSize));
rend.setSeriesStroke(0, new BasicStroke(2));
rend.setSeriesLinesVisible(0, drawLines);
rend.setSeriesShapesVisible(0, drawShapes);
}
示例8: OrderParameterVsRandomnessChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public OrderParameterVsRandomnessChart( int maxItemCount ) {
this.maxItemCount = maxItemCount;
meanSeries = new XYSeries( "Raw Data" );
lineSeries = new XYSeries( "Mean Values" );
xySeriesCollection = new XYSeriesCollection( meanSeries );
xySeriesCollection.addSeries( lineSeries );
domainAxis = new NumberAxis( "Randomness" );
rangeAxis = new NumberAxis( "Order Parameter" );
renderer = new XYLineAndShapeRenderer();
int RAW_DATA_SERIES = 0;
int LINE_SERIES = 1;
renderer.setSeriesShape( RAW_DATA_SERIES, new Ellipse2D.Double( -3, -3, 6, 6 ) );
renderer.setSeriesShape( LINE_SERIES, new Rectangle( -4, -4, 8, 8 ) );
renderer.setSeriesLinesVisible( RAW_DATA_SERIES, false );
renderer.setSeriesShapesVisible( RAW_DATA_SERIES, true );
Color blue = new Color( 0, 0, 255, 14 );
renderer.setSeriesPaint( RAW_DATA_SERIES, blue );
renderer.setSeriesItemLabelPaint( RAW_DATA_SERIES, blue );
renderer.setSeriesOutlinePaint( RAW_DATA_SERIES, blue );
renderer.setSeriesLinesVisible( LINE_SERIES, true );
xyPlot = new XYPlot( xySeriesCollection,
domainAxis,
rangeAxis, renderer );
chart = new JFreeChart( "Order Parameter vs. Randomness", xyPlot );
rangeAxis.setRange( -0.01, 1.01 );
domainAxis.setAutoRange( false );
domainAxis.setRange( 0 - 0.01, Math.PI * 2 + 0.01 );
}
示例9: createScatterChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
@Override
protected JFreeChart createScatterChart() throws JRException
{
JFreeChart jfreeChart = super.createScatterChart();
XYPlot xyPlot = (XYPlot) jfreeChart.getPlot();
xyPlot.setRangeGridlinePaint(SCATTER_GRIDLINE_COLOR);
xyPlot.setRangeGridlineStroke(new BasicStroke(0.75f));
xyPlot.setDomainGridlinesVisible(true);
xyPlot.setDomainGridlinePaint(SCATTER_GRIDLINE_COLOR);
xyPlot.setDomainGridlineStroke(new BasicStroke(0.75f));
xyPlot.setRangeZeroBaselinePaint(ChartThemesConstants.GRAY_PAINT_134);
XYLineAndShapeRenderer lineRenderer = (XYLineAndShapeRenderer)xyPlot.getRenderer();
lineRenderer.setUseFillPaint(true);
JRScatterPlot scatterPlot = (JRScatterPlot) getPlot();
boolean isShowLines = scatterPlot.getShowLines() == null ? false : scatterPlot.getShowLines().booleanValue();
lineRenderer.setBaseLinesVisible(isShowLines);
XYDataset xyDataset = xyPlot.getDataset();
if (xyDataset != null)
{
for (int i = 0; i < xyDataset.getSeriesCount(); i++)
{
lineRenderer.setSeriesOutlinePaint(i, ChartThemesConstants.TRANSPARENT_PAINT);
lineRenderer.setSeriesFillPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i));
lineRenderer.setSeriesPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_COLORS.get(i));
//lineRenderer.setSeriesShape(i, new Ellipse2D.Double(-3, -3, 6, 6));
}
}
return jfreeChart;
}
示例10: TimeSeriesViewObserver
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
/**
* 构造分时图的全部元素
*/
public TimeSeriesViewObserver() {
timeSeriesPrice = new TimeSeries("分时图", Hour.class);
timeSeriesPrice.add(new Hour(count++, day), StockSubject.OPENING_PRICE);
timeSeriesPrice.setMaximumItemAge(MAXIMUM_ITEM_AGE);
TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
timeseriescollection.addSeries(timeSeriesPrice);
DateAxis dateaxis = new DateAxis("时间");
NumberAxis numberaxis = new NumberAxis("股票价格");
dateaxis.setTickLabelFont(new Font("微软雅黑", 0, 12));
numberaxis.setTickLabelFont(new Font("微软雅黑", 0, 12));
dateaxis.setLabelFont(new Font("微软雅黑", 0, 12));
numberaxis.setLabelFont(new Font("微软雅黑", 0, 12));
XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(true, false);
xylineandshaperenderer.setSeriesPaint(0, Color.red);
xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(1F, 0, 1));
XYPlot xyplot = new XYPlot(timeseriescollection, dateaxis, numberaxis, xylineandshaperenderer);
xyplot.setAxisOffset(new RectangleInsets(0D, 0D, 0D, 0D));
dateaxis.setAutoRange(true);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
dateaxis.setTickLabelsVisible(true);
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
JFreeChart chart = new JFreeChart("中国铁通股票", new Font("微软雅黑", 1, 12), xyplot, true);
chartPanel = new ChartPanel(chart);
}
示例11: setCommaAxis
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public void setCommaAxis(){
frameName = "Histogram Data with Intervals";
chart = ChartFactory.createXYLineChart(
histName, // chart title
"Intervals (Holderian Comma)", // x axis label
"Frequency of Occurence", // y axis label
createDataset2(cent,data), // data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
true ); // urls
plot = (XYPlot) chart.getPlot();
renderer = new XYLineAndShapeRenderer();
renderer.setSeriesLinesVisible(0, true);
renderer.setSeriesShapesVisible(0, false);
renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesPaint(1, Color.BLACK);
grids = new BasicStroke(1.0f,BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 100.0f, new float[] {10f}, 1.0f);
plot.setDomainGridlinesVisible(true);
plot.setDomainGridlinePaint(Color.BLUE);
plot.setDomainGridlineStroke(grids);
plot.setRenderer(renderer);
panel = new ChartPanel(chart,true);
panel.setRangeZoomable(false);
panel.setVisible(true);
contentPanel.removeAll();
contentPanel.add(panel);
setVisible(true);
repaint();
pack();
}
示例12: updatePlotPanel
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public void updatePlotPanel()
{
// Chack data size of
int length = getDataLength();
if (xData.length != length)
{
xData = new float[length];
}
if (aScan.length != length)
{
aScan = new float[length];
}
// Update X Range
float[] range = xRange;
for (int i = 0; i < xData.length; i++)
{
xData[i] = (range[0] + (range[1] - range[0])
* (i / (xData.length - 1)));
}
updateAScan();
XYSeriesCollection datCol1 = PlotingToolkit
.getCollection(xData, aScan, "Data");
XYLineAndShapeRenderer dataRender1 = new XYLineAndShapeRenderer(true,
false);
dataRender1.setSeriesPaint(0, Color.CYAN);
dataPlot.getXYPlot().setRenderer(0, dataRender1);
dataPlot.getXYPlot().setDataset(0, datCol1);
}
示例13: createFrame
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public void createFrame() {
frameName = "Histogram Data with Intervals";
chart = ChartFactory.createXYLineChart(
histName, // chart title
"Intervals (Cent)", // x axis label
"Frequency of Occurence", // y axis label
createDataset(cent,data), // data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
true // urls
);
plot = (XYPlot) chart.getPlot();
renderer = new XYLineAndShapeRenderer();
renderer.setSeriesLinesVisible(0, true);
renderer.setSeriesShapesVisible(0, false);
renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesPaint(1, Color.BLACK);
grids = new BasicStroke(1.0f,BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 100.0f, new float[] {10f}, 1.0f);
plot.setDomainGridlinesVisible(true);
plot.setDomainGridlinePaint(Color.BLUE);
plot.setDomainGridlineStroke(grids);
plot.setRenderer(renderer);
panel = new ChartPanel(chart,true);
panel.setRangeZoomable(false);
panel.setVisible(true);
contentPanel.removeAll();
contentPanel.add(panel);
setVisible(true);
repaint();
pack();
}
示例14: createOnlyChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public void createOnlyChart(boolean withTemplate){
chart = ChartFactory.createXYLineChart(
histName, // chart title
"Frequency", // x axis label
"Frequency of Occuarence", // y axis label
createDataset(freq,data,withTemplate), // data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
true // urls
);
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setSeriesLinesVisible(0, true);
renderer.setSeriesShapesVisible(0, false);
renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesLinesVisible(1, false);
renderer.setSeriesShapesVisible(1, true);
renderer.setSeriesPaint(1, Color.BLACK);
renderer.setSeriesLinesVisible(2, false);
renderer.setSeriesShapesVisible(2, true);
renderer.setSeriesPaint(2, Color.BLACK);
renderer.setSeriesLinesVisible(3, true);
renderer.setSeriesShapesVisible(3, false);
renderer.setSeriesPaint(3, Color.BLUE);
plot = (XYPlot) chart.getPlot();
plot.setRenderer(renderer);
}
示例15: createOnlyChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public void createOnlyChart(boolean withTemplate){
chart = ChartFactory.createXYLineChart(
histName, // chart title
"Intervals (Cent)", // x axis label
"Frequency of Occuarence", // y axis label
createDataset(cent,songData,withTemplate), // data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
true // urls
);
renderer = new XYLineAndShapeRenderer();
renderer.setSeriesLinesVisible(0, true);
renderer.setSeriesShapesVisible(0, false);
renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesLinesVisible(1, true);
renderer.setSeriesShapesVisible(1, false);
renderer.setSeriesPaint(1, Color.BLACK);
renderer.setSeriesLinesVisible(2, false);
renderer.setSeriesShapesVisible(2, true);
renderer.setSeriesPaint(2, Color.BLUE);
renderer.setSeriesLinesVisible(3, true);
renderer.setSeriesShapesVisible(3, false);
renderer.setSeriesPaint(3, Color.BLUE);
plot = (XYPlot) chart.getPlot();
plot.setRenderer(renderer);
}