本文整理匯總了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);
}