use of org.jfree.chart.ui.RectangleInsets in project series-rest-api by 52North.
the class ChartIoHandler method createPlotArea.
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;
}
use of org.jfree.chart.ui.RectangleInsets in project series-rest-api by 52North.
the class ChartIoHandler method addNotice.
private void addNotice(JFreeChart chart) {
TextTitle notice = new TextTitle();
String msg = i18n.get("msg.io.chart.notice");
if (msg != null && !msg.isEmpty()) {
notice.setText(msg);
notice.setPaint(Color.BLACK);
notice.setFont(LabelConstants.FONT_LABEL_SMALL);
notice.setPosition(RectangleEdge.BOTTOM);
notice.setHorizontalAlignment(HorizontalAlignment.RIGHT);
notice.setVerticalAlignment(VerticalAlignment.BOTTOM);
notice.setPadding(new RectangleInsets(0, 0, 20, 20));
chart.addSubtitle(notice);
}
}
use of org.jfree.chart.ui.RectangleInsets in project MassBank-web by MassBank.
the class Contents method drawDataset.
private static JFreeChart drawDataset(PieDataset dataset, String title) {
// JFreeChartオブジェクト生成
JFreeChart chart = ChartFactory.createPieChart(title, dataset, true, true, false);
// グラフ全体背景色設定
chart.setBackgroundPaint(new ChartColor(242, 246, 255));
// グラフ全体境界線設定
chart.setBorderVisible(true);
// グラフエリアパディング設定
chart.setPadding(new RectangleInsets(10, 10, 10, 10));
// グラフタイトルフォント設定
chart.getTitle().setFont(new Font("Arial", Font.BOLD, 22));
// 凡例の表示位置設定
LegendTitle legend = chart.getLegend();
legend.setPosition(RectangleEdge.RIGHT);
// 凡例パディング設定
legend.setPadding(10, 10, 10, 10);
// 凡例マージン設定
legend.setMargin(0, 10, 0, 5);
// 凡例表示位置上寄せ
legend.setVerticalAlignment(VerticalAlignment.TOP);
// グラフの描画領域を取得
PiePlot plot = (PiePlot) chart.getPlot();
// グラフの楕円表示を許可する
plot.setCircular(true);
// グラフ境界線色設定
plot.setDefaultSectionOutlinePaint(ChartColor.BLACK);
// グラフラベル背景色設定
plot.setLabelBackgroundPaint(new Color(240, 255, 255));
// グラフラベルフォント設定
plot.setLabelFont(new Font("Arial", Font.PLAIN, 12));
// グラフラベル幅設定
plot.setMaximumLabelWidth(0.3);
// グラフラベル間距離設定
plot.setLabelGap(0.05);
// グラフ前景色透明度設定
plot.setForegroundAlpha(0.9f);
return chart;
}
use of org.jfree.chart.ui.RectangleInsets in project dhis2-core by dhis2.
the class DefaultChartService method getMarker.
/**
* Returns a horizontal line marker for the given x value and label.
*/
private Marker getMarker(Double value, String label) {
Marker marker = new ValueMarker(value);
marker.setPaint(Color.BLACK);
marker.setStroke(new BasicStroke(1.1f));
marker.setLabel(label);
marker.setLabelOffset(new RectangleInsets(-10, 50, 0, 0));
marker.setLabelFont(SUB_TITLE_FONT);
return marker;
}
Aggregations