本文整理汇总了Java中org.jfree.chart.renderer.xy.XYLineAndShapeRenderer.setSeriesShape方法的典型用法代码示例。如果您正苦于以下问题:Java XYLineAndShapeRenderer.setSeriesShape方法的具体用法?Java XYLineAndShapeRenderer.setSeriesShape怎么用?Java XYLineAndShapeRenderer.setSeriesShape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
的用法示例。
在下文中一共展示了XYLineAndShapeRenderer.setSeriesShape方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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 );
}
示例5: setLineStyle
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
/**
* This method specifies shape of markers and line width.
* It is intended for advanced users, who are familiar with Java2D API.
*
* @param lineIndex index specifying the line. Indices are assigned to
* lines in the same order as they were added to chart. Use jPlot.LAST_IDX
* to refer to the last line added.
* @param marker shape drawn at point positions, for example new
* Rectangle2D.Double(-4, -4, 8, 8). May also be null, to keep
* the existing shape.
* @param lineWidth line width
* @param style specifies lenghts of dashes and spaces, for example new
* float[]{1, 10, 5, 5}
*/
public void setLineStyle(int lineIndex,
Shape marker,
int lineWidth,
float[] style) {
XYPlot plot = m_chart.getXYPlot();
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
lineIndex = getLastIndex(lineIndex);
if (marker != null) {
renderer.setSeriesShape(lineIndex, marker);
if (style == null) { // no line, draw only markers
/* float dashPhase = 0;
Stroke stroke = new BasicStroke(lineWidth,
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND,
2,
null,
dashPhase);
renderer.setSeriesStroke(lineIndex, stroke);
*/
setLineVisibility(lineIndex, false, true);
} else {
setLineVisibility(lineIndex, true, true); // show line and markers
}
}
if (style != null) {
float dashPhase = 0;
Stroke stroke = new BasicStroke(lineWidth,
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND,
2,
style,
dashPhase);
renderer.setSeriesStroke(lineIndex, stroke);
}
}
示例6: configureXYLineAndShapeRenderer
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
private static void configureXYLineAndShapeRenderer(XYLineAndShapeRenderer renderer, ValueSource valueSource,
PlotInstance plotInstance) {
renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
SeriesFormat seriesFormat = valueSource.getSeriesFormat();
DimensionConfig domainConfig = valueSource.getDomainConfig();
DimensionConfig colorDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(
PlotDimension.COLOR);
DimensionConfig shapeDimensionConfig = plotInstance.getCurrentPlotConfigurationClone().getDimensionConfig(
PlotDimension.SHAPE);
ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource);
int seriesCount = valueSourceData.getSeriesDataForAllGroupCells().groupCellCount();
// Loop all series and set series format.
// Format based on dimension configs will be set later on in initFormatDelegate().
for (int seriesIdx = 0; seriesIdx < seriesCount; ++seriesIdx) {
// configure linestyle
if (seriesFormat.getLineStyle() == LineStyle.NONE) {
renderer.setSeriesLinesVisible(seriesIdx, false);
} else {
renderer.setSeriesLinesVisible(seriesIdx, true);
renderer.setSeriesStroke(seriesIdx, seriesFormat.getStroke(), false);
}
// configure series shape if necessary
if (!SeriesFormat.calculateIndividualFormatForEachItem(domainConfig, shapeDimensionConfig)) {
if (seriesFormat.getItemShape() != ItemShape.NONE) {
renderer.setSeriesShapesVisible(seriesIdx, true);
renderer.setSeriesShape(seriesIdx, seriesFormat.getItemShape().getShape());
} else {
renderer.setSeriesShapesVisible(seriesIdx, false);
}
}
// configure series color if necessary
if (!SeriesFormat.calculateIndividualFormatForEachItem(domainConfig, colorDimensionConfig)) {
Color itemColor = seriesFormat.getItemColor();
renderer.setSeriesPaint(seriesIdx, itemColor);
renderer.setSeriesFillPaint(seriesIdx, itemColor);
}
renderer.setSeriesOutlinePaint(seriesIdx, PlotConfiguration.DEFAULT_SERIES_OUTLINE_PAINT);
renderer.setUseOutlinePaint(true);
}
}
示例7: GraphGenerator
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public GraphGenerator(final String title, AthenaFeatures athenaFeatures, String feature) {
super(title);
this.feature = feature;
final XYDataset dataset = createDatasetFromFeatureData(athenaFeatures, feature);
final JFreeChart chart = createChart(dataset);
chart.setTitle("");
LegendTitle legend = (LegendTitle) chart.getLegend();
chart.removeLegend();
Font nwfont = new Font("Arial",1,12);
legend.setItemFont(nwfont);
legend.setPosition(RectangleEdge.TOP);
// legend.setWidth(200);
legend.setItemLabelPadding(new RectangleInsets(3, 3, 3, 3));
legend.setHeight(10);
// legend.setPadding(new RectangleInsets(10, 10, 10, 10));
XYTitleAnnotation ta = new XYTitleAnnotation(0.99, 0.98, legend, RectangleAnchor.TOP_RIGHT);
ta.setMaxWidth(0.95);
// chart.addLegend(legend);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setBackgroundPaint(Color.white);
plot.setDomainZeroBaselinePaint(Color.gray);
plot.setDomainGridlinePaint(Color.gray);
plot.setDomainGridlineStroke(new BasicStroke(0.7f));
plot.setRangeGridlinePaint(Color.gray);
plot.setRangeGridlineStroke(new BasicStroke(0.7f));
plot.setDomainMinorGridlinePaint(Color.black);
plot.addAnnotation(ta);
final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setSeriesPaint(0, Color.black);
renderer.setSeriesShape(0, ShapeUtilities.createDiamond(5));
renderer.setSeriesPaint(1, Color.red);
renderer.setSeriesShape(1, ShapeUtilities.createUpTriangle(5));
renderer.setSeriesPaint(2, Color.blue);
Shape shape = new Ellipse2D.Double(-5.0,-5.0,10,10);
renderer.setSeriesShape(2, shape);
renderer.setShapesFilled(false);
// renderer.setSeriesShapesVisible(1, false);
//apply theme
// StandardChartTheme.createJFreeTheme().apply(chart);
plot.setRenderer(renderer);
NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
yAxis.setLabel(feature + " (K)");
yAxis.setAxisLineVisible(false);
yAxis.setTickUnit(new NumberTickUnit(50000));
yAxis.setNumberFormatOverride(new ByteFormat());
yAxis.setRange(new Range(0, 160000));
plot.getRenderer().setBaseItemLabelsVisible(true);
DateAxis xAxis = (DateAxis) plot.getDomainAxis();
xAxis.setAxisLineVisible(false);
xAxis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss"));
xAxis.setTickUnit(new DateTickUnit(DateTickUnit.MINUTE, 3));
xAxis.setLabelFont(new Font("Arial",1,12));
final ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(631, 381));
chartPanel.setMouseZoomable(true, true);
setContentPane(chartPanel);
try {
ChartUtilities.saveChartAsPNG(new File("result.png"), chart, 631, 381);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例8: BetaChart
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public BetaChart( int maxItemCount ) {
this.maxItemCount = maxItemCount;
meanSeries = new XYSeries( "Raw Data" );
lineSeries = new XYSeries( "Mean Values" );
bestFitSeries = new XYSeries( "Best Fit" );
xySeriesCollection = new XYSeriesCollection( meanSeries );
xySeriesCollection.addSeries( lineSeries );
xySeriesCollection.addSeries( bestFitSeries );
domainAxis = new NumberAxis( "ln[(c-r)/c]" );
rangeAxis = new NumberAxis( "ln(Order Parameter)" );
renderer = new XYLineAndShapeRenderer();
int RAW_DATA_SERIES = 0;
int LINE_SERIES = 1;
int BEST_FIT_SERIES = 2;
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 );
renderer.setSeriesLinesVisible( BEST_FIT_SERIES, true );
renderer.setSeriesShapesVisible( BEST_FIT_SERIES, false );
renderer.setSeriesStroke( BEST_FIT_SERIES, new BasicStroke( 2 ) );
renderer.setSeriesPaint( BEST_FIT_SERIES, Color.green );
xyPlot = new XYPlot( xySeriesCollection,
domainAxis,
rangeAxis, renderer );
chart = new JFreeChart( "Critical Exponent Log Plot", xyPlot );
rangeAxis.setAutoRange( true );
rangeAxis.setAutoRangeIncludesZero( false );
domainAxis.setAutoRange( true );
domainAxis.setAutoRangeIncludesZero( false );
}
示例9: AlignmentRansacPlot
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public AlignmentRansacPlot() {
super(null, true);
dataset = new XYSeriesCollection();
chart = ChartFactory.createXYLineChart("", null, null, dataset,
PlotOrientation.VERTICAL, true, true, false);
chart.setBackgroundPaint(Color.white);
setChart(chart);
// title
chartTitle = chart.getTitle();
chartTitle.setMargin(5, 0, 0, 0);
chartTitle.setFont(titleFont);
// legend constructed by ChartFactory
legend = chart.getLegend();
legend.setItemFont(legendFont);
legend.setFrame(BlockBorder.NONE);
// set the plot properties
plot = chart.getXYPlot();
plot.setBackgroundPaint(Color.white);
plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
// set grid properties
plot.setDomainGridlinePaint(gridColor);
plot.setRangeGridlinePaint(gridColor);
// set crosshair (selection) properties
plot.setDomainCrosshairVisible(true);
plot.setRangeCrosshairVisible(true);
plot.setDomainCrosshairPaint(crossHairColor);
plot.setRangeCrosshairPaint(crossHairColor);
plot.setDomainCrosshairStroke(crossHairStroke);
plot.setRangeCrosshairStroke(crossHairStroke);
// set default renderer properties
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setDefaultLinesVisible(false);
renderer.setDefaultShapesVisible(true);
renderer.setSeriesShape(0, dataPointsShape);
renderer.setSeriesShape(1, dataPointsShape);
renderer.setSeriesLinesVisible(2, true);
renderer.setSeriesShapesVisible(2, false);
renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesPaint(1, Color.GRAY);
renderer.setSeriesPaint(2, Color.BLUE);
renderer.setDefaultItemLabelPaint(labelsColor);
renderer.setDrawSeriesLineAsPath(true);
plot.setRenderer(renderer);
}
示例10: updateGraph
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
void updateGraph(){
//System.out.println("UpdateGraph get called")
calculate();
XYSeriesCollection ds = createDataset();
JFreeChart chart = ChartFactory.createXYLineChart(
title, // chart title
xAxis, // x axis label
yAxis, // y axis label
ds, // data
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
false // urls
);
chart.setBackgroundPaint(Color.white);
XYPlot subplot1 = (XYPlot) chart.getPlot();
XYLineAndShapeRenderer renderer1
= (XYLineAndShapeRenderer) subplot1.getRenderer();
renderer1.setSeriesPaint(0, Color.red);
renderer1.setSeriesPaint(1, Color.blue);
Shape shape = renderer1.getBaseShape();
renderer1.setSeriesShape(2, shape);
renderer1.setSeriesShape(3, shape);
renderer1.setBaseLinesVisible(true);
renderer1.setBaseShapesVisible(true);
renderer1.setBaseShapesFilled(true);
renderer1.setSeriesShapesVisible(0, false);
NumberAxis rangeAxis = (NumberAxis)subplot1.getRangeAxis();
rangeAxis.setAutoRangeIncludesZero(false);
chartPanel = new ChartPanel(chart, false);
chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X,CHART_SIZE_Y));
upContainer= new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(leftPanel), new JScrollPane(chartPanel));
this.getMainPanel().removeAll();
this.getMainPanel().add(new JScrollPane(upContainer), BorderLayout.CENTER);
this.getMainPanel().validate();
// getRecordTable().setText("Any Explaination goes here.");
//
}
示例11: resetUI
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
/**
* Resets the display.
*/
@Override
void resetUI() {
super.resetUI();
XYPlot xyPlot = mChart.getXYPlot();
XYBarRenderer br = new XYBarRenderer();
mDatasetsSync = new TimePeriodValues[NUM_AUTHS];
@SuppressWarnings("unchecked")
List<String> mTooltipsSyncTmp[] = new List[NUM_AUTHS];
mTooltipsSync = mTooltipsSyncTmp;
mTooltipGenerators = new CustomXYToolTipGenerator[NUM_AUTHS];
TimePeriodValuesCollection tpvc = new TimePeriodValuesCollection();
xyPlot.setDataset(tpvc);
xyPlot.setRenderer(0, br);
XYLineAndShapeRenderer ls = new XYLineAndShapeRenderer();
ls.setBaseLinesVisible(false);
mDatasetsSyncTickle = new TimeSeries[NUM_AUTHS];
TimeSeriesCollection tsc = new TimeSeriesCollection();
xyPlot.setDataset(1, tsc);
xyPlot.setRenderer(1, ls);
mDatasetError = new TimeSeries("Errors", FixedMillisecond.class);
xyPlot.setDataset(2, new TimeSeriesCollection(mDatasetError));
XYLineAndShapeRenderer errls = new XYLineAndShapeRenderer();
errls.setBaseLinesVisible(false);
errls.setSeriesPaint(0, Color.RED);
xyPlot.setRenderer(2, errls);
for (int i = 0; i < NUM_AUTHS; i++) {
br.setSeriesPaint(i, AUTH_COLORS[i]);
ls.setSeriesPaint(i, AUTH_COLORS[i]);
mDatasetsSync[i] = new TimePeriodValues(AUTH_NAMES[i]);
tpvc.addSeries(mDatasetsSync[i]);
mTooltipsSync[i] = new ArrayList<String>();
mTooltipGenerators[i] = new CustomXYToolTipGenerator();
br.setSeriesToolTipGenerator(i, mTooltipGenerators[i]);
mTooltipGenerators[i].addToolTipSeries(mTooltipsSync[i]);
mDatasetsSyncTickle[i] = new TimeSeries(AUTH_NAMES[i] + " tickle",
FixedMillisecond.class);
tsc.addSeries(mDatasetsSyncTickle[i]);
ls.setSeriesShape(i, ShapeUtilities.createUpTriangle(2.5f));
}
}
示例12: createFrame
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public void createFrame() {
String frameName = LANG.getString("MakamChart.mhcomparison.text"); // Makam - Eser Histogram Karşılaştırması
JFreeChart chart = ChartFactory.createXYLineChart(
frameName, // chart title
LANG.getString("MakamChart.intervalsCent.text"), // x axis label Frekans (Cent)
LANG.getString("MakamChart.occurrence.text"), // y axis label Çalınma Sıklığı
createMultiple(datas.length),
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
true // urls
);
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setBaseShapesVisible(false);
renderer.setBaseLinesVisible(true);
XYPlot plot = (XYPlot) chart.getPlot();
if(euroTheory){
BasicStroke 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);
}
if(!(system==null)){
for (int i = 0; i < system.getSeriesCount(); i++) {
tempResult.addSeries(system.getSeries(i));
renderer.setSeriesShape(count+i, new Ellipse2D.Double(-3,0,6,6));
renderer.setSeriesLinesVisible(count+i, false);
renderer.setSeriesShapesVisible(count+i, true);
for (int j = 1; j < sysAnnotation.length; j++) {
plot.addAnnotation(sysAnnotation[j]);
}
}
}
if(!(annotation==null)){
for (int i = 1; i < annotation.length; i++) {
plot.addAnnotation(annotation[i]);
}
}
if(LANG.equals(ResourceBundle.getBundle("applied.language_tr"))){
plot.setBackgroundPaint(Color.WHITE);
}
plot.setRenderer(renderer);
ChartPanel frame = new ChartPanel(chart, true);
frame.setRangeZoomable(false);
contentPanel.removeAll();
contentPanel.add(frame);
setVisible(true);
repaint();
pack();
}
示例13: createFrame2
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public void createFrame2() {
String frameName = LANG.getString("MakamChart.mhcomparison.text"); // Makam - Eser Histogram Karşılaştırması
JFreeChart chart = ChartFactory.createXYLineChart(
frameName, // chart title
LANG.getString("MakamChart.intervalsComma.text"), // x axis label Aralik (Holder Koma)
LANG.getString("MakamChart.occurrence.text"), // y axis label Çalınma Sıklığı
createMultiple2(datas.length),
PlotOrientation.VERTICAL,
true, // include legend
true, // tooltips
true // urls
);
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setBaseShapesVisible(false);
renderer.setBaseLinesVisible(true);
XYPlot plot = (XYPlot) chart.getPlot();
if(euroTheory){
BasicStroke 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);
}
if(!(system==null)){
for (int i = 0; i < system.getSeriesCount(); i++) {
tempResult.addSeries(system.getSeries(i));
renderer.setSeriesShape(count+i, new Ellipse2D.Double(-3,0,6,6));
renderer.setSeriesLinesVisible(count+i, false);
renderer.setSeriesShapesVisible(count+i, true);
for (int j = 1; j < sysAnnotation.length; j++) {
plot.addAnnotation(sysAnnotation[j]);
}
}
}
if(!(annotation==null)){
for (int i = 1; i < annotation.length; i++) {
plot.addAnnotation(annotation[i]);
}
}
if(LANG.equals(ResourceBundle.getBundle("applied.language_tr"))){
plot.setBackgroundPaint(Color.WHITE);
}
plot.setRenderer(renderer);
plot.getDomainAxis().setRange(-200, 200);
ChartPanel frame = new ChartPanel(chart, true);
frame.setRangeZoomable(false);
contentPanel.removeAll();
contentPanel.add(frame);
setVisible(true);
repaint();
pack();
}
示例14: createGraph
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; //导入方法依赖的package包/类
public static void createGraph(String toDir, Paint bgColor, String title, String XAxisLabel, String YAxisLabel, List<Double> xData ,List<Double> yData)
{
JFreeChart chart;
ScenarioPlotTool plotter = new ScenarioPlotTool();
try
{
XYSeriesCollection dataSet = new XYSeriesCollection();
chart = ChartFactory.createXYLineChart(
title , // chart title
XAxisLabel, // x axis label
YAxisLabel, // y axis label
dataSet, // data
PlotOrientation.VERTICAL, // orientation
true, // include legend
true, // tooltips
false // urls
);
XYPlot plot = (XYPlot) chart.getPlot();
XYLineAndShapeRenderer r = new XYLineAndShapeRenderer();
plot.setRenderer(r);
plotter.formatXYPlot(chart, Color.white);
// Set up the line to plot
BasicStroke wideLine = new BasicStroke( ScenarioPlotTool.lineWidth );
r.setSeriesStroke(0, wideLine);
r.setSeriesLinesVisible(0, true);
r.setSeriesShapesVisible(0, false);
dataSet.addSeries(plotter.createTruncatedXYSeries(title,xData,yData));
// Pull out our max and mins
List<Double> xMin = new ArrayList<Double>();
List<Double> yMin = new ArrayList<Double>();
List<Double> xMax = new ArrayList<Double>();
List<Double> yMax = new ArrayList<Double>();
WaveformUtils.getPeriodBounds(xData, yData, xMin, yMin, xMax, yMax);
// Let's put some shapes over the max's and min's
XYSeries seriesMaxes = new XYSeries("Max");
r.setSeriesLinesVisible(1, false);
r.setSeriesShapesVisible(1, true);
r.setSeriesPaint(1, Color.green);
Shape maxShape = ShapeUtilities.createUpTriangle(10);
r.setSeriesShape(1, maxShape);
for(int i=0; i<xMax.size(); i++)
seriesMaxes.add(xMax.get(i),yMax.get(i));
dataSet.addSeries(seriesMaxes);
XYSeries seriesMins = new XYSeries("Min");
r.setSeriesLinesVisible(2, false);
r.setSeriesShapesVisible(2, true);
r.setSeriesPaint(2, Color.red);
Shape minShape = ShapeUtilities.createDownTriangle(10);
r.setSeriesShape(2, minShape);
for(int i=0; i<xMin.size(); i++)
seriesMins.add(xMin.get(i),yMin.get(i));
dataSet.addSeries(seriesMins);
}
catch(Exception ex)
{
Log.error("Unable to make base chart");
return;
}
// Now let's mark all the max and min values
try
{
if(toDir==null||toDir.isEmpty())
toDir=".";
File JPGFile = new File(toDir+"/"+StringUtils.removeParens(title)+".jpg");
ChartUtilities.saveChartAsJPEG(JPGFile, chart, 3200, 1600);
}
catch (IOException e)
{
Log.error(e.getMessage());
}
}