本文整理汇总了Java中org.jfree.chart.plot.CombinedDomainXYPlot类的典型用法代码示例。如果您正苦于以下问题:Java CombinedDomainXYPlot类的具体用法?Java CombinedDomainXYPlot怎么用?Java CombinedDomainXYPlot使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CombinedDomainXYPlot类属于org.jfree.chart.plot包,在下文中一共展示了CombinedDomainXYPlot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: plotTradeBubblesOnChart
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入依赖的package包/类
private void plotTradeBubblesOnChart(ArrayList<Integer> toPlot, String p, int k, int j)
{
final Plot main_plot = (Plot)((CombinedDomainXYPlot)this.candlestickChart.getPlot()).getSubplots().get(0);
final XYPlot plot = (XYPlot) main_plot;
final TimeSeries series = new TimeSeries(p);
///*
for(Integer i: toPlot)
{
switch(j)
{
case 0:
series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getOpen());
break;
case 1:
series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getHigh());
break;
case 2:
series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getLow());
break;
case 3:
series.add(new Minute(new Date(chartDatas.get(i).getStartTimeStamp())),chartDatas.get(i).getClose());
break;
}
}
/*
for (int i = 0; i < defaultHighLowDataset.getSeriesCount(); i++)
{
series.add(new Minute(defaultHighLowDataset.getXDate(0, i)),plot[i]);
}
*/
XYDataset dataSet = new TimeSeriesCollection(series);
plot.setDataset(k, dataSet);
XYItemRenderer ir = new XYShapeRenderer();
//ir.s
plot.setRenderer(k, ir);
}
示例2: 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.
}
示例3: 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);
}
示例4: 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));
}
示例5: testNotification
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入依赖的package包/类
/**
* Check that only one chart change event is generated by a change to a
* subplot.
*/
public void testNotification() {
CombinedDomainXYPlot plot = createPlot();
JFreeChart chart = new JFreeChart(plot);
chart.addChangeListener(this);
XYPlot subplot1 = (XYPlot) plot.getSubplots().get(0);
NumberAxis yAxis = (NumberAxis) subplot1.getRangeAxis();
yAxis.setAutoRangeIncludesZero(!yAxis.getAutoRangeIncludesZero());
assertEquals(1, this.events.size());
// a redraw should NOT trigger another change event
BufferedImage image = new BufferedImage(200, 100,
BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = image.createGraphics();
this.events.clear();
chart.draw(g2, new Rectangle2D.Double(0.0, 0.0, 200.0, 100.0));
assertTrue(this.events.isEmpty());
}
示例6: slideChart
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入依赖的package包/类
public void slideChart(int increment, Rectangle2D plotarea) {
CombinedDomainXYPlot combinedDomainXYPlot = (CombinedDomainXYPlot) jFreeChart.getXYPlot();
@SuppressWarnings("unchecked") List<XYPlot> subplots = combinedDomainXYPlot.getSubplots();
if (subplots.size() != 2) {
return;
} else {
int upChartweight = subplots.get(0).getWeight();
int newUpChartWeight = upChartweight-increment;
if (newUpChartWeight <= 0 || newUpChartWeight >= CHARTS_TOTAL_WEIGHT) return;
subplots.get(0).setWeight(newUpChartWeight);
int lowChartweight = subplots.get(1).getWeight();
int newLowChartWeight = lowChartweight+increment;
if (newLowChartWeight <= 0 || newLowChartWeight >= CHARTS_TOTAL_WEIGHT) return;
subplots.get(1).setWeight(newLowChartWeight);
indicPlotWeight = newLowChartWeight;
resetVerticalLines(plotarea);
}
}
示例7: isSlidingArea
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入依赖的package包/类
public Boolean isSlidingArea(double chartY, double mouseY) {
CombinedDomainXYPlot combinedDomainXYPlot = (CombinedDomainXYPlot) jFreeChart.getXYPlot();
@SuppressWarnings("unchecked") List<XYPlot> subplots = combinedDomainXYPlot.getSubplots();
double xAxisDim = 20;
if (subplots.size() != 2) {
return false;
} else {
double mousePos = mouseY/(chartY-xAxisDim);
double slidingArea = (double)subplots.get(0).getWeight()/(double)CHARTS_TOTAL_WEIGHT;
if (slidingArea + .01 >= mousePos && mousePos >= slidingArea - .01) {
return true;
}
}
return false;
}
示例8: 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;
}
示例9: plotIndicatorOnChart
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入依赖的package包/类
private void plotIndicatorOnChart(Double[] toPlot, String p, int k)
{
final Plot main_plot = (Plot)((CombinedDomainXYPlot)this.candlestickChart.getPlot()).getSubplots().get(0);
final XYPlot plot = (XYPlot) main_plot;
plot.setDataset(k, createIndicatorPlot(p,toPlot));
XYItemRenderer ir = new XYLineAndShapeRenderer(true,false);
plot.setRenderer(k, ir);
}
示例10: 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;
}
示例11: getPlot
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入依赖的package包/类
/**
* Returns the plot at the specified position in this chart dialog.
*
* @param index index of the plot to return
* @return the plot at the specified position in this chart dialog
*/
public XYPlot getPlot(int index) {
final JFreeChart chart = this.chartPanel.getChart();
final CombinedDomainXYPlot cplot = (CombinedDomainXYPlot) chart.getPlot();
final XYPlot plot = (XYPlot) cplot.getSubplots().get(index);
return plot;
}
示例12: 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);
}
示例13: testEquals
import org.jfree.chart.plot.CombinedDomainXYPlot; //导入依赖的package包/类
/**
* Tests the equals() method.
*/
public void testEquals() {
CombinedDomainXYPlot plot1 = createPlot();
CombinedDomainXYPlot plot2 = createPlot();
assertTrue(plot1.equals(plot2));
assertTrue(plot2.equals(plot1));
}
示例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: 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;
}