use of org.jfree.chart.axis.NumberAxis in project series-rest-api by 52North.
the class ChartIoHandler method createRangeAxis.
public ValueAxis createRangeAxis(DatasetOutput metadata) {
NumberAxis axis = new NumberAxis(createRangeLabel(metadata));
axis.setTickLabelFont(LabelConstants.FONT_LABEL);
axis.setLabelFont(LabelConstants.FONT_LABEL);
axis.setTickLabelPaint(LabelConstants.COLOR);
axis.setLabelPaint(LabelConstants.COLOR);
return axis;
}
use of org.jfree.chart.axis.NumberAxis in project cubrid-manager by CUBRID.
the class ChartCompositePart method createChart.
/**
* Create the chart
*
* @return the instance of JFreeChart
*/
private JFreeChart createChart() {
timeseriescollection = new TimeSeriesCollection();
seriesMap = new TreeMap<String, TimeSeries>();
xylineandshaperenderer = new XYLineAndShapeRenderer(true, false);
int number = 0;
for (Map.Entry<String, String> entry : valueMap.entrySet()) {
String key = entry.getKey();
TimeSeries series = new TimeSeries(key);
seriesMap.put(key, series);
if (settingMap.get(key).isChecked()) {
timeseriescollection.addSeries(series);
RGB seriesRgb = settingMap.get(key).getSeriesRgb();
float width = settingMap.get(key).getWidth();
Color color = new Color(seriesRgb.red, seriesRgb.green, seriesRgb.blue);
xylineandshaperenderer.setSeriesPaint(number, color);
xylineandshaperenderer.setSeriesStroke(number, new BasicStroke(width, 0, 2));
number++;
}
}
DateAxis dateaxis = new DateAxis("");
NumberAxis numberaxis = new NumberAxis("");
dateaxis.setTickLabelFont(new Font("SansSerif", 0, 10));
dateaxis.setLabelFont(new Font("SansSerif", 0, 7));
XYPlot xyplot = new XYPlot(timeseriescollection, dateaxis, numberaxis, xylineandshaperenderer);
RectangleInsets rectangleInsets = new RectangleInsets();
xyplot.setAxisOffset(rectangleInsets);
xyplot.setDomainGridlineStroke(new BasicStroke(0.4f));
xyplot.setRangeGridlineStroke(new BasicStroke(0.4f));
xyplot.setOutlineVisible(false);
xyplot.setBackgroundPaint(Color.BLACK);
xyplot.setDomainGridlinePaint(new Color(0, 128, 64));
xyplot.setRangeGridlinePaint(new Color(0, 128, 64));
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
dateaxis.setTickLabelsVisible(true);
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
numberaxis.setLowerMargin(0.01D);
numberaxis.setUpperMargin(0.01D);
JFreeChart chart = new JFreeChart(chartTitle, new Font("SansSerif", 1, 15), xyplot, false);
chart.setBorderVisible(false);
chart.setBorderStroke(new BasicStroke(0.0f));
return chart;
}
use of org.jfree.chart.axis.NumberAxis in project cubrid-manager by CUBRID.
the class ReplicationMonitorViewPart method createChart.
/**
* Create chart unit
*
* @return chart
*/
private JFreeChart createChart() {
//create data set
replTimeSeries = new TimeSeries(Messages.msgDelayValue + " ");
replTimeSeries.setMaximumItemAge(2592000);
TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
timeseriescollection.addSeries(replTimeSeries);
//create X axis
DateAxis dateaxis = new DateAxis(Messages.msgSlaveTimes);
dateaxis.setTickLabelFont(new Font("SansSerif", 0, 10));
dateaxis.setLabelFont(new Font("SansSerif", 0, 7));
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
dateaxis.setTickLabelsVisible(true);
//create Y axis
NumberAxis numberaxis = new NumberAxis(Messages.msgDelayValue);
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
//create display model
XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(true, true);
xylineandshaperenderer.setSeriesPaint(0, new Color(146, 208, 80));
xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(2F, 0, 2));
XYPlot xyplot = new XYPlot(timeseriescollection, dateaxis, numberaxis, xylineandshaperenderer);
//set backcolor of grid
xyplot.setBackgroundPaint(Color.BLACK);
//set vertical line color of grid
xyplot.setDomainGridlinePaint(new Color(130, 130, 130));
//set horizontal line color of grid
xyplot.setRangeGridlinePaint(new Color(130, 130, 130));
xyplot.setAxisOffset(new RectangleInsets(0D, 0D, 0D, 10D));
JFreeChart chart = new JFreeChart(Messages.titlePerformancePart, new Font("SansSerif", 1, 15), xyplot, true);
return chart;
}
use of org.jfree.chart.axis.NumberAxis in project bamboobsc by billchen198318.
the class CommonBarChartAction method fillChart.
private void fillChart(String title, String categoryLabel, String valueLabel, List<String> names, List<Float> values, List<String> colors, boolean horizontal) throws Exception {
DefaultCategoryDataset data = new DefaultCategoryDataset();
for (int ix = 0; ix < names.size(); ix++) {
data.addValue(values.get(ix), "", names.get(ix));
}
this.chart = ChartFactory.createBarChart3D(// title
title, categoryLabel, valueLabel, data, (horizontal ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL), false, false, false);
CategoryPlot plot = (CategoryPlot) this.chart.getPlot();
CategoryAxis categoryAxis = plot.getDomainAxis();
categoryAxis.setLabelFont(new Font("", Font.TRUETYPE_FONT, 9));
categoryAxis.setTickLabelFont(new Font("", Font.TRUETYPE_FONT, 9));
NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis();
numberAxis.setLabelFont(new Font("", Font.TRUETYPE_FONT, 9));
this.setPlotColor(plot, names, colors);
this.chart.setTitle(new TextTitle(title, new Font("", Font.TRUETYPE_FONT, 9)));
}
use of org.jfree.chart.axis.NumberAxis in project jgnash by ccavanaugh.
the class SecuritiesHistoryDialog method createChart.
private static JFreeChart createChart(final SecurityNode node) {
Objects.requireNonNull(node);
final List<SecurityHistoryNode> hNodes = node.getHistoryNodes();
final Date max = DateUtils.asDate(hNodes.get(hNodes.size() - 1).getLocalDate());
final Date min = DateUtils.asDate(hNodes.get(0).getLocalDate());
final DateAxis timeAxis = new DateAxis(null);
timeAxis.setVisible(false);
timeAxis.setAutoRange(false);
timeAxis.setRange(min, max);
final NumberAxis valueAxis = new NumberAxis(null);
valueAxis.setAutoRangeIncludesZero(false);
valueAxis.setVisible(false);
final XYAreaRenderer renderer = new XYAreaRenderer();
renderer.setBaseToolTipGenerator(new SecurityItemLabelGenerator(node));
renderer.setOutline(true);
renderer.setSeriesPaint(0, new Color(225, 247, 223));
final XYPlot plot = new XYPlot(null, timeAxis, valueAxis, renderer);
final List<List<SecurityHistoryNode>> groups = node.getHistoryNodeGroupsBySplits();
for (int i = 0; i < groups.size(); i++) {
int size = groups.get(i).size();
Date[] date = new Date[size];
double[] high = new double[size];
double[] low = new double[size];
double[] open = new double[size];
double[] close = new double[size];
double[] volume = new double[size];
for (int j = 0; j < size; j++) {
final SecurityHistoryNode hNode = groups.get(i).get(j);
date[j] = DateUtils.asDate(hNode.getLocalDate());
high[j] = hNode.getAdjustedHigh().doubleValue();
low[j] = hNode.getAdjustedLow().doubleValue();
open[j] = hNode.getAdjustedPrice().doubleValue();
close[j] = hNode.getAdjustedPrice().doubleValue();
volume[j] = hNode.getVolume();
}
final AbstractXYDataset data = new DefaultHighLowDataset(node.getDescription() + i, date, high, low, open, close, volume);
plot.setDataset(i, data);
}
plot.setInsets(new RectangleInsets(1, 1, 1, 1));
final JFreeChart chart = new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, false);
chart.setBackgroundPaint(null);
return chart;
}
Aggregations