Example usage for org.jfree.chart.axis NumberAxis getLabelPaint

List of usage examples for org.jfree.chart.axis NumberAxis getLabelPaint

Introduction

In this page you can find the example usage for org.jfree.chart.axis NumberAxis getLabelPaint.

Prototype

public Paint getLabelPaint() 

Source Link

Document

Returns the color/shade used to draw the axis label.

Usage

From source file:com.hazelcast.monitor.server.MChartGenerator.java

@Override
protected void afterPlot(List<? super InstanceStatistics> list, JFreeChart chart, XYPlot plot) {
    NumberAxis sizeAxis = (NumberAxis) plot.getRangeAxis(0);
    Font labelFont = sizeAxis.getLabelFont();
    Paint labelPaint = sizeAxis.getLabelPaint();
    TimeSeries tm = new TimeSeries("memory");
    for (int i = 0; i < list.size(); i++) {
        double memory = 0;
        MapStatistics mapStatistics = (MapStatistics) list.get(i);
        for (MapStatistics.LocalMapStatistics localMapStatistics : mapStatistics.getListOfLocalStats()) {
            memory = memory + localMapStatistics.ownedEntryMemoryCost + localMapStatistics.backupEntryMemoryCost
                    + localMapStatistics.markedAsRemovedMemoryCost;
        }/*from w w w. ja v a 2 s.c om*/
        double mem = new Double(memory / (double) (1024 * 1024));
        tm.addOrUpdate(new Second(((MapStatistics) list.get(i)).getCreatedDate()), mem);
    }
    NumberAxis memoryAxis = new NumberAxis("memory (MB)");
    memoryAxis.setAutoRange(true);
    memoryAxis.setAutoRangeIncludesZero(false);
    plot.setDataset(1, new TimeSeriesCollection(tm));
    plot.setRangeAxis(1, memoryAxis);
    plot.mapDatasetToRangeAxis(1, 1);
    plot.setRenderer(1, new StandardXYItemRenderer());
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    increaseRange(memoryAxis);
    memoryAxis.setLabelFont(labelFont);
    memoryAxis.setLabelPaint(labelPaint);
}