Java 类org.jfree.chart.plot.SeriesRenderingOrder 实例源码

项目:flink-perf    文件:KafkaFT.java   
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;
}
项目:mzmine2    文件:HistogramChart.java   
public HistogramChart() {

    super(null, true);

    // initialize the chart by default time series chart from factory
    chart = ChartFactory.createHistogram("", // title
        "", // x-axis label
        "", // y-axis label
        null, // data set
        PlotOrientation.VERTICAL, // orientation
        true, // create legend
        false, // generate tooltips
        false // generate URLs
        );

    // title
    chartTitle = chart.getTitle();
    chartTitle.setFont(titleFont);
    chartTitle.setMargin(5, 0, 0, 0);

    chartSubTitle = new TextTitle();
    chartSubTitle.setFont(subTitleFont);
    chartSubTitle.setMargin(5, 0, 0, 0);
    chart.addSubtitle(chartSubTitle);

    // legend constructed by ChartFactory
    LegendTitle legend = chart.getLegend();
    legend.setItemFont(legendFont);
    legend.setFrame(BlockBorder.NONE);

    chart.setBackgroundPaint(Color.white);
    setChart(chart);

    // disable maximum size (we don't want scaling)
    setMaximumDrawWidth(Integer.MAX_VALUE);
    setMaximumDrawHeight(Integer.MAX_VALUE);

    // 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.REVERSE);
    plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);

    // set grid properties
    plot.setDomainGridlinePaint(gridColor);
    plot.setRangeGridlinePaint(gridColor);

    // set crosshair (selection) properties
    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(true);

    // set the logarithmic axis
    NumberAxis axisDomain = new HistogramDomainAxis();
    axisDomain.setMinorTickCount(1);
    axisDomain.setAutoRange(true);

    NumberAxis axisRange = new NumberAxis();
    axisRange.setMinorTickCount(1);
    axisRange.setAutoRange(true);

    plot.setDomainAxis(axisDomain);
    plot.setRangeAxis(axisRange);

    ClusteredXYBarRenderer renderer = new ClusteredXYBarRenderer();
    renderer.setMargin(marginSize);
    renderer.setShadowVisible(false);
    plot.setRenderer(renderer);

    this.setMinimumSize(new Dimension(400, 400));
    this.setDismissDelay(Integer.MAX_VALUE);
    this.setInitialDelay(0);

    }
项目:mafscaling    文件:MafRescale.java   
private void createGraghPanel(JPanel dataPanel) {
    JFreeChart chart = ChartFactory.createScatterPlot(null, null, null, null, PlotOrientation.VERTICAL, false, true, false);
    chart.setBorderVisible(true);
    mafChartPanel = new MafChartPanel(chart, this);

    GridBagConstraints gbl_chartPanel = new GridBagConstraints();
    gbl_chartPanel.anchor = GridBagConstraints.PAGE_START;
    gbl_chartPanel.insets = insets0;
    gbl_chartPanel.fill = GridBagConstraints.BOTH;
    gbl_chartPanel.weightx = 1.0;
    gbl_chartPanel.weighty = 1.0;
    gbl_chartPanel.gridx = 0;
    gbl_chartPanel.gridy = 2;
    dataPanel.add(mafChartPanel.getChartPanel(), gbl_chartPanel);

    XYSplineRenderer lineRenderer = new XYSplineRenderer(3);
    lineRenderer.setUseFillPaint(true);
    lineRenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator( 
            StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT, 
            new DecimalFormat("0.00"), new DecimalFormat("0.00")));

    Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, null, 0.0f);
    lineRenderer.setSeriesStroke(0, stroke);
    lineRenderer.setSeriesStroke(1, stroke);
    lineRenderer.setSeriesPaint(0, new Color(201, 0, 0));
    lineRenderer.setSeriesPaint(1, new Color(0, 0, 255));
    lineRenderer.setSeriesShape(0, ShapeUtilities.createDiamond((float) 2.5));
    lineRenderer.setSeriesShape(1, ShapeUtilities.createUpTriangle((float) 2.5));

    ValueAxis mafvDomain = new NumberAxis(XAxisName);
    ValueAxis mafgsRange = new NumberAxis(YAxisName);

    XYSeriesCollection lineDataset = new XYSeriesCollection();

    lineDataset.addSeries(currMafData);
    lineDataset.addSeries(corrMafData);

    XYPlot plot = chart.getXYPlot();
    plot.setRangePannable(true);
    plot.setDomainPannable(true);
    plot.setDomainGridlinePaint(Color.DARK_GRAY);
    plot.setRangeGridlinePaint(Color.DARK_GRAY);
    plot.setBackgroundPaint(new Color(224, 224, 224));
    plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);

    plot.setDataset(0, lineDataset);
    plot.setRenderer(0, lineRenderer);
    plot.setDomainAxis(0, mafvDomain);
    plot.setRangeAxis(0, mafgsRange);
    plot.mapDatasetToDomainAxis(0, 0);
    plot.mapDatasetToRangeAxis(0, 0);


    LegendTitle legend = new LegendTitle(plot.getRenderer()); 
    legend.setItemFont(new Font("Arial", 0, 10));
    legend.setPosition(RectangleEdge.TOP);
    chart.addLegend(legend);
}