我正在开发堆积区域图表,并在绘图时给出问题。我需要以精确的x轴值开始和结束绘图,但目前我的图表用x轴值的中间绘制。
当前输出:
需要结束并从类型3位置开始为红色值。
enter code here:
chart.setBackgroundPaint(Color.white); final CategoryPlot plot =(CategoryPlot)chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); final NumberAxis rangeAxis =(NumberAxis)plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickU nits()); final CategoryItemRenderer renderer = plot.getRenderer(); renderer.setItemLabelsVisible(真);
我遇到过同样的问题。我解决了它,使其他StackedArea
s的数据接近零数字与零本身。这是我用代码和解决方案制作的JFree forum post。
似乎这将是一个问题,任何时候数据列出的StackedAreaRenderer
的下限为0值。在我的代码中,我现在检查数据是否为零,并将数据点替换为接近零值,这样就得到了我正在寻找的图。