當前位置: 首頁>>代碼示例>>Java>>正文


Java XYBarRenderer.setBaseToolTipGenerator方法代碼示例

本文整理匯總了Java中org.jfree.chart.renderer.xy.XYBarRenderer.setBaseToolTipGenerator方法的典型用法代碼示例。如果您正苦於以下問題:Java XYBarRenderer.setBaseToolTipGenerator方法的具體用法?Java XYBarRenderer.setBaseToolTipGenerator怎麽用?Java XYBarRenderer.setBaseToolTipGenerator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.chart.renderer.xy.XYBarRenderer的用法示例。


在下文中一共展示了XYBarRenderer.setBaseToolTipGenerator方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setTimeSeriesBarRender

import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
public static void setTimeSeriesBarRender(Plot plot, boolean isShowDataLabels) {

        XYPlot xyplot = (XYPlot) plot;
        xyplot.setNoDataMessage(NO_DATA_MSG);

        XYBarRenderer xyRenderer = new XYBarRenderer(0.1D);
        xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());

        if (isShowDataLabels) {
            xyRenderer.setBaseItemLabelsVisible(true);
            xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
        }

        StandardXYToolTipGenerator xyTooltipGenerator = new StandardXYToolTipGenerator("{1}:{2}", new SimpleDateFormat("yyyy-MM-dd"), new DecimalFormat("0"));
        xyRenderer.setBaseToolTipGenerator(xyTooltipGenerator);
        setXY_XAixs(xyplot);
        setXY_YAixs(xyplot);

    }
 
開發者ID:Fanping,項目名稱:iveely.ml,代碼行數:20,代碼來源:ChartUtils.java

示例2: createUI

import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
private void createUI() {
    dataset = new XIntervalSeriesCollection();
    chart = ChartFactory.createHistogram(
            CHART_TITLE,
            "Values",
            "Frequency in #pixels",
            dataset,
            PlotOrientation.VERTICAL,
            false,  // Legend?
            true,   // tooltips
            false   // url
    );
    final XYPlot xyPlot = chart.getXYPlot();
    xyPlot.setDomainZeroBaselineStroke(new BasicStroke(0.2f));

    final XYBarRenderer renderer = (XYBarRenderer) xyPlot.getRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setShadowVisible(false);
    renderer.setShadowYOffset(-4.0);
    renderer.setBaseToolTipGenerator(new XYPlotToolTipGenerator());
    renderer.setBarPainter(new StandardXYBarPainter());
    renderer.setSeriesPaint(0, new Color(0, 0, 200));

    createUI(createChartPanel(chart), createOptionsPanel(), bindingContext);

    isInitialized = true;

    final Binding minBinding = xAxisRangeControl.getBindingContext().getBinding("min");
    final double min = (Double) minBinding.getPropertyValue();
    final Binding maxBinding = xAxisRangeControl.getBindingContext().getBinding("max");
    final double max = (Double) maxBinding.getPropertyValue();
    if (!histogramComputing && min > max) {
        minBinding.setPropertyValue(max);
        maxBinding.setPropertyValue(min);
    }
    updateXAxis();
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:38,代碼來源:HistogramPanel.java

示例3: createChart

import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
@Override
protected JFreeChart createChart(CCMovieList movielist, StatisticsTypeFilter source) {
	JFreeChart chart = ChartFactory.createHistogram(
			"",  //$NON-NLS-1$
			"",  //$NON-NLS-1$
			"",  //$NON-NLS-1$
			getDataSet(movielist, source), 
			PlotOrientation.VERTICAL, 
			false, 
			false, 
			false
			);
	
	chart.removeLegend();
	
	XYPlot plot = chart.getXYPlot();
	
	XYBarRenderer bar_renderer = (XYBarRenderer) plot.getRenderer();
	bar_renderer.setBaseFillPaint(HISTOGRAMMCHART_COLOR);
	bar_renderer.setMargin( 0.2 );
	bar_renderer.setBarAlignmentFactor( 0 );
	bar_renderer.setSeriesPaint(0, HISTOGRAMMCHART_COLOR);
	bar_renderer.setShadowVisible(true);
	bar_renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{1}: {2}", new DecimalFormat("0"), new DecimalFormat("0"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
	bar_renderer.setBarPainter(new StandardXYBarPainter());
	
	plot.setBackgroundPaint(HISTOGRAMMACKGROUND_COLOR);
	plot.setDomainGridlinePaint(GRIDLINECOLOR);
	plot.setRangeGridlinePaint(GRIDLINECOLOR);
	
	chart.setBackgroundPaint(null);
	plot.getDomainAxis().setTickLabelPaint(TEXT_FOREGROUND);
	if (plot.getDomainAxis() instanceof NumberAxis) {
		((NumberAxis)plot.getDomainAxis()).setNumberFormatOverride(new DecimalFormat("0")); //$NON-NLS-1$
	}
	plot.getRangeAxis().setTickLabelPaint(TEXT_FOREGROUND);
    
    return chart;
}
 
開發者ID:Mikescher,項目名稱:jClipCorn,代碼行數:40,代碼來源:StatisticsYearChart.java

示例4: createCombinedChart

import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
/**
 * Creates an overlaid chart.
 *
 * @return The chart.
 */
private static JFreeChart createCombinedChart() {

    // create plot ...
    IntervalXYDataset data1 = createDataset1();
    XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
    renderer1.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
            StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
            new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));
    renderer1.setSeriesStroke(0, new BasicStroke(4.0f,
            BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
    renderer1.setSeriesPaint(0, Color.blue);

    DateAxis domainAxis = new DateAxis("Year");
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.02);
    ValueAxis rangeAxis = new NumberAxis("$billion");
    XYPlot plot1 = new XYPlot(data1, null, rangeAxis, renderer1);
    plot1.setBackgroundPaint(Color.lightGray);
    plot1.setDomainGridlinePaint(Color.white);
    plot1.setRangeGridlinePaint(Color.white);

    // add a second dataset and renderer...
    IntervalXYDataset data2 = createDataset2();
    XYBarRenderer renderer2 = new XYBarRenderer() {
        public Paint getItemPaint(int series, int item) {
            XYDataset dataset = getPlot().getDataset();
            if (dataset.getYValue(series, item) >= 0.0) {
                return Color.red;
            }
            else {
                return Color.green;
            }
        }
    };
    renderer2.setSeriesPaint(0, Color.red);
    renderer2.setDrawBarOutline(false);
    renderer2.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
            StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
            new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));

    XYPlot plot2 = new XYPlot(data2, null, new NumberAxis("$billion"),
            renderer2);
    plot2.setBackgroundPaint(Color.lightGray);
    plot2.setDomainGridlinePaint(Color.white);
    plot2.setRangeGridlinePaint(Color.white);

    CombinedXYPlot cplot = new CombinedXYPlot(domainAxis, rangeAxis);
    cplot.add(plot1, 3);
    cplot.add(plot2, 2);
    cplot.setGap(8.0);
    cplot.setDomainGridlinePaint(Color.white);
    cplot.setDomainGridlinesVisible(true);

    // return a new chart containing the overlaid plot...
    JFreeChart chart = new JFreeChart("CombinedXYPlotDemo1",
            JFreeChart.DEFAULT_TITLE_FONT, cplot, false);
    chart.setBackgroundPaint(Color.white);
    LegendTitle legend = new LegendTitle(cplot);
    chart.addSubtitle(legend);
    return chart;
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:67,代碼來源:CombinedXYPlotDemo1.java

示例5: createChart

import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
private JFreeChart createChart(String title) {
  XYDataset priceDataset = createPriceDataset();
  XYDataset volumeDataset = createVolumeDataset();

  JFreeChart jfreechart = ChartFactory.createTimeSeriesChart(title,        // title
      "Date",       // x title
      "Price",      // y title
      priceDataset, // dataset
      false,        // legend
      true,         // tooltips
      false);

  XYPlot xyplot = (XYPlot) jfreechart.getPlot();

  NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
  numberaxis.setLowerMargin(0.40000000000000002D);

  DecimalFormat decimalformat = new DecimalFormat(quote.getDecimalFormat());
  numberaxis.setNumberFormatOverride(decimalformat);

  if (volumeDataset != null) {
    XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    xyitemrenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
        "{0}: ({1}, {2})", new SimpleDateFormat("d-MMM-yyyy"),
        new DecimalFormat("0.00")));
    xyitemrenderer.setSeriesStroke(0, new BasicStroke(3));

    NumberAxis numberaxis1 = new NumberAxis("Volume");
    numberaxis1.setUpperMargin(1.0D);

    xyplot.setRangeAxis(1, numberaxis1);
    xyplot.setDataset(1, volumeDataset);
    xyplot.setRangeAxis(1, numberaxis1);
    xyplot.mapDatasetToRangeAxis(1, 1);

    XYBarRenderer xybarrenderer = new XYBarRenderer(0.20000000000000001D);
    xybarrenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
        "{0}: ({1}, {2})", new SimpleDateFormat("d-MMM-yyyy"),
        new DecimalFormat("0,000.00")));
    xyplot.setRenderer(1, xybarrenderer);
  }

  return jfreechart;
}
 
開發者ID:incentivetoken,項目名稱:offspring,代碼行數:45,代碼來源:OffspringChartComposite.java


注:本文中的org.jfree.chart.renderer.xy.XYBarRenderer.setBaseToolTipGenerator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。