本文整理汇总了Java中org.jfree.chart.plot.CombinedDomainXYPlot.add方法的典型用法代码示例。如果您正苦于以下问题:Java CombinedDomainXYPlot.add方法的具体用法?Java CombinedDomainXYPlot.add怎么用?Java CombinedDomainXYPlot.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.plot.CombinedDomainXYPlot
的用法示例。
在下文中一共展示了CombinedDomainXYPlot.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: plotSeperate
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
private void plotSeperate(XYDataset dataset, String p)
{
NumberAxis rangeAxis1 = new NumberAxis(p);
rangeAxis1.setAutoRangeIncludesZero(false); // override default
rangeAxis1.setLowerMargin(0.40); // to leave room for volume bars
DecimalFormat format = new DecimalFormat("0");
rangeAxis1.setNumberFormatOverride(format);
final ValueAxis timeAxis = new DateAxis("Date");
timeAxis.setLowerMargin(0.02); // reduce the default margins
timeAxis.setUpperMargin(0.02);
XYPlot plot = new XYPlot(dataset, timeAxis, rangeAxis1, null);
XYItemRenderer renderer1 = new XYLineAndShapeRenderer(true, false);
renderer1.setBaseToolTipGenerator(
new StandardXYToolTipGenerator(
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00#")
)
);
plot.setRenderer(0, renderer1);
final CombinedDomainXYPlot cplot1 = (CombinedDomainXYPlot)this.candlestickChart.getPlot();
if (plot != null) cplot1.add(plot, 1); // weight is 1.
}
示例2: raster
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
public void raster(Collection<Spike> spikes,String title)
{
CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Time"));
// Build a plot for each layer
for (int i=0; i<net.nLayers(); i++)
plot.add(layerRaster(spikes,net.lay(i)),1);
JFreeChart chart= new JFreeChart("Raster: "+title,JFreeChart.DEFAULT_TITLE_FONT, plot,true);
// Put it in a frame!
JFrame fr=new JFrame();
fr.getContentPane().add(new ChartPanel(chart));
fr.setSize(1200,1000);
fr.setVisible(true);
}
示例3: createGeneralChartPanel
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
public ChartPanel createGeneralChartPanel() {
CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Generations"));
plot.setGap(10.0);
for (int i = 0; i < this.gCtrl.getNumOfSelectedObjectives(); i++) {
XYPlot subp = this.createSubplot(i);
this.subplots.add(subp);
plot.add(subp);
}
plot.setOrientation(PlotOrientation.VERTICAL);
LegendItemCollection chartLegend = new LegendItemCollection();
chartLegend.add(new LegendItem("Population range", null, null, null, new Rectangle(10, 10), blue));
chartLegend.add(new LegendItem("Generation average", null, null, null, new Rectangle(10, 1), stroke1, blue1));
chartLegend.add(new LegendItem("Absolute best", null, null, null, new Rectangle(10, 1), stroke2, blue2));
plot.setFixedLegendItems(chartLegend);
return new ChartPanel(new JFreeChart("", plot));
}
示例4: CreateChartPanel
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
public static ChartPanel CreateChartPanel(java.util.List datasets, Color[] colors)
{
if (datasets.size() == 1)
return CreateChartPanel((XYSeriesCollection)datasets.get(0), colors);
CombinedDomainXYPlot combined = new CombinedDomainXYPlot();
for (Iterator it = datasets.iterator(); it.hasNext();)
{
XYSeriesCollection series = (XYSeriesCollection)it.next();
XYPlot xy = createXYPlot(series, colors);
combined.add(xy);
}
NumberAxis axisDomain = new NumberAxis();
axisDomain.setAutoRangeIncludesZero(false);
// axisDomain.setRange(400.0, 1600.0);
combined.setDomainAxis(axisDomain);
JFreeChart chart = new JFreeChart(combined);
ChartPanel chartPanel = new SpectrumChartPanel(chart);
chartPanel.setDisplayToolTips(true);
chartPanel.setMouseZoomable(true);
// Remove the autogenerated subtitle
if (chart.getSubtitleCount() == 1)
chart.removeSubtitle(chart.getSubtitle(chart.getSubtitleCount()-1));
return chartPanel;
}
示例5: createCandlestickChart
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
private JFreeChart createCandlestickChart(OHLCDataset priceOHLCDataset) {
final String title = "Chart";
final ValueAxis timeAxis = new DateAxis("Date");
final NumberAxis valueAxis = new NumberAxis("Price");
valueAxis.setAutoRangeIncludesZero(false);
valueAxis.setUpperMargin(0.0);
valueAxis.setLowerMargin(0.0);
XYPlot plot = new XYPlot(priceOHLCDataset, timeAxis, valueAxis, null);
final CandlestickRenderer candlestickRenderer = new CandlestickRenderer();
plot.setRenderer(candlestickRenderer);
//plot.getRangeAxis().setAutoRange(true);
// Give good width when zoom in, but too slow in calculation.
((CandlestickRenderer)plot.getRenderer()).setAutoWidthMethod(CandlestickRenderer.WIDTHMETHOD_SMALLEST);
CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(timeAxis);
cplot.add(plot, 3);
cplot.setGap(8.0);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, cplot, true);
applyChartTheme(chart);
// Handle zooming event.
chart.addChangeListener(this.getChartChangeListner());
return chart;
}
示例6: testRemoveSubplot
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
* This is a test to replicate the bug report 987080.
*/
public void testRemoveSubplot() {
CombinedDomainXYPlot plot = new CombinedDomainXYPlot();
XYPlot plot1 = new XYPlot();
XYPlot plot2 = new XYPlot();
plot.add(plot1);
plot.add(plot2);
// remove plot2, but plot1 is removed instead
plot.remove(plot2);
List plots = plot.getSubplots();
assertTrue(plots.get(0) == plot1);
}
示例7: createPlot
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
* Creates a sample plot.
*
* @return A sample plot.
*/
private CombinedDomainXYPlot createPlot() {
// create subplot 1...
XYDataset data1 = createDataset1();
XYItemRenderer renderer1 = new StandardXYItemRenderer();
NumberAxis rangeAxis1 = new NumberAxis("Range 1");
XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);
annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
annotation.setRotationAngle(Math.PI / 4.0);
subplot1.addAnnotation(annotation);
// create subplot 2...
XYDataset data2 = createDataset2();
XYItemRenderer renderer2 = new StandardXYItemRenderer();
NumberAxis rangeAxis2 = new NumberAxis("Range 2");
rangeAxis2.setAutoRangeIncludesZero(false);
XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
plot.setGap(10.0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
return plot;
}
示例8: createPlot
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
* Creates a sample plot.
*
* @return A sample plot.
*/
private CombinedDomainXYPlot createPlot() {
// create subplot 1...
XYDataset data1 = createDataset1();
XYItemRenderer renderer1 = new StandardXYItemRenderer();
NumberAxis rangeAxis1 = new NumberAxis("Range 1");
XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
XYTextAnnotation annotation
= new XYTextAnnotation("Hello!", 50.0, 10000.0);
annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
annotation.setRotationAngle(Math.PI / 4.0);
subplot1.addAnnotation(annotation);
// create subplot 2...
XYDataset data2 = createDataset2();
XYItemRenderer renderer2 = new StandardXYItemRenderer();
NumberAxis rangeAxis2 = new NumberAxis("Range 2");
rangeAxis2.setAutoRangeIncludesZero(false);
XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
CombinedDomainXYPlot plot
= new CombinedDomainXYPlot(new NumberAxis("Domain"));
plot.setGap(10.0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
return plot;
}
示例9: createCombinedChart
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
* Creates a combined chart.
*
* @return the combined chart.
*/
private static JFreeChart createCombinedChart() {
// create subplot 1...
final XYDataset data1 = createDataset1();
final XYItemRenderer renderer1 = new StandardXYItemRenderer();
final NumberAxis rangeAxis1 = new NumberAxis( "Range 1" );
final XYPlot subplot1 = new XYPlot( data1, null, rangeAxis1, renderer1 );
subplot1.setRangeAxisLocation( AxisLocation.BOTTOM_OR_LEFT );
final XYTextAnnotation annotation = new XYTextAnnotation( "Hello!", 50.0, 10000.0 );
annotation.setFont( new Font( "SansSerif", Font.PLAIN, 9 ) );
annotation.setRotationAngle( Math.PI / 4.0 );
subplot1.addAnnotation( annotation );
// create subplot 2...
final XYDataset data2 = createDataset2();
final XYItemRenderer renderer2 = new StandardXYItemRenderer();
final NumberAxis rangeAxis2 = new NumberAxis( "Range 2" );
rangeAxis2.setAutoRangeIncludesZero( false );
final XYPlot subplot2 = new XYPlot( data2, null, rangeAxis2, renderer2 );
subplot2.setRangeAxisLocation( AxisLocation.TOP_OR_LEFT );
// parent plot...
final CombinedDomainXYPlot plot = new CombinedDomainXYPlot( new NumberAxis( "Domain" ) );
plot.setGap( 10.0 );
// add the subplots...
plot.add( subplot1, 1 );
plot.add( subplot2, 1 );
plot.setOrientation( PlotOrientation.VERTICAL );
// return a new chart containing the overlaid plot...
return new JFreeChart( "CombinedDomainXYPlot Demo",
JFreeChart.DEFAULT_TITLE_FONT, plot, true );
}
示例10: BSCombinedChart
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
* Sole constructor.
*/
public BSCombinedChart() {
super( null, null, new CombinedDomainXYPlot(), CREATE_LEGEND );
// Energy plot...
{
_energyPlot = new BSEnergyPlot();
_energyPlot.setDomainAxis( null );
}
// Wave Function plot...
{
_bottomPlot = new BSBottomPlot();
_bottomPlot.setDomainAxis( null );
}
// Common X axis...
BSPositionAxis positionAxis = new BSPositionAxis();
// Parent plot configuration...
{
CombinedDomainXYPlot plot = (CombinedDomainXYPlot) getPlot();
// Misc properties
plot.setDomainAxis( positionAxis );
plot.setGap( CHART_SPACING );
plot.setOrientation( PlotOrientation.VERTICAL );
// Add the subplots, energy plot is twice the size of wave function plot.
plot.add( _energyPlot, 2 );
plot.add( _bottomPlot, 1 );
}
}
示例11: createCombinedChart
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
private static JFreeChart createCombinedChart() {
// create subplot 1...
final XYItemRenderer renderer1 = new StandardXYItemRenderer();
final NumberAxis rangeAxis1 = new NumberAxis( "Range 1" );
final XYPlot subplot1 = new XYPlot( createDataset1(), null, rangeAxis1, renderer1 );
subplot1.setRangeAxisLocation( AxisLocation.BOTTOM_OR_LEFT );
final XYTextAnnotation annotation = new XYTextAnnotation( "Hello!", 50.0, 10000.0 );
annotation.setFont( new Font( "SansSerif", Font.PLAIN, 9 ) );
annotation.setRotationAngle( Math.PI / 4.0 );
subplot1.addAnnotation( annotation );
// create subplot 2...
final XYItemRenderer renderer2 = new StandardXYItemRenderer();
final NumberAxis rangeAxis2 = new NumberAxis( "Range 2" );
rangeAxis2.setAutoRangeIncludesZero( false );
final XYPlot subplot2 = new XYPlot( createDataset2(), null, rangeAxis2, renderer2 );
subplot2.setRangeAxisLocation( AxisLocation.TOP_OR_LEFT );
// parent plot...
final CombinedDomainXYPlot plot = new CombinedDomainXYPlot( new NumberAxis( "Domain" ) );
plot.setGap( 10.0 );
// add the subplots...
plot.add( subplot1, 1 );
plot.add( subplot2, 1 );
plot.setOrientation( PlotOrientation.VERTICAL );
// return a new chart containing the overlaid plot...
return new JFreeChart( "CombinedDomainXYPlot Demo",
JFreeChart.DEFAULT_TITLE_FONT, plot, true );
}
示例12: createCombinedChart
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
* Creates a combined chart.
*
* @return The combined chart.
*/
private JFreeChart createCombinedChart(DataSequence tsOne, DataSequence tsTwo, ArrayList<Anomaly> anomalyList) {
// create subplot 1.
final XYDataset data1 = createDataset(tsOne, "Original");
final XYItemRenderer renderer1 = new StandardXYItemRenderer();
final NumberAxis rangeAxis1 = new NumberAxis("Original Value");
XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
// plot anomalies on subplot 1.
addAnomalies(subplot1, anomalyList);
// create subplot 2.
final XYDataset data2 = createDataset(tsTwo, "Forecast");
final XYItemRenderer renderer2 = new StandardXYItemRenderer();
final NumberAxis rangeAxis2 = new NumberAxis("Forecast Value");
rangeAxis2.setAutoRangeIncludesZero(false);
final XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot.
final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Time"));
plot.setGap(10.0);
// add the subplots.
plot.add(subplot1, 1);
plot.add(subplot2, 1);
// Add anomaly score time-series.
addAnomalyTS(plot, tsOne, tsTwo);
plot.setOrientation(PlotOrientation.VERTICAL);
// return a new chart containing the overlaid plot.
return new JFreeChart("EGADS GUI",
JFreeChart.DEFAULT_TITLE_FONT,
plot,
true);
}
示例13: addAnomalyTS
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
* Compute the time-series of anomalies.
*/
public void addAnomalyTS(CombinedDomainXYPlot plot, DataSequence observedSeries, DataSequence expectedSeries) {
// Compute the time-series of errors.
HashMap<String, ArrayList<Float>> allErrors = aes.initAnomalyErrors(observedSeries, expectedSeries);
Float sDAutoSensitivity = (float) 0.0;
Float amntAutoSensitivity = (float) 0.0;
if (config.getProperty("AUTO_SENSITIVITY_ANOMALY_PCNT") != null) {
amntAutoSensitivity = new Float(config.getProperty("AUTO_SENSITIVITY_ANOMALY_PCNT"));
}
if (config.getProperty("AUTO_SENSITIVITY_SD") != null) {
sDAutoSensitivity = new Float(config.getProperty("AUTO_SENSITIVITY_SD"));
}
String errorDebug = "";
for (int i = 0; i < (aes.getIndexToError().keySet()).size(); i++) {
Float[] fArray = (allErrors.get(aes.getIndexToError().get(i))).toArray(new Float[(allErrors.get(aes.getIndexToError().get(i))).size()]);
XYDataset data1 = createDataset(fArray, aes.getIndexToError().get(i));
XYItemRenderer renderer1 = new StandardXYItemRenderer();
NumberAxis rangeAxis1 = new NumberAxis(aes.getIndexToError().get(i));
XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
// Get threshold.
Float d = AutoSensitivity.getLowDensitySensitivity(fArray, sDAutoSensitivity, amntAutoSensitivity);
subplot1.addRangeMarker(new ValueMarker(d));
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
plot.add(subplot1, 1);
errorDebug += aes.getIndexToError().get(i) + ": " + d + " ";
}
System.out.println(errorDebug);
}
示例14: createPlot
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
/**
* Creates a sample plot.
*
* @return A sample plot.
*/
private CombinedDomainXYPlot createPlot() {
// create subplot 1...
XYDataset data1 = createDataset1();
XYItemRenderer renderer1 = new StandardXYItemRenderer();
NumberAxis rangeAxis1 = new NumberAxis("Range 1");
XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
XYTextAnnotation annotation
= new XYTextAnnotation("Hello!", 50.0, 10000.0);
annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
annotation.setRotationAngle(Math.PI / 4.0);
subplot1.addAnnotation(annotation);
// create subplot 2...
XYDataset data2 = createDataset2();
XYItemRenderer renderer2 = new StandardXYItemRenderer();
NumberAxis rangeAxis2 = new NumberAxis("Range 2");
rangeAxis2.setAutoRangeIncludesZero(false);
XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
// parent plot...
CombinedDomainXYPlot plot
= new CombinedDomainXYPlot(new NumberAxis("Domain"));
plot.setGap(10.0);
// add the subplots...
plot.add(subplot1, 1);
plot.add(subplot2, 1);
plot.setOrientation(PlotOrientation.VERTICAL);
return plot;
}
示例15: addSubPlot
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入方法依赖的package包/类
private static TimeSeriesCollection addSubPlot(CombinedDomainXYPlot plot, String label) {
final TimeSeriesCollection seriesCollection = new TimeSeriesCollection(new TimeSeries(label, Millisecond.class));
NumberAxis rangeAxis = new NumberAxis();
rangeAxis.setAutoRangeIncludesZero(false);
XYPlot subplot = new XYPlot(seriesCollection, null, rangeAxis, new StandardXYItemRenderer());
subplot.setBackgroundPaint(Color.lightGray);
subplot.setDomainGridlinePaint(Color.white);
subplot.setRangeGridlinePaint(Color.white);
plot.add(subplot);
return seriesCollection;
}