本文整理了Java中org.jfree.chart.plot.XYPlot.setDomainGridlinePaint()
方法的一些代码示例,展示了XYPlot.setDomainGridlinePaint()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XYPlot.setDomainGridlinePaint()
方法的具体详情如下:
包路径:org.jfree.chart.plot.XYPlot
类名称:XYPlot
方法名:setDomainGridlinePaint
[英]Sets the paint for the grid lines plotted against the domain axis, and sends a PlotChangeEvent to all registered listeners.
[中]设置针对域轴绘制的网格线的绘制,并向所有注册的侦听器发送PlotChangeEvent。
代码示例来源:origin: graphhopper/jsprit
/**
* Builds and returns JFreeChart.
*
* @return
*/
public JFreeChart build() {
XYSeriesCollection collection = new XYSeriesCollection();
for (XYSeries s : seriesMap.values()) {
collection.addSeries(s);
}
JFreeChart chart = ChartFactory.createXYLineChart(chartName, xDomain, yDomain, collection, PlotOrientation.VERTICAL, true, true, false);
XYPlot plot = chart.getXYPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
return chart;
}
代码示例来源:origin: psi-probe/psi-probe
chart.getXYPlot().setDomainGridlinePaint(new Color(gridColor));
chart.getXYPlot().setRangeGridlinePaint(new Color(gridColor));
chart.getXYPlot().setDomainAxis(0, new DateAxis());
代码示例来源:origin: graphhopper/jsprit
private XYPlot createPlot(final XYSeriesCollection problem, XYSeriesCollection shipments, XYSeriesCollection solution) {
XYPlot plot = new XYPlot();
plot.setBackgroundPaint(Color.LIGHT_GRAY);
plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
XYLineAndShapeRenderer problemRenderer = getProblemRenderer(problem);
plot.setDataset(0, problem);
plot.setRenderer(0, problemRenderer);
XYItemRenderer shipmentsRenderer = getShipmentRenderer(shipments);
plot.setDataset(1, shipments);
plot.setRenderer(1, shipmentsRenderer);
if (solution != null) {
XYItemRenderer solutionRenderer = getRouteRenderer(solution);
plot.setDataset(2, solution);
plot.setRenderer(2, solutionRenderer);
}
NumberAxis xAxis = new NumberAxis();
NumberAxis yAxis = new NumberAxis();
if (boundingBox == null) {
xAxis.setRangeWithMargins(getDomainRange(problem));
yAxis.setRangeWithMargins(getRange(problem));
} else {
xAxis.setRangeWithMargins(new Range(boundingBox.minX, boundingBox.maxX));
yAxis.setRangeWithMargins(new Range(boundingBox.minY, boundingBox.maxY));
}
plot.setDomainAxis(xAxis);
plot.setRangeAxis(yAxis);
return plot;
}
代码示例来源:origin: org.openfuxml/ofx-chart
@Override
protected void setSpecialColors()
{
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRangeGridlinePaint(ChartColorFactory.createColor(ofxChart, ChartColorFactory.Area.gridRange));
plot.setDomainGridlinePaint(ChartColorFactory.createColor(ofxChart, ChartColorFactory.Area.gridDomain));
}
代码示例来源:origin: micromata/projectforge
public XYChartBuilder(final JFreeChart chart)
{
this.chart = chart;
plot = chart.getXYPlot();
plot.setBackgroundPaint(Color.white);
plot.setDomainGridlinePaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.lightGray);
plot.setOutlineVisible(false);
}
代码示例来源:origin: stackoverflow.com
private JFreeChart createChart() {
final XYDataset dataset = this.createDataset(series);
final JFreeChart result = ChartFactory.createTimeSeriesChart("Dynamic Line And TimeSeries Chart", "Time", "Value", dataset, true, true, false);
final XYPlot plot = result.getXYPlot();
plot.setBackgroundPaint(new Color(0xffffe0));
plot.setDomainGridlinesVisible(true);
plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
plot.setRangeGridlinesVisible(true);
plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
// first time series
this.firstTimeSeries(plot);
// second time series
this.secondTimeSeries(plot);
// third time series
this.thirdTimeSeries(plot);
return result;
}
代码示例来源:origin: com.graphhopper/jsprit-analysis
/**
* Builds and returns JFreeChart.
*
* @return
*/
public JFreeChart build() {
XYSeriesCollection collection = new XYSeriesCollection();
for (XYSeries s : seriesMap.values()) {
collection.addSeries(s);
}
JFreeChart chart = ChartFactory.createXYLineChart(chartName, xDomain, yDomain, collection, PlotOrientation.VERTICAL, true, true, false);
XYPlot plot = chart.getXYPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
return chart;
}
代码示例来源:origin: org.gephi/statistics-plugin
public static void decorateChart(JFreeChart chart) {
XYPlot plot = (XYPlot) chart.getPlot();
XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
renderer.setSeriesLinesVisible(0, false);
renderer.setSeriesShapesVisible(0, true);
renderer.setSeriesShape(0, new java.awt.geom.Ellipse2D.Double(0, 0, 2, 2));
plot.setBackgroundPaint(java.awt.Color.WHITE);
plot.setDomainGridlinePaint(java.awt.Color.GRAY);
plot.setRangeGridlinePaint(java.awt.Color.GRAY);
plot.setRenderer(renderer);
}
代码示例来源:origin: org.kurento/kurento-test
public void drawChart(String filename, int width, int height) throws IOException {
// Create plot
NumberAxis xAxis = new NumberAxis(xAxisLabel);
NumberAxis yAxis = new NumberAxis(yAxisLabel);
XYSplineRenderer renderer = new XYSplineRenderer();
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4));
// Create chart
JFreeChart chart = new JFreeChart(chartTitle, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
ChartUtilities.applyCurrentTheme(chart);
ChartPanel chartPanel = new ChartPanel(chart, false);
// Draw png
BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR);
Graphics graphics = bi.getGraphics();
chartPanel.setBounds(0, 0, width, height);
chartPanel.paint(graphics);
ImageIO.write(bi, "png", new File(filename));
}
代码示例来源:origin: Kurento/kurento-java
public void drawChart(String filename, int width, int height) throws IOException {
// Create plot
NumberAxis xAxis = new NumberAxis(xAxisLabel);
NumberAxis yAxis = new NumberAxis(yAxisLabel);
XYSplineRenderer renderer = new XYSplineRenderer();
XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer);
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4));
// Create chart
JFreeChart chart = new JFreeChart(chartTitle, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
ChartUtilities.applyCurrentTheme(chart);
ChartPanel chartPanel = new ChartPanel(chart, false);
// Draw png
BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR);
Graphics graphics = bi.getGraphics();
chartPanel.setBounds(0, 0, width, height);
chartPanel.paint(graphics);
ImageIO.write(bi, "png", new File(filename));
}
代码示例来源:origin: activequant/aq2o
public static JFreeChart getStepChart(String title, TSContainer2 container) {
TimeSeriesCollection tempDataSet = new TimeSeriesCollection();
for (int i = 0; i < container.getNumColumns(); i++) {
DoubleColumn dc = (DoubleColumn) container.getColumns().get(i);
List<TimeStamp> ts = container.getTimeStamps();
TimeSeries tsNew = new TimeSeries(container.getColumnHeaders().get(i));
for (int j = 0; j < dc.size(); j++)
tsNew.addOrUpdate(new Millisecond(ts.get(j).getDate()), dc.get(j));
// add a new series.
tempDataSet.addSeries(tsNew);
}
JFreeChart chart = ChartFactory.createXYStepChart(title, "Time", "Value", tempDataSet, PlotOrientation.VERTICAL, true, true, false);
chart.setBackgroundPaint(Color.WHITE);
chart.getPlot().setBackgroundPaint(Color.WHITE);
((XYPlot)chart.getPlot()).setDomainGridlinePaint(Color.LIGHT_GRAY);
((XYPlot)chart.getPlot()).setRangeGridlinePaint(Color.LIGHT_GRAY);
return chart;
}
}
代码示例来源:origin: senbox-org/snap-desktop
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;
}
代码示例来源:origin: bcdev/beam
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;
}
代码示例来源:origin: org.n52.series-api/io
private XYPlot createPlotArea(JFreeChart chart) {
XYPlot plot = chart.getXYPlot();
plot.setBackgroundPaint(Color.WHITE);
plot.setDomainGridlinePaint(Color.LIGHT_GRAY);
plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0));
showCrosshairsOnAxes(plot);
configureDomainAxis(plot);
showGridlinesOnChart(plot);
configureTimeAxis(plot);
configureTitle(chart);
addNotice(chart);
return plot;
}
代码示例来源:origin: net.sourceforge.ondex.apps/ovtk2
/**
* Creates a chart.
*
* @param dataset
* a dataset.
*
* @return A chart.
*/
private JFreeChart createChart(SimpleHistogramDataset dataset) {
chart = ChartFactory.createHistogram(null, engl("Value"), engl("Histogram"), dataset, PlotOrientation.VERTICAL, false, true, false);
chart.setBackgroundPaint(Color.white);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setBackgroundPaint(Color.white);
plot.getRenderer().setSeriesPaint(0, new Color(0x7f9f51));
plot.setDomainGridlinePaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.lightGray);
plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
plot.setDomainCrosshairVisible(false);
plot.setRangeCrosshairVisible(false);
return chart;
}
代码示例来源:origin: org.n52.sensorweb/timeseries-io
private XYPlot createPlotArea(JFreeChart chart) {
XYPlot plot = chart.getXYPlot();
plot.setBackgroundPaint(WHITE);
plot.setDomainGridlinePaint(LIGHT_GRAY);
plot.setRangeGridlinePaint(LIGHT_GRAY);
plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0));
showCrosshairsOnAxes(plot);
configureDomainAxis(plot);
showGridlinesOnChart(plot);
configureTimeAxis(plot);
configureTitle(chart);
addNotice(chart);
return plot;
}
代码示例来源:origin: net.imglib2/imglib2-script
static private final void setBackgroundDefault(final JFreeChart chart) {
BasicStroke gridStroke = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[]{2.0f, 1.0f}, 0.0f);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRangeGridlineStroke(gridStroke);
plot.setDomainGridlineStroke(gridStroke);
plot.setBackgroundPaint(new Color(235, 235, 235));
plot.setRangeGridlinePaint(Color.white);
plot.setDomainGridlinePaint(Color.white);
plot.setOutlineVisible(false);
plot.getDomainAxis().setAxisLineVisible(false);
plot.getRangeAxis().setAxisLineVisible(false);
plot.getDomainAxis().setLabelPaint(Color.gray);
plot.getRangeAxis().setLabelPaint(Color.gray);
plot.getDomainAxis().setTickLabelPaint(Color.gray);
plot.getRangeAxis().setTickLabelPaint(Color.gray);
chart.getTitle().setPaint(Color.gray);
}
}
代码示例来源:origin: us.ihmc/simulation-construction-set-tools
public void enableGrid(boolean enable)
{
if (enable)
{
BasicStroke dotted = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] {1.0f, 6.0f}, 0.0f);
graph.getXYPlot().setDomainGridlinesVisible(true);
graph.getXYPlot().setRangeGridlinesVisible(true);
graph.getXYPlot().setRangeGridlinePaint(Color.black);
graph.getXYPlot().setDomainGridlinePaint(Color.black);
graph.getXYPlot().setRangeGridlineStroke(dotted);
graph.getXYPlot().setDomainGridlineStroke(dotted);
}
else
{
graph.getXYPlot().setDomainGridlinesVisible(false);
graph.getXYPlot().setRangeGridlinesVisible(false);
}
}
代码示例来源:origin: net.imagej/imagej-ui-swing
private final void setBackgroundDefault(final JFreeChart chart) {
final BasicStroke gridStroke =
new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
1.0f, new float[] { 2.0f, 1.0f }, 0.0f);
final XYPlot plot = (XYPlot) chart.getPlot();
plot.setRangeGridlineStroke(gridStroke);
plot.setDomainGridlineStroke(gridStroke);
plot.setBackgroundPaint(new Color(235, 235, 235));
plot.setRangeGridlinePaint(Color.white);
plot.setDomainGridlinePaint(Color.white);
plot.setOutlineVisible(false);
plot.getDomainAxis().setAxisLineVisible(false);
plot.getRangeAxis().setAxisLineVisible(false);
plot.getDomainAxis().setLabelPaint(Color.gray);
plot.getRangeAxis().setLabelPaint(Color.gray);
plot.getDomainAxis().setTickLabelPaint(Color.gray);
plot.getRangeAxis().setTickLabelPaint(Color.gray);
final TextTitle title = chart.getTitle();
if (title != null) title.setPaint(Color.black);
}
代码示例来源:origin: org.cytoscape/network-analyzer-impl
/**
* Updates the axis-related properties of a plot.
*
* @param aPlot
* Plot to be updated.
* @param aAxes
* Axis-related visual settings to be applied.
* @param aGrid
* Grid-related visual settings to be applied.
*/
private static void updateAxes(XYPlot aPlot, AxesSettings aAxes, GridSettings aGrid,
Range aDomainDataRange, Range aRangeDataRange) {
aPlot.setDomainAxis(createAxis(aAxes, true, aDomainDataRange));
aPlot.setRangeAxis(createAxis(aAxes, false, aRangeDataRange));
aPlot.setDomainGridlinesVisible(aGrid.getVerticalGridLines()); // set gridlines for X axis
aPlot.setDomainGridlinePaint(aGrid.getGridLinesColor()); // set color of domain gridline
aPlot.setRangeGridlinesVisible(aGrid.getHorizontalGridLines()); // set gridlines for Y axis
aPlot.setRangeGridlinePaint(aGrid.getGridLinesColor()); // set color of range gridline
}
内容来源于网络,如有侵权,请联系作者删除!