私はJFreeChart
について質問があります:BoxAndWhiskerChart
のPlotOrientation
を水平に変更できますか?ヒストグラムがあり、下にを追加したいと思います。私はそれが同じ軸スケールを使用することができるように水平にする必要があります。 Plot
とChartPanel
の方向を変更しようとしました。BoxAndWhiskerChartのPlotOrientation JFreeChart
2
A
答えて
1
@Catalina島はPlotOrientation
hereを変更する正しい方法を示していますが、PlotOrientation.HORIZONTAL
のために、以下に示すBoxAndWhiskerRenderer
のバグに遭遇することがあります。下のウィスカーの切り捨てられた線に注意してください。
問題がdrawHorizontalItem()
でhere次のとおりです。
g2.draw(new Line2D.Double(xxMin, yymid - halfW, xxMin, yy + halfW));
このあるべき:
g2.draw(new Line2D.Double(xxMin, yymid - halfW, xxMin, yymid + halfW));
テストとしてコード:
import java.awt.Dimension;
import java.awt.EventQueue;
import java.util.Arrays;
import javax.swing.JFrame;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset;
/**
* @see https://stackoverflow.com/a/38407595/230513
*/
public class BoxPlot {
private void display() {
JFrame f = new JFrame("BoxPlot");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
DefaultBoxAndWhiskerCategoryDataset data = new DefaultBoxAndWhiskerCategoryDataset();
data.add(Arrays.asList(30, 36, 46, 55, 65, 76, 81, 80, 71, 59, 44, 34), "Planet", "Endor");
JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(
"Box and Whisker Chart", "Planet", "Temperature", data, false);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setOrientation(PlotOrientation.HORIZONTAL);
f.add(new ChartPanel(chart) {
@Override
public Dimension getPreferredSize() {
return new Dimension(500, 300);
}
});
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
public static void main(String[] args) {
EventQueue.invokeLater(new BoxPlot()::display);
}
}
1
あなたはこのようなCategoryPlot
にPlotOrientation
を変更することができます。
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setOrientation(PlotOrientation.HORIZONTAL);
関連する問題
- 1. JfreeChartのマウスイベント
- 2. Jfreechartの点線
- 3. JFreeChart Coldfusionのダイヤルチャート
- 4. JFreeChartのグラフプロット
- 5. JfreeChartのカスタムデータポイントラベル
- 6. JFreeChart DialPlotのGradientBackground
- 7. JFreeChartのギャップ
- 8. JFreeChartラベルの幅
- 9. JFreeChartの棒チャートバーユニット
- 10. jfreechartのohlcグラフ
- 11. Jfreechartの3Dチャート
- 12. JFreeChartのohlcチャート
- 13. ScatterPlotDemo-JfreeChart
- 14. JFreechartフィリングセクタシリーズ
- 15. Jfreechartアノテーションが消える
- 16. XYプロットのJFreechartカラースクエアグリッド
- 17. JFreeChartのドラッグアンドドロップ機能
- 18. JFreeChartの基本ヒストグラム
- 19. X軸のJFreeChartテーブル?
- 20. Jfreechart動的チャート
- 21. スパンはJFreeChart
- 22. JFreeChart&Lazy loading
- 23. JFreechart with below table
- 24. JFreechart XYPlotオーバーラップデータアーティファクト
- 25. はJFreeChartラインチャート
- 26. JFreeChart最大ズームアウト
- 27. はJFreeChartなTimeSeries
- 28. Java jfreechart stick scatterplot?
- 29. 動的Jfreechart
- 30. JFreechart LookUpPaintScaleカラーグラデーション
[こちら](http://www.jfree.org/forum/viewtopic.php?f=3&t=117622)のレポートと修正が提出されました。 – trashgod