use of org.jfree.chart.renderer.xy.XYLineAndShapeRenderer in project cubrid-manager by CUBRID.
the class StatusMonitorViewPart method createChart.
/**
* Creates chart unit
*
* @param unitNumber the number of unit
* @return JFreeChart
*/
private JFreeChart createChart(int unitNumber) {
String currentLbl = "Current";
current[unitNumber] = new TimeSeries(currentLbl);
current[unitNumber].setMaximumItemAge(18000000);
String minLbl = "Min";
minimum[unitNumber] = new TimeSeries(minLbl);
minimum[unitNumber].setMaximumItemAge(18000000);
String maxLbl = "Max";
maximum[unitNumber] = new TimeSeries(maxLbl);
maximum[unitNumber].setMaximumItemAge(18000000);
String avgLbl = "Avg";
average[unitNumber] = new TimeSeries(avgLbl);
average[unitNumber].setMaximumItemAge(18000000);
TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
timeseriescollection.addSeries(current[unitNumber]);
timeseriescollection.addSeries(minimum[unitNumber]);
timeseriescollection.addSeries(maximum[unitNumber]);
timeseriescollection.addSeries(average[unitNumber]);
DateAxis dateaxis = new DateAxis("");
NumberAxis numberaxis = new NumberAxis("");
dateaxis.setTickLabelFont(new Font("SansSerif", 0, 10));
dateaxis.setLabelFont(new Font("SansSerif", 0, 7));
XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(true, false);
xylineandshaperenderer.setSeriesPaint(0, new Color(146, 208, 80));
xylineandshaperenderer.setSeriesPaint(1, new Color(166, 166, 166));
xylineandshaperenderer.setSeriesPaint(2, new Color(74, 126, 187));
xylineandshaperenderer.setSeriesPaint(3, new Color(255, 51, 0));
xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(2F, 0, 2));
xylineandshaperenderer.setSeriesStroke(3, new BasicStroke(2F, 0, 2));
XYPlot xyplot = new XYPlot(timeseriescollection, dateaxis, numberaxis, xylineandshaperenderer);
xyplot.setBackgroundPaint(Color.BLACK);
xyplot.setDomainGridlinePaint(new Color(130, 130, 130));
xyplot.setRangeGridlinePaint(new Color(130, 130, 130));
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
dateaxis.setTickLabelsVisible(true);
numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
JFreeChart chart = new JFreeChart(monitorList.get(unitNumber).getChartTitle(), new Font("SansSerif", 1, 15), xyplot, false);
return chart;
}
use of org.jfree.chart.renderer.xy.XYLineAndShapeRenderer in project cubrid-manager by CUBRID.
the class CombinedBarTimeSeriesChart method createSeriesChart.
/**
* Create the series chart
*
* @return an instance of series chart
*/
private JFreeChart createSeriesChart() {
if (isAreaRender) {
seriesdataset = createTableSeriesDataset();
} else {
seriesdataset = createTimeSeriesDataset();
}
JFreeChart chart = ChartFactory.createTimeSeriesChart("", "", "", seriesdataset, false, false, false);
chart.setBorderVisible(false);
chart.setBorderStroke(new BasicStroke(0.0f));
//plot
XYPlot xyplot = (XYPlot) chart.getPlot();
xyplot.setOutlineVisible(false);
RectangleInsets rectangleInsets = new RectangleInsets();
xyplot.setAxisOffset(rectangleInsets);
xyplot.setDomainGridlineStroke(new BasicStroke(0.4f));
xyplot.setRangeGridlineStroke(new BasicStroke(0.4f));
xyplot.setBackgroundPaint(Color.BLACK);
xyplot.setDomainGridlinePaint(new Color(0, 128, 64));
xyplot.setRangeGridlinePaint(new Color(0, 128, 64));
if (isAreaRender) {
XYAreaRenderer2 render = new StackedXYAreaRenderer2();
render.setSeriesPaint(0, Color.GREEN);
render.setSeriesPaint(1, Color.RED);
xyplot.setRenderer(render);
} else {
XYLineAndShapeRenderer render = (XYLineAndShapeRenderer) xyplot.getRenderer();
render.setSeriesPaint(0, Color.GREEN);
render.setSeriesPaint(1, Color.RED);
}
//dateAxis
DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
dateaxis.setFixedAutoRange(300000d);
dateaxis.setLowerMargin(0.0D);
dateaxis.setUpperMargin(0.0D);
dateaxis.setVisible(isShowSeriesAxis);
numberaxis = (NumberAxis) xyplot.getRangeAxis();
numberaxis.setVisible(isShowSeriesAxis);
numberaxis.setRange(0 - 0.5, barMax + 0.5);
return chart;
}
use of org.jfree.chart.renderer.xy.XYLineAndShapeRenderer in project cubrid-manager by CUBRID.
the class MonitorStatisticChart method createChart.
public JFreeChart createChart() {
final Color backGroundColor = Color.WHITE;
//final Color backGroundColor = new Color(0xF0F0F0);
XYDataset dataset = createDataset();
final int seriesCount = dataset.getSeriesCount();
chart = ChartFactory.createTimeSeriesChart(chartTitle, timeAxisLabel, valueAxisLabel, dataset, true, true, false);
chart.setBackgroundPaint(backGroundColor);
if (!isHasValidData) {
int red = composite.getBackground().getRed();
int green = composite.getBackground().getGreen();
int blue = composite.getBackground().getBlue();
chart.setBackgroundPaint(new Color(red, green, blue));
chart.setBackgroundImageAlpha(0.0f);
}
XYPlot plot = (XYPlot) chart.getPlot();
if (!isHasValidData) {
setNoDataPlot(plot);
} else {
setDataPlot(plot);
chart.getLegend().setBackgroundPaint(Color.white);
}
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
for (int i = 0; i < seriesCount; i++) {
renderer.setSeriesPaint(i, colorAr[i % colorAr.length]);
}
return chart;
}
use of org.jfree.chart.renderer.xy.XYLineAndShapeRenderer in project uncommons-maths by dwdyer.
the class GraphPanel method generateGraph.
public void generateGraph(String title, Map<Double, Double> observedValues, Map<Double, Double> expectedValues, double expectedMean, double expectedStandardDeviation, boolean discrete) {
XYSeriesCollection dataSet = new XYSeriesCollection();
XYSeries observedSeries = new XYSeries("Observed");
dataSet.addSeries(observedSeries);
XYSeries expectedSeries = new XYSeries("Expected");
dataSet.addSeries(expectedSeries);
for (Map.Entry<Double, Double> entry : observedValues.entrySet()) {
observedSeries.add(entry.getKey(), entry.getValue());
}
for (Map.Entry<Double, Double> entry : expectedValues.entrySet()) {
expectedSeries.add(entry.getKey(), entry.getValue());
}
JFreeChart chart = ChartFactory.createXYLineChart(title, "Value", "Probability", dataSet, PlotOrientation.VERTICAL, true, false, false);
XYPlot plot = (XYPlot) chart.getPlot();
if (discrete) {
// Render markers at each data point (these discrete points are the
// distibution, not the lines between them).
plot.setRenderer(new XYLineAndShapeRenderer());
} else {
// Render smooth lines between points for a continuous distribution.
XYSplineRenderer renderer = new XYSplineRenderer();
renderer.setBaseShapesVisible(false);
plot.setRenderer(renderer);
}
chartPanel.setChart(chart);
}
use of org.jfree.chart.renderer.xy.XYLineAndShapeRenderer in project processdash by dtuma.
the class AbstractEVXYChart method createXYLineAndShapeRenderer.
protected XYItemRenderer createXYLineAndShapeRenderer(boolean lines, boolean shapes) {
XYItemRenderer renderer = new XYLineAndShapeRenderer(lines, shapes);
renderer.setLegendItemLabelGenerator(new SeriesNameGenerator());
renderer.setBaseToolTipGenerator(getTooltipGenerator());
return renderer;
}
Aggregations