首页>代码>jfreechart免费报表框架demo教程>/jfreechart-1.0.18/experimental/org/jfree/experimental/chart/plot/CombinedCategoryPlot.java
/* ===========================================================
* JFreeChart : a free chart library for the Java(tm) platform
* ===========================================================
*
* (C) Copyright 2000-2013, by Object Refinery Limited and Contributors.
*
* Project Info: http://www.jfree.org/jfreechart/index.html
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
* [Oracle and Java are registered trademarks of Oracle and/or its affiliates.
* Other names may be trademarks of their respective owners.]
*
* -------------------------
* CombinedCategoryPlot.java
* -------------------------
* (C) Copyright 2008, by Richard West and Contributors.
*
* Original Author: Richard West, Advanced Micro Devices, Inc.;
* Contributor(s): David Gilbert (for Object Refinery Limited);
*
* Changes
* -------
* 02-Feb-2007 : Version 1, contributed by Richard West - see
* patch 1924543 (DG);
*
*/
package org.jfree.experimental.chart.plot;
import java.util.Iterator;
import org.jfree.chart.axis.CategoryAxis;
import org.jfree.chart.axis.ValueAxis;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.CombinedDomainCategoryPlot;
import org.jfree.data.Range;
/**
* A specialised form of {@link CombinedDomainCategoryPlot} where the
* subplots share not only the same x-axis, but also the same y-axis.
*/
public class CombinedCategoryPlot extends CombinedDomainCategoryPlot {
/**
* Creates a new instance with the specified axes.
*
* @param domainAxis the x-axis.
* @param rangeAxis the y-axis.
*/
public CombinedCategoryPlot (CategoryAxis domainAxis, ValueAxis rangeAxis) {
super(domainAxis);
super.setGap(10.0);
super.setRangeAxis(rangeAxis);
}
/**
* Adds a new subplot with weight <code>1</code>.
*
* @param subplot the subplot.
*/
public void add(CategoryPlot subplot) {
this.add(subplot, 1);
}
/**
* Adds a new subplot with the specified weight.
*
* @param subplot the subplot.
* @param weight the weight for the subplot.
*/
public void add(CategoryPlot subplot, int weight) {
super.add(subplot, weight);
ValueAxis l_range = super.getRangeAxis();
subplot.setRangeAxis(0, l_range, false);
super.setRangeAxis(l_range);
if (null == l_range) {
return;
}
l_range.configure();
}
/**
* Returns the bounds of the data values that will be plotted against
* the specified axis.
*
* @param axis the axis.
*
* @return The bounds.
*/
public Range getDataRange(ValueAxis axis) {
Range l_result = null;
Iterator l_itr = getSubplots().iterator();
while (l_itr.hasNext()) {
CategoryPlot l_subplot = (CategoryPlot) l_itr.next();
l_result = Range.combine(l_result, l_subplot.getDataRange(axis));
}
return l_result;
}
/**
* Sets the range axis that is shared by all the subplots.
*
* @param axis the axis.
*/
public void setRangeAxis(ValueAxis axis) {
Iterator l_itr = getSubplots().iterator();
while (l_itr.hasNext()) {
CategoryPlot l_subplot = (CategoryPlot) l_itr.next();
l_subplot.setRangeAxis(0, axis, false);
}
super.setRangeAxis(axis);
if (null == axis) {
return;
}
axis.configure();
}
}
最近下载更多
James_hong LV1
2021年10月13日
y6622576 LV9
2020年6月21日
809933690 LV2
2020年5月21日
wanglong_wang LV13
2019年8月1日
Weipeng_ LV14
2018年6月28日
pengge LV2
2016年7月11日
xx511411311 LV3
2016年6月16日
ri0mei LV2
2016年4月21日
那年那时 LV2
2015年6月18日
hsjsak LV2
2015年4月23日
最近浏览更多
微信网友_6904205432819712 LV1
2024年3月12日
hhsoft LV1
2023年10月22日
qq1357574774 LV2
2023年8月14日
abc562311934 LV4
2022年10月8日
东北人 LV12
2022年9月20日
2387972368 LV2
2022年5月25日
heifenglei LV7
2022年4月7日
wxh1234567 LV4
2022年1月17日
有你的小镇
2021年12月22日
暂无贡献等级
ccxiao LV2
2021年12月16日

