本文整理了Java中org.jfree.chart.plot.XYPlot.getDatasetCount()
方法的一些代码示例,展示了XYPlot.getDatasetCount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XYPlot.getDatasetCount()
方法的具体详情如下:
包路径:org.jfree.chart.plot.XYPlot
类名称:XYPlot
方法名:getDatasetCount
[英]Returns the number of datasets.
[中]返回数据集的数量。
代码示例来源:origin: senbox-org/snap-desktop
private void removeAllDatasetSeries() {
int datasetCount = xyPlot.getDatasetCount();
for (int i = 0; i < datasetCount; i++) {
xyPlot.setDataset(i, null);
}
}
代码示例来源:origin: stackoverflow.com
XYPlot plot = new XYPlot(this.data1, xAxis, yAxis, renderer1);
LineFunction2D line = new LineFunction2D(A, B);
XYDataset lineDS = DatasetUtilities.sampleFunction2D(line,start,end,samples,seriesKey );
plot.setDataset(plot.getDatasetCount() + 1, lineDS);
代码示例来源:origin: senbox-org/snap-desktop
MetadataPlotTableModel(XYPlot plot) {
this.plot = plot;
columList = new ArrayList<>();
columList.add(plot.getDomainAxis().getLabel());
for(int i = 0; i < plot.getDatasetCount(); i++) {
columList.add(String.valueOf(plot.getDataset(i).getSeriesKey(0)));
}
}
代码示例来源:origin: org.cytoscape/network-analyzer-impl
/**
* Gets the index of the first dataset containing the specified series.
*
* @param aPlot Plot to be searched for the dataset of the fitted function.
* @param aSeriesName Name of series the dataset should contain.
* @return Index of the dataset which contains series named <code>aSeriesName</code>,
* <code>-1</code> if such dataset does not exist.
*/
protected static int getDatasetIndex(XYPlot aPlot, String aSeriesName) {
final int datasetCount = aPlot.getDatasetCount();
for (int i = 0; i < datasetCount; ++i) {
if (aSeriesName.equals(aPlot.getDataset(i).getSeriesKey(0))) {
return i;
}
}
return -1;
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-chart
/**
* Returns the domain axis for a dataset.
*
* @param index the dataset index.
*
* @return The axis.
*/
public ValueAxis getDomainAxisForDataset(int index) {
int upper = Math.max(getDatasetCount(), getRendererCount());
if (index < 0 || index >= upper) {
throw new IllegalArgumentException("Index " + index
+ " out of bounds.");
}
ValueAxis valueAxis = null;
List axisIndices = (List) this.datasetToDomainAxesMap.get(
new Integer(index));
if (axisIndices != null) {
// the first axis in the list is used for data <--> Java2D
Integer axisIndex = (Integer) axisIndices.get(0);
valueAxis = getDomainAxis(axisIndex.intValue());
}
else {
valueAxis = getDomainAxis(0);
}
return valueAxis;
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-chart
/**
* Returns the range axis for a dataset.
*
* @param index the dataset index.
*
* @return The axis.
*/
public ValueAxis getRangeAxisForDataset(int index) {
int upper = Math.max(getDatasetCount(), getRendererCount());
if (index < 0 || index >= upper) {
throw new IllegalArgumentException("Index " + index
+ " out of bounds.");
}
ValueAxis valueAxis = null;
List axisIndices = (List) this.datasetToRangeAxesMap.get(
new Integer(index));
if (axisIndices != null) {
// the first axis in the list is used for data <--> Java2D
Integer axisIndex = (Integer) axisIndices.get(0);
valueAxis = getRangeAxis(axisIndex.intValue());
}
else {
valueAxis = getRangeAxis(0);
}
return valueAxis;
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-chart
/**
* Returns <code>true</code> if all the datasets belonging to the specified
* plot are empty or <code>null</code>, and <code>false</code> otherwise.
*
* @param plot the plot (<code>null</code> permitted).
*
* @return A boolean.
*
* @since 1.0.7
*/
public static boolean isEmptyOrNull(XYPlot plot) {
if (plot != null) {
for (int i = 0, n = plot.getDatasetCount(); i < n; i++) {
final XYDataset dataset = plot.getDataset(i);
if (!DatasetUtilities.isEmptyOrNull(dataset)) {
return false;
}
}
}
return true;
}
代码示例来源:origin: afranken/jmeter-analysis-maven-plugin
public static XYPlot addDatasetRender(XYPlot plot, XYDataset dataset, XYItemRenderer renderer) {
int index = plot.getDatasetCount();
// Bug jfreechart. When we create a XYPlot without dataset, one null dataset is added to list.
if (index == 1 && plot.getDataset(0) == null) {
index--;
}
plot.setDataset(index, dataset);
plot.setRenderer(index, renderer);
return plot;
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-chart
/**
* Draws the range markers (if any) for a renderer and layer. This method
* is typically called from within the draw() method.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param index the renderer index.
* @param layer the layer (foreground or background).
*/
protected void drawRangeMarkers(Graphics2D g2, Rectangle2D dataArea,
int index, Layer layer) {
XYItemRenderer r = getRenderer(index);
if (r == null) {
return;
}
// check that the renderer has a corresponding dataset (it doesn't
// matter if the dataset is null)
if (index >= getDatasetCount()) {
return;
}
Collection markers = getRangeMarkers(index, layer);
ValueAxis axis = getRangeAxisForDataset(index);
if (markers != null && axis != null) {
Iterator iterator = markers.iterator();
while (iterator.hasNext()) {
Marker marker = (Marker) iterator.next();
r.drawRangeMarker(g2, this, axis, marker, dataArea);
}
}
}
代码示例来源:origin: jfree/jfreechart
/**
* Draws the domain markers (if any) for an axis and layer. This method is
* typically called from within the draw() method.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param index the dataset/renderer index.
* @param layer the layer (foreground or background).
*/
protected void drawDomainMarkers(Graphics2D g2, Rectangle2D dataArea,
int index, Layer layer) {
XYItemRenderer r = getRenderer(index);
if (r == null) {
return;
}
// check that the renderer has a corresponding dataset (it doesn't
// matter if the dataset is null)
if (index >= getDatasetCount()) {
return;
}
Collection markers = getDomainMarkers(index, layer);
ValueAxis axis = getDomainAxisForDataset(index);
if (markers != null && axis != null) {
Iterator iterator = markers.iterator();
while (iterator.hasNext()) {
Marker marker = (Marker) iterator.next();
r.drawDomainMarker(g2, this, axis, marker, dataArea);
}
}
}
代码示例来源:origin: jfree/jfreechart
/**
* Draws the range markers (if any) for a renderer and layer. This method
* is typically called from within the draw() method.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param index the renderer index.
* @param layer the layer (foreground or background).
*/
protected void drawRangeMarkers(Graphics2D g2, Rectangle2D dataArea,
int index, Layer layer) {
XYItemRenderer r = getRenderer(index);
if (r == null) {
return;
}
// check that the renderer has a corresponding dataset (it doesn't
// matter if the dataset is null)
if (index >= getDatasetCount()) {
return;
}
Collection markers = getRangeMarkers(index, layer);
ValueAxis axis = getRangeAxisForDataset(index);
if (markers != null && axis != null) {
Iterator iterator = markers.iterator();
while (iterator.hasNext()) {
Marker marker = (Marker) iterator.next();
r.drawRangeMarker(g2, this, axis, marker, dataArea);
}
}
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-chart
/**
* Draws the domain markers (if any) for an axis and layer. This method is
* typically called from within the draw() method.
*
* @param g2 the graphics device.
* @param dataArea the data area.
* @param index the renderer index.
* @param layer the layer (foreground or background).
*/
protected void drawDomainMarkers(Graphics2D g2, Rectangle2D dataArea,
int index, Layer layer) {
XYItemRenderer r = getRenderer(index);
if (r == null) {
return;
}
// check that the renderer has a corresponding dataset (it doesn't
// matter if the dataset is null)
if (index >= getDatasetCount()) {
return;
}
Collection markers = getDomainMarkers(index, layer);
ValueAxis axis = getDomainAxisForDataset(index);
if (markers != null && axis != null) {
Iterator iterator = markers.iterator();
while (iterator.hasNext()) {
Marker marker = (Marker) iterator.next();
r.drawDomainMarker(g2, this, axis, marker, dataArea);
}
}
}
代码示例来源:origin: stackoverflow.com
XYDataset dataSet = // your line dataset
CombinedDomainXYPlot plot = (CombinedDomainXYPlot) chart.getPlot();
XYPlot plot = (XYPlot) plot.getSubplots().get(0);
int dataSetIndx = plot.getDatasetCount();
plot.setDataset(dataSetIndx, dataSet);
XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer(true, false);
plot.setRenderer(dataSetIndx, lineRenderer);
代码示例来源:origin: org.cytoscape/network-analyzer-impl
/**
* Creates a new dataset for visualizing the fitted function.
* <p>
* The new dataset is added to the end of the dataset list of the given plot.
* </p>
*
* @param aPlot Plot to which the new dataset must be added.
* @return Index of the newly created dataset in the dataset list of <code>aPlot</code>.
*/
protected static int createDataset(XYPlot aPlot) {
int i = aPlot.getDatasetCount();
aPlot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
XYLineAndShapeRenderer rend = new XYLineAndShapeRenderer();
rend.setSeriesLinesVisible(0, true);
rend.setSeriesShapesVisible(0, false);
aPlot.setRenderer(i, rend);
return i;
}
代码示例来源:origin: bcdev/beam
private void updatePlot(boolean hasData) {
for (int i = 0; i < timeSeriesPlot.getDatasetCount(); i++) {
timeSeriesPlot.setDataset(i, null);
代码示例来源:origin: cpesch/RouteConverter
protected String getTooltipAtPoint(Point point) {
XYPlot plot = (XYPlot) getChart().getPlot();
PlotRenderingInfo info = getChartRenderingInfo().getPlotInfo();
double x0 = point.getX();
double x1 = x0 - 2 * getScaleX();
double x2 = x0 + 4 * getScaleX();
ValueAxis domainAxis = plot.getDomainAxis();
Rectangle2D screenArea = scale(info.getDataArea());
double tx1 = domainAxis.java2DToValue(x1, screenArea, BOTTOM);
double tx2 = domainAxis.java2DToValue(x2, screenArea, BOTTOM);
for (int datasetIndex = 0; datasetIndex < plot.getDatasetCount(); datasetIndex++) {
XYDataset dataset = plot.getDataset(datasetIndex);
for (int seriesIndex = 0; seriesIndex < dataset.getSeriesCount(); seriesIndex++) {
int itemCount = dataset.getItemCount(seriesIndex);
for (int itemIndex = 0; itemIndex < itemCount; itemIndex++) {
double xValue = dataset.getXValue(seriesIndex, itemIndex);
if (tx1 < xValue && xValue < tx2)
return toolTipGenerator.generateToolTip(dataset, seriesIndex, itemIndex);
}
}
}
return null;
}
}
代码示例来源:origin: sc.fiji/TrackMate_
table.addValue( xColumnName, xVal );
final int nSets = plot.getDatasetCount();
for ( int i = 0; i < nSets; i++ )
代码示例来源:origin: fiji/TrackMate
table.addValue( xColumnName, xVal );
final int nSets = plot.getDatasetCount();
for ( int i = 0; i < nSets; i++ )
代码示例来源:origin: bcdev/beam
double my = plot.getRangeAxis().java2DToValue(point.y, dataArea, rangeEdge);
int datasetCount = chartPanel.getChart().getXYPlot().getDatasetCount();
double minDist = Double.POSITIVE_INFINITY;
for (int datasetIndex = 0; datasetIndex < datasetCount; datasetIndex++) {
代码示例来源:origin: senbox-org/snap-desktop
double my = plot.getRangeAxis().java2DToValue(point.y, dataArea, rangeEdge);
int datasetCount = chartPanel.getChart().getXYPlot().getDatasetCount();
double minDist = Double.POSITIVE_INFINITY;
for (int datasetIndex = 0; datasetIndex < datasetCount; datasetIndex++) {
内容来源于网络,如有侵权,请联系作者删除!