本文整理了Java中org.jfree.chart.plot.XYPlot.getDataset()
方法的一些代码示例,展示了XYPlot.getDataset()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XYPlot.getDataset()
方法的具体详情如下:
包路径:org.jfree.chart.plot.XYPlot
类名称:XYPlot
方法名:getDataset
[英]Returns the primary dataset for the plot.
[中]返回绘图的主数据集。
代码示例来源:origin: stackoverflow.com
XYPlot plot = chart.getXYPlot();
plot.setDataset(0, xyDataset1);
plot.setDataset(1, xyDataset2);
XYLineAndShapeRenderer renderer0 = new XYLineAndShapeRenderer();
XYLineAndShapeRenderer renderer1 = new XYLineAndShapeRenderer();
plot.setRenderer(0, renderer0);
plot.setRenderer(1, renderer1);
plot.getRendererForDataset(plot.getDataset(0)).setSeriesPaint(0, Color.red);
plot.getRendererForDataset(plot.getDataset(1)).setSeriesPaint(0, Color.blue);
代码示例来源: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: jfree/jfreechart
/**
* Returns the primary dataset for the plot.
*
* @return The primary dataset (possibly {@code null}).
*
* @see #getDataset(int)
* @see #setDataset(XYDataset)
*/
public XYDataset getDataset() {
return getDataset(0);
}
代码示例来源: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
/**
* Returns the primary dataset for the plot.
*
* @return The primary dataset (possibly <code>null</code>).
*
* @see #getDataset(int)
* @see #setDataset(XYDataset)
*/
public XYDataset getDataset() {
return getDataset(0);
}
代码示例来源: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: jfree/jfreechart
/**
* Returns the number of series in the primary dataset for this plot. If
* the dataset is {@code null}, the method returns 0.
*
* @return The series count.
*/
public int getSeriesCount() {
int result = 0;
XYDataset dataset = getDataset();
if (dataset != null) {
result = dataset.getSeriesCount();
}
return result;
}
代码示例来源:origin: senbox-org/snap-desktop
@Override
public int getRowCount() {
return plot.getDataset().getItemCount(0);
}
代码示例来源:origin: bcdev/beam
private boolean hasDiagram() {
return chart.getXYPlot().getDataset() != null;
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-chart
/**
* Returns the number of series in the primary dataset for this plot. If
* the dataset is <code>null</code>, the method returns 0.
*
* @return The series count.
*/
public int getSeriesCount() {
int result = 0;
XYDataset dataset = getDataset();
if (dataset != null) {
result = dataset.getSeriesCount();
}
return result;
}
代码示例来源:origin: bcdev/beam
private XYSeries getXYSeries(PixExOp.VariableCombination variableCombination, long productId) {
final XYSeries xySeries;
if (plotMaps.get(productId).containsKey(variableCombination)) {
xySeries = ((XYSeriesCollection) plotMaps.get(productId).get(variableCombination).getXYPlot().getDataset()).getSeries(0);
} else {
xySeries = new XYSeries("data");
JFreeChart scatterPlot = createScatterPlot(variableCombination, xySeries, productId);
plotMaps.get(productId).put(variableCombination, scatterPlot);
}
return xySeries;
}
代码示例来源:origin: senbox-org/snap-desktop
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (columnIndex == 0) {
return plot.getDataset(columnIndex).getXValue(0, rowIndex);
} else {
XYDataset dataset = plot.getDataset(columnIndex - 1);
int itemCount = dataset.getItemCount(0);
if (rowIndex < itemCount) {
return dataset.getYValue(0, rowIndex);
}else {
return null;
}
}
}
代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-misc-swing
private XYSeriesCollection getCategory() {
return (XYSeriesCollection) panel.getChart().getXYPlot().getDataset();
}
代码示例来源:origin: jfree/jfreechart
/**
* Maps the specified dataset to the axes in the list. Note that the
* conversion of data values into Java2D space is always performed using
* the first axis in the list.
*
* @param index the dataset index (zero-based).
* @param axisIndices the axis indices ({@code null} permitted).
*
* @since 1.0.12
*/
public void mapDatasetToDomainAxes(int index, List axisIndices) {
Args.requireNonNegative(index, "index");
checkAxisIndices(axisIndices);
Integer key = new Integer(index);
this.datasetToDomainAxesMap.put(key, new ArrayList(axisIndices));
// fake a dataset change event to update axes...
datasetChanged(new DatasetChangeEvent(this, getDataset(index)));
}
代码示例来源:origin: jfree/jfreechart
/**
* Maps the specified dataset to the axes in the list. Note that the
* conversion of data values into Java2D space is always performed using
* the first axis in the list.
*
* @param index the dataset index (zero-based).
* @param axisIndices the axis indices ({@code null} permitted).
*
* @since 1.0.12
*/
public void mapDatasetToRangeAxes(int index, List axisIndices) {
Args.requireNonNegative(index, "index");
checkAxisIndices(axisIndices);
Integer key = new Integer(index);
this.datasetToRangeAxesMap.put(key, new ArrayList(axisIndices));
// fake a dataset change event to update axes...
datasetChanged(new DatasetChangeEvent(this, getDataset(index)));
}
代码示例来源:origin: mikaelhg/openblocks
/**
* Updates the series name at the specified index
* @param seriesName the new seriesName to set at the specified index
* @param index the desired index to set the new seriesName to
*/
public void updateSeriesNameAt(String seriesName, int index) {
if (!lock) {
XYSeries s = ((XYSeriesCollection) chart.getXYPlot().getDataset()).getSeries(index);
s.setKey(seriesName);
}
}
代码示例来源:origin: org.cytoscape/network-analyzer-impl
/**
* Extracts the visualized data from a given chart instance.
* <p>
* This methods extracts the default data series from the default dataset of the given chart.
* </p>
*
* @param aChart
* Chart to extract the data from.
* @return Visualized data in the form of an array of points.
*/
public static Point2D.Double[] extractData(JFreeChart aChart) {
XYDataset dataColl = aChart.getXYPlot().getDataset();
final int n = dataColl.getItemCount(0);
Point2D.Double[] dataPoints = new Point2D.Double[n];
for (int i = 0; i < n; ++i) {
dataPoints[i] = new Point2D.Double(dataColl.getXValue(0, i), dataColl.getYValue(0, i));
}
return dataPoints;
}
代码示例来源:origin: mikaelhg/openblocks
/**
* Updates the values for the specified seriesName with the given values
* @param seriesName the name a series in the graph
* @param index the index of the desired series to update
* @param time the time at which to update
* @param value the value to update
*/
public void updateValues(String seriesName, int index, double time, double value) {
if (!lock) {
XYSeries s = ((XYSeriesCollection) chart.getXYPlot().getDataset()).getSeries(index);
s.setKey(seriesName);
s.addOrUpdate(time, value);
}
}
代码示例来源:origin: mikaelhg/openblocks
/**
* Clear the graph starting from the startTime.
* @param startTime an x-value on the graph
*/
public void clearValues(int index, double startTime) {
if (!lock) {
XYSeries s = ((XYSeriesCollection) chart.getXYPlot().getDataset()).getSeries(index);
int i = s.indexOf(startTime);
if (i >= 0) {
int total = s.getItemCount();
for (; i < total; total--) {
s.remove(i);
}
}
}
}
代码示例来源:origin: mikaelhg/openblocks
/**
* Clears all values for all series, leaving the same number of series
*/
public void clearValues() {
if (!lock) {
for (int i = 0; i < chart.getXYPlot().getSeriesCount(); i++) {
XYSeries s = ((XYSeriesCollection) chart.getXYPlot().getDataset()).getSeries(i);
while (s.getItemCount() > 0) {
s.remove(0);
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!