Java 更改记号标签中行之间的间距
我需要实现一个新的“图形生成器”。为了说明这一要求,我将展示一个使用旧生成器的输出示例,以及我正在尝试开发的生成器的输出(或者我到目前为止从哪里得到的) 我现在的主要问题是刻度标签上线条之间的间距。图像必须是600x150,所以我需要尽可能多地压缩图形的文本部分(它不需要在视觉上很漂亮),但到目前为止我还没有找到任何合适的代码 实际上,我需要尽可能地消除“白色间距”。如果有人知道如何实现以下内容,我将不胜感激:Java 更改记号标签中行之间的间距,java,charts,jfreechart,Java,Charts,Jfreechart,我需要实现一个新的“图形生成器”。为了说明这一要求,我将展示一个使用旧生成器的输出示例,以及我正在尝试开发的生成器的输出(或者我到目前为止从哪里得到的) 我现在的主要问题是刻度标签上线条之间的间距。图像必须是600x150,所以我需要尽可能多地压缩图形的文本部分(它不需要在视觉上很漂亮),但到目前为止我还没有找到任何合适的代码 实际上,我需要尽可能地消除“白色间距”。如果有人知道如何实现以下内容,我将不胜感激: 消除图表标题和图表本身之间的白色间隙 去除勾号标签和图像两端之间的白色间隙 删
- 消除图表标题和图表本身之间的白色间隙李>
- 去除勾号标签和图像两端之间的白色间隙李>
- 删除表示图表底部刻度的浅灰色线。现在,记号标签和这条线是重叠的
CategoryPlot categoryplot = lineChart.getCategoryPlot();
lineChart.setTitle(
new org.jfree.chart.title.TextTitle(lineChart.getTitle().getText(),
new Font("SansSerif", Font.PLAIN, 10)
)
);
lineChart.setBackgroundPaint(Color.white);
categoryplot.setBackgroundPaint(Color.WHITE);
CategoryAxis domainAxis = new CategoryAxis();
domainAxis.setMaximumCategoryLabelLines(4);
categoryplot.setDomainAxis(domainAxis);
Font font = new Font("Courier", Font.PLAIN, 8);
categoryplot.getDomainAxis().setTickLabelFont(font);
categoryplot.getDomainAxis().setCategoryLabelPositionOffset(-6);
categoryplot.getDomainAxis().setTickLabelInsets(
new RectangleInsets(1.0, 1.0, 1.0, 1.0));
NumberAxis yAxis = (NumberAxis) categoryplot.getRangeAxis();
yAxis.setAutoRangeIncludesZero(false);
categoryplot.getRenderer().setSeriesStroke(
1,
new BasicStroke(
2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
1.0f, new float[] {6.0f, 6.0f}, 0.0f
)
);
categoryplot.setDomainGridlinesVisible(true);
categoryplot.setRangeGridlinesVisible(true);
categoryplot.setDomainGridlinePaint(Color.GRAY);
categoryplot.setRangeGridlinePaint(Color.GRAY);
categoryplot.getRenderer().setSeriesStroke(
2,
new BasicStroke(
2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
1.0f, new float[] {6.0f, 6.0f}, 0.0f
)
);
categoryplot.getRenderer().setSeriesPaint(0, Color.BLUE);
categoryplot.getRenderer().setSeriesPaint(1, Color.RED);
categoryplot.getRenderer().setSeriesPaint(2, Color.RED);
LineAndShapeRenderer renderer = (LineAndShapeRenderer) categoryplot.getRenderer();
renderer.setBaseShapesVisible(true);
renderer.setDrawOutlines(true);
renderer.setUseFillPaint(true);
renderer.setBaseFillPaint(Color.white);
renderer.setSeriesShape(0, new Ellipse2D.Double(-5, -5, 10, 10));