本文整理匯總了Java中org.jfree.chart.renderer.xy.XYBarRenderer.setUseYInterval方法的典型用法代碼示例。如果您正苦於以下問題:Java XYBarRenderer.setUseYInterval方法的具體用法?Java XYBarRenderer.setUseYInterval怎麽用?Java XYBarRenderer.setUseYInterval使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jfree.chart.renderer.xy.XYBarRenderer
的用法示例。
在下文中一共展示了XYBarRenderer.setUseYInterval方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testFindRangeBounds
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
/**
* A simple test for the findRangeBounds() method.
*/
public void testFindRangeBounds() {
DefaultIntervalXYDataset dataset = new DefaultIntervalXYDataset();
double[] x = {1.0, 2.0, 3.0, 4.0};
double[] startx = {0.9, 1.8, 2.7, 3.6};
double[] endx = {1.1, 2.2, 3.3, 4.4};
double[] y = {1.0, 2.0, 3.0, 4.0};
double[] starty = {0.9, 1.8, 2.7, 3.6};
double[] endy = {1.1, 2.2, 3.3, 4.4};
double[][] data = new double[][] {x, startx, endx, y, starty, endy};
dataset.addSeries("Series 1", data);
XYBarRenderer renderer = new XYBarRenderer();
renderer.setUseYInterval(true);
Range r = renderer.findRangeBounds(dataset);
assertEquals(0.9, r.getLowerBound(), EPSILON);
assertEquals(4.4, r.getUpperBound(), EPSILON);
renderer.setUseYInterval(false);
r = renderer.findRangeBounds(dataset);
assertEquals(1.0, r.getLowerBound(), EPSILON);
assertEquals(4.0, r.getUpperBound(), EPSILON);
}
示例2: resetUI
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
/**
* Resets the display.
*/
@Override
void resetUI() {
super.resetUI();
XYPlot xyPlot = mChart.getXYPlot();
xyPlot.getRangeAxis().setVisible(false);
mTooltipGenerator = new CustomXYToolTipGenerator();
@SuppressWarnings("unchecked")
List<String>[] mTooltipsTmp = new List[NUM_SERIES];
mTooltips = mTooltipsTmp;
XYBarRenderer br = new XYBarRenderer();
br.setUseYInterval(true);
mDatasets = new TimePeriodValues[NUM_SERIES];
TimePeriodValuesCollection tpvc = new YIntervalTimePeriodValuesCollection(1);
xyPlot.setDataset(tpvc);
xyPlot.setRenderer(br);
for (int i = 0; i < NUM_SERIES; i++) {
br.setSeriesPaint(i, SERIES_COLORS[i]);
mDatasets[i] = new TimePeriodValues(SERIES_NAMES[i]);
tpvc.addSeries(mDatasets[i]);
mTooltips[i] = new ArrayList<String>();
mTooltipGenerator.addToolTipSeries(mTooltips[i]);
br.setSeriesToolTipGenerator(i, mTooltipGenerator);
}
}
示例3: createChart
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
protected JFreeChart createChart() {
XYTaskDataset dataset = new XYTaskDataset(taskSeriesCollection);
JFreeChart chart = ChartFactory.createXYBarChart(title,
domainAxisLabel, false, rangeAxisLabel, dataset,
PlotOrientation.HORIZONTAL, drawLegend, false, false);
XYPlot plot = (XYPlot) chart.getPlot();
for (Double value : domainAxisMarkers) {
plot.addDomainMarker(new ValueMarker(value, Color.BLACK,
new BasicStroke()));
}
setSeriesLabelsOnDomainAxis(domainAxisLabel, plot);
XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
if (!shadowsVisible) {
// renderer.setShadowVisible() does not work with the current
// JFreeChart version. we thus hide the shadows behind the bars
renderer.setShadowXOffset(0);
renderer.setShadowYOffset(0);
}
renderer.setUseYInterval(true);
plot.setRangeAxis(new DateAxis(rangeAxisLabel));
ChartUtilities.applyCurrentTheme(chart);
setSeriesColors(renderer);
plot.setBackgroundPaint(Color.white);
return chart;
}
示例4: testEquals
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
/**
* Test that the equals() method distinguishes all fields.
*/
public void testEquals() {
// default instances
XYBarRenderer r1 = new XYBarRenderer();
XYBarRenderer r2 = new XYBarRenderer();
assertTrue(r1.equals(r2));
assertTrue(r2.equals(r1));
// setBase()
r1.setBase(1.0);
assertFalse(r1.equals(r2));
r2.setBase(1.0);
assertTrue(r1.equals(r2));
// setUseYInterval
r1.setUseYInterval(!r1.getUseYInterval());
assertFalse(r1.equals(r2));
r2.setUseYInterval(!r2.getUseYInterval());
assertTrue(r1.equals(r2));
// setMargin()
r1.setMargin(0.10);
assertFalse(r1.equals(r2));
r2.setMargin(0.10);
assertTrue(r1.equals(r2));
// setDrawBarOutline()
r1.setDrawBarOutline(!r1.isDrawBarOutline());
assertFalse(r1.equals(r2));
r2.setDrawBarOutline(!r2.isDrawBarOutline());
assertTrue(r1.equals(r2));
// setGradientPaintTransformer()
r1.setGradientPaintTransformer(
new StandardGradientPaintTransformer(
GradientPaintTransformType.CENTER_HORIZONTAL
)
);
assertFalse(r1.equals(r2));
r2.setGradientPaintTransformer(
new StandardGradientPaintTransformer(
GradientPaintTransformType.CENTER_HORIZONTAL
)
);
assertTrue(r1.equals(r2));
}
示例5: testEquals
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
/**
* Test that the equals() method distinguishes all fields.
*/
public void testEquals() {
// default instances
XYBarRenderer r1 = new XYBarRenderer();
XYBarRenderer r2 = new XYBarRenderer();
assertTrue(r1.equals(r2));
assertTrue(r2.equals(r1));
// setBase()
r1.setBase(1.0);
assertFalse(r1.equals(r2));
r2.setBase(1.0);
assertTrue(r1.equals(r2));
// setUseYInterval
r1.setUseYInterval(!r1.getUseYInterval());
assertFalse(r1.equals(r2));
r2.setUseYInterval(!r2.getUseYInterval());
assertTrue(r1.equals(r2));
// setMargin()
r1.setMargin(0.10);
assertFalse(r1.equals(r2));
r2.setMargin(0.10);
assertTrue(r1.equals(r2));
// setDrawBarOutline()
r1.setDrawBarOutline(!r1.isDrawBarOutline());
assertFalse(r1.equals(r2));
r2.setDrawBarOutline(!r2.isDrawBarOutline());
assertTrue(r1.equals(r2));
// setGradientPaintTransformer()
r1.setGradientPaintTransformer(new StandardGradientPaintTransformer(
GradientPaintTransformType.CENTER_HORIZONTAL));
assertFalse(r1.equals(r2));
r2.setGradientPaintTransformer(new StandardGradientPaintTransformer(
GradientPaintTransformType.CENTER_HORIZONTAL));
assertTrue(r1.equals(r2));
// legendBar
r1.setLegendBar(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertFalse(r1.equals(r2));
r2.setLegendBar(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertTrue(r1.equals(r2));
// positiveItemLabelFallbackPosition
r1.setPositiveItemLabelPositionFallback(new ItemLabelPosition());
assertFalse(r1.equals(r2));
r2.setPositiveItemLabelPositionFallback(new ItemLabelPosition());
assertTrue(r1.equals(r2));
// negativeItemLabelFallbackPosition
r1.setNegativeItemLabelPositionFallback(new ItemLabelPosition());
assertFalse(r1.equals(r2));
r2.setNegativeItemLabelPositionFallback(new ItemLabelPosition());
assertTrue(r1.equals(r2));
}
示例6: ChartMeds
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
JFreeChart ChartMeds(Integer demographicNo,String patientName, String chartTitle,String[] drugs) {
MiscUtils.getLogger().debug("In ChartMeds");
org.jfree.data.time.TimeSeriesCollection dataset = new org.jfree.data.time.TimeSeriesCollection();
JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, "Days", "MEDS", dataset, true, true, true);
XYPlot plot = chart.getXYPlot();
// plot.getDomainAxis().setAutoRange(true);
// Range rang = plot.getDataRange(plot.getRangeAxis());
//
// log.debug("LEN " + plot.getDomainAxis().getLowerBound() + " ddd " + plot.getDomainAxis().getUpperMargin() + " eee " + plot.getDomainAxis().getLowerMargin());
// plot.getDomainAxis().setUpperMargin(plot.getDomainAxis().getUpperMargin()*6);
// plot.getDomainAxis().setLowerMargin(plot.getDomainAxis().getLowerMargin()*6);
// plot.getRangeAxis().setUpperMargin(plot.getRangeAxis().getUpperMargin()*1.7);
//
// plot.getDomainAxis().setUpperMargin(0.9);
// plot.getDomainAxis().setLowerMargin(0.9);
// plot.getRangeAxis().setUpperMargin(plot.getRangeAxis().getUpperMargin() * 4);
XYTaskDataset drugDataset = getDrugDataSet( demographicNo,drugs);
SymbolAxis yAxis = new SymbolAxis("Meds", getDrugSymbol(demographicNo,drugs));
yAxis.setGridBandsVisible(false);
XYBarRenderer xyrenderer = new XYBarRenderer();
xyrenderer.setUseYInterval(true);
xyrenderer.setBarPainter(new StandardXYBarPainter());
//XYPlot xyplot = new XYPlot(drugDataset, xAxis, yAxis, xyrenderer);
XYPlot xyplot = new XYPlot(drugDataset, plot.getDomainAxis(), yAxis, xyrenderer);
xyplot.getDomainAxis().setUpperMargin(0.9);
xyplot.getDomainAxis().setLowerMargin(0.9);
CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(new DateAxis("Date/Time"));
cplot.add(xyplot);
chart = new JFreeChart(chartTitle,cplot);
chart.setBackgroundPaint(Color.white);
return chart;
}
示例7: createHistogramChart
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
private JFreeChart createHistogramChart() {
XYBarRenderer renderer1 = new XYBarRenderer();
renderer1.setSeriesPaint(0, Color.cyan);
renderer1.setSeriesPaint(1, Color.pink);
XYPlot histPlot = new XYPlot(histogramDataset, null, new NumberAxis("count"), renderer1);
XYBarRenderer renderer2 = new XYBarRenderer();
renderer2.setSeriesPaint(0, Color.green);
renderer2.setSeriesPaint(1, Color.orange);
renderer2.setUseYInterval(true);
// weight and potential
if (infoParser.isRobustBoost || infoParser.isAdaBoost || infoParser.isLogLossBoost) {
StandardXYItemRenderer renderer3 = new StandardXYItemRenderer();
renderer3.setSeriesPaint(0, Color.blue);
renderer3.setSeriesPaint(1, Color.red);
renderer3.setBaseStroke(new BasicStroke(2));
StandardXYItemRenderer renderer4 = new StandardXYItemRenderer();
renderer4.setSeriesPaint(0, Color.blue);
renderer4.setSeriesPaint(1, Color.red);
renderer4.setBaseStroke(new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 2, new float[] { 2 }, 0));
histPlot.setDataset(1, weightDataset);
histPlot.setRenderer(1, renderer3);
histPlot.setDataset(2, potentialDataset);
histPlot.setRenderer(2, renderer4);
histPlot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
}
XYPlot fluctPlot = new XYPlot(fluctDataset, null, new NumberAxis("bin"), renderer2);
double initialLocation = (upper_limit + lower_limit) / 2.0;
histMarker = new IntervalMarker(initialLocation, initialLocation);
histPlot.addDomainMarker(histMarker, Layer.BACKGROUND);
fluctPlot.addDomainMarker(histMarker, Layer.BACKGROUND);
// plot.setBackgroundPaint(Color.lightGray);
// plot.setDomainGridlinePaint(Color.white);
// plot.setRangeGridlinePaint(Color.white);
CombinedDomainXYPlot combinedPlot = new CombinedDomainXYPlot(new NumberAxis("score"));
combinedPlot.setGap(10.0);
// add the subplots...
ValueAxis axis = new NumberAxis();
axis.setRange(rawData.getMinRange(iter), rawData.getMaxRange(iter));
combinedPlot.add(histPlot, 3);
combinedPlot.add(fluctPlot, 1);
combinedPlot.setOrientation(PlotOrientation.VERTICAL);
combinedPlot.setDomainAxis(axis);
JFreeChart chart = new JFreeChart("Histogram", JFreeChart.DEFAULT_TITLE_FONT, combinedPlot, false // legend
);
return chart;
}
示例8: ChartMeds
import org.jfree.chart.renderer.xy.XYBarRenderer; //導入方法依賴的package包/類
JFreeChart ChartMeds(String demographicNo,String patientName, String chartTitle,String[] drugs) {
MiscUtils.getLogger().debug("In ChartMeds");
org.jfree.data.time.TimeSeriesCollection dataset = new org.jfree.data.time.TimeSeriesCollection();
JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, "Days", "MEDS", dataset, true, true, true);
XYPlot plot = chart.getXYPlot();
// plot.getDomainAxis().setAutoRange(true);
// Range rang = plot.getDataRange(plot.getRangeAxis());
//
// log.debug("LEN " + plot.getDomainAxis().getLowerBound() + " ddd " + plot.getDomainAxis().getUpperMargin() + " eee " + plot.getDomainAxis().getLowerMargin());
// plot.getDomainAxis().setUpperMargin(plot.getDomainAxis().getUpperMargin()*6);
// plot.getDomainAxis().setLowerMargin(plot.getDomainAxis().getLowerMargin()*6);
// plot.getRangeAxis().setUpperMargin(plot.getRangeAxis().getUpperMargin()*1.7);
//
// plot.getDomainAxis().setUpperMargin(0.9);
// plot.getDomainAxis().setLowerMargin(0.9);
// plot.getRangeAxis().setUpperMargin(plot.getRangeAxis().getUpperMargin() * 4);
XYTaskDataset drugDataset = getDrugDataSet( demographicNo,drugs);
SymbolAxis yAxis = new SymbolAxis("Meds", getDrugSymbol(demographicNo,drugs));
yAxis.setGridBandsVisible(false);
XYBarRenderer xyrenderer = new XYBarRenderer();
xyrenderer.setUseYInterval(true);
xyrenderer.setBarPainter(new StandardXYBarPainter());
//XYPlot xyplot = new XYPlot(drugDataset, xAxis, yAxis, xyrenderer);
XYPlot xyplot = new XYPlot(drugDataset, plot.getDomainAxis(), yAxis, xyrenderer);
xyplot.getDomainAxis().setUpperMargin(0.9);
xyplot.getDomainAxis().setLowerMargin(0.9);
CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(new DateAxis("Date/Time"));
cplot.add(xyplot);
chart = new JFreeChart(chartTitle,cplot);
chart.setBackgroundPaint(Color.white);
return chart;
}