Example usage for java.awt Color lightGray

List of usage examples for java.awt Color lightGray

Introduction

In this page you can find the example usage for java.awt Color lightGray.

Prototype

Color lightGray

To view the source code for java.awt Color lightGray.

Click Source Link

Document

The color light gray.

Usage

From source file:speedbagalg.OscopeView.java

/**
 * Creates new form OscopeView/*from  ww w  . j a  v  a 2  s  . c  o  m*/
 */
/*    
    public OscopeView(String fileName)
    {
this.fileName = fileName;
initComponents();
updateThread = new RunnableMember2(this, "updateGUI");
ChartFactory.setChartTheme(new StandardChartTheme("JFree/Shadow", true));
// create a dataset...
int maxAge = 2400;
this.xData = new TimeSeries("X axis");
this.xData.setMaximumItemAge(maxAge);
this.yData = new TimeSeries("Y axis");
this.yData.setMaximumItemAge(maxAge);
this.zData = new TimeSeries("Z axis");
this.zData.setMaximumItemAge(maxAge);
this.averageData = new TimeSeries("Avg. Data");
this.averageData.setMaximumItemAge(maxAge);
//this.windSpeedSeries = new TimeSeries("Wind Speed");
//this.windSpeedSeries.setMaximumItemAge(maxAge);
//this.rainSeries = new TimeSeries("Rain 24hrs");
//this.rainSeries.setMaximumItemAge(maxAge);
        
final TimeSeriesCollection dataset = new TimeSeriesCollection();
dataset.addSeries(xData);
dataset.addSeries(yData);
dataset.addSeries(zData);
dataset.addSeries(averageData);
        
//dataset.addSeries(windSpeedSeries);
//dataset.addSeries(rainSeries);
final JFreeChart chart = ChartFactory.createTimeSeriesChart(
        "Accel Data",
        "Time",
        "Value",
        dataset,
        true,
        true,
        false);
final XYPlot plot = chart.getXYPlot();
        
ValueAxis axis = plot.getDomainAxis();
axis.setAutoRange(true);
axis = plot.getRangeAxis();
axis.setRange(-1000.0, 10000.0);
        
chart.setBackgroundPaint(Color.white);
        
//XYPlot plot = (XYPlot) chart.getPlot();
plot.setBackgroundPaint(Color.lightGray);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
plot.setDomainCrosshairVisible(true);
plot.setRangeCrosshairVisible(true);
        
// create and display a frame...
thePanel = new ChartPanel(chart);
        
Dimension d = new Dimension(200, 100);
thePanel.setSize(d);
thePanel.setPreferredSize(d);
BorderLayout layout = new BorderLayout();
jPanelOscope.setLayout(layout);
jPanelOscope.add(thePanel, BorderLayout.CENTER);
        
plotXCheckBox.setSelected(plotX);
plotYCheckBox.setSelected(plotY);
plotZCheckBox.setSelected(plotZ);
    }
*/
public OscopeView(String fileName) {
    this.fileName = fileName;
    initComponents();
    updateThread = new RunnableMember2(this, "updateGUI");
    ChartFactory.setChartTheme(new StandardChartTheme("JFree/Shadow", true));
    // create a dataset...
    this.xData = new XYSeries("Min");
    //this.xData.setMaximumItemAge(maxAge);
    this.yData = new XYSeries("Peak");
    //this.yData.setMaximumItemAge(maxAge);
    this.zData = new XYSeries("Z axis");
    //this.zData.setMaximumItemAge(maxAge);
    this.averageData = new XYSeries("Avg. Data");
    //this.averageData.setMaximumItemAge(maxAge);
    //this.windSpeedSeries = new TimeSeries("Wind Speed");
    //this.windSpeedSeries.setMaximumItemAge(maxAge);
    //this.rainSeries = new TimeSeries("Rain 24hrs");
    //this.rainSeries.setMaximumItemAge(maxAge);

    final XYSeriesCollection dataset = new XYSeriesCollection();
    //SlidingCategoryDataset dataset = new SlidingCategoryDataset(0, 10);
    dataset.addSeries(xData);
    dataset.addSeries(yData);
    dataset.addSeries(zData);
    dataset.addSeries(averageData);

    //dataset.addSeries(windSpeedSeries);
    //dataset.addSeries(rainSeries);
    chart = ChartFactory.createXYLineChart("Accel Data", "Time", "Value", dataset, PlotOrientation.VERTICAL,
            true, true, false);
    final XYPlot plot = chart.getXYPlot();

    ValueAxis axis = plot.getDomainAxis();
    axis.setAutoRange(false);
    axis.setRange(minStart, maxDomain);
    axis = plot.getRangeAxis();
    axis.setRange(vMin, vMax);

    chart.setBackgroundPaint(Color.white);

    //XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    // create and display a frame...
    thePanel = new ChartPanel(chart);

    Dimension d = new Dimension(200, 100);
    thePanel.setSize(d);
    thePanel.setPreferredSize(d);
    BorderLayout layout = new BorderLayout();
    jPanelOscope.setLayout(layout);
    jPanelOscope.add(thePanel, BorderLayout.CENTER);

    plotXCheckBox.setSelected(plotX);
    plotYCheckBox.setSelected(plotY);
    plotZCheckBox.setSelected(plotZ);

    vMaxSpinner.setValue(vMax);
}

From source file:org.jfree.chart.demo.PlotOrientationDemo.java

/**
 * Creates a sample chart./*from   ww  w .  j ava2s . c om*/
 * 
 * @param index  the chart index.
 * @param dataset  the dataset.
 * 
 * @return A chart.
 */
private JFreeChart createChart(int index, XYDataset dataset) {

    // create the chart...
    JFreeChart chart = ChartFactory.createXYLineChart("Chart " + (index + 1), // chart title
            "X", // x axis label
            "Y", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, false, // include legend
            false, // tooltips
            false // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.lightGray);
    //        plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    StandardXYItemRenderer renderer = (StandardXYItemRenderer) plot.getRenderer();
    renderer.setPlotShapes(true);
    renderer.setShapesFilled(true);
    // change the auto tick unit selection to integer units only...
    ValueAxis domainAxis = plot.getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    ValueAxis rangeAxis = plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:org.hxzon.demo.jfreechart.DatasetVisibleDemo.java

private static JFreeChart createTimeSeriesChart(XYDataset dataset) {
    //DomainAxis/*w w  w. j  av a 2  s .  c  o  m*/
    DateAxis timeAxis = new DateAxis("");
    timeAxis.setLowerMargin(0.02); // reduce the default margins
    timeAxis.setUpperMargin(0.02);
    timeAxis.setDateFormatOverride(new SimpleDateFormat("MM-yyyy"));
    //RangeAxis
    NumberAxis valueAxis = new NumberAxis("");
    valueAxis.setAutoRangeIncludesZero(false); // override default
    //        valueAxis.setAutoRange(false);
    //        valueAxis.setDefaultAutoRange(new Range(100, 1150));
    //Renderer
    XYToolTipGenerator toolTipGenerator = StandardXYToolTipGenerator.getTimeSeriesInstance();
    XYURLGenerator urlGenerator = null;
    //            urlGenerator = new StandardXYURLGenerator();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
    renderer.setBaseToolTipGenerator(toolTipGenerator);
    renderer.setURLGenerator(urlGenerator);
    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    renderer.setDrawSeriesLineAsPath(true);
    //Plot
    XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
    plot.setRenderer(renderer);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    //        plot.setRangePannable(true);
    //chart
    JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true);

    chart.setBackgroundPaint(Color.white);
    return chart;
}

From source file:org.hxzon.demo.jfreechart.XYDatasetDemo.java

private static JFreeChart createScatterChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createScatterPlot("Legal & General Unit Trust Prices", // title
            "Date", // x-axis label
            "Price Per Unit", // y-axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips?
            false // URLs?
    );/*from w w w  .  j  a  v a2 s  . c o  m*/

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setNumberFormatOverride(MyNumberFormat.getMyNumberFormat());

    return chart;

}

From source file:ReportGen.java

private void yearlyPreview() throws NumberFormatException {
    exportcounttableexcel.setEnabled(true);
    exportcounttablepdf.setEnabled(true);

    tableModel = (DefaultTableModel) dataTable.getModel();
    tableModel.getDataVector().removeAllElements();
    tableModel.fireTableDataChanged();/*from w w  w. j a  v  a  2s. c  o  m*/
    String str[] = { "Years", "Values" };
    tableModel.setColumnIdentifiers(str);
    ChartPanel chartPanel;
    displaypane.removeAll();
    displaypane.revalidate();
    displaypane.repaint();
    displaypane.setLayout(new BorderLayout());
    //row
    String series1 = "Results";
    //column
    String year[] = { "2014", "2015", "2016", "2017", "2018", "2019", "2020" };

    dataset = new DefaultCategoryDataset();
    dataset.addValue(0, series1, year[0]);
    dataset.addValue(1, series1, year[1]);
    dataset.addValue(2, series1, year[2]);
    dataset.addValue(3, series1, year[3]);
    dataset.addValue(4, series1, year[4]);
    dataset.addValue(5, series1, year[5]);
    dataset.addValue(6, series1, year[6]);

    chart = ChartFactory.createBarChart("181 North Place Residences Graph", // chart title
            "Years", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    // set the range axis to display integers only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    // disable bar outlines...
    final BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setDrawBarOutline(false);

    // set up gradient paints for series...
    final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray);
    final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray);
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    renderer.setSeriesPaint(2, gp2);

    final org.jfree.chart.axis.CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0));
    chartPanel = new ChartPanel(chart);
    displaypane.add(chartPanel, BorderLayout.CENTER);
}

From source file:com.lfv.lanzius.application.phoneonly.PhoneOnlyView.java

public void updateIndicators() {

    // Update dial button
    synchronized (lock) {

        Element eh = super.model.getRootElement().getChild("HookButton");

        // Get texts from model
        String textSource = DomTools.getAttributeString(eh, "src", "?", false);
        String textDest = DomTools.getAttributeString(eh, "dest", "?", false);

        // Get state from model
        String s = DomTools.getAttributeString(eh, "state", "idle", false);

        String sDial = "DIAL";
        String sHook = "INTERPHONE";
        Color cDial = Color.lightGray;

        if (s.equals("dialing")) {
            sDial = textSource + " > " + textDest;
            sHook = "RELEASE";
            cDial = Color.yellow;
        } else if (s.equals("busy")) {
            sDial = textSource + " ! " + textDest;
            sHook = "RELEASE";
            cDial = Color.red;/*from   w w w  . ja  v a 2 s  . co m*/
        } else if (s.equals("in_call")) {
            sDial = textSource + " - " + textDest;
            sHook = "RELEASE";
            cDial = Color.yellow;
        } else if (s.equals("ringing")) {
            sDial = textDest + " < " + textSource;
            sHook = "ANSWER";
            cDial = Color.yellow;
        }

        phoneOnlyContentPane.getDialLabel().setText(sDial);
        phoneOnlyContentPane.getHookButton().setBackground(cDial);
        phoneOnlyContentPane.getHookButton().setText(sHook);
        log.debug("Setting sDial = " + sDial + " setBackground:" + cDial + " setHook=" + sHook);
    }
}

From source file:com.eyeq.pivot4j.export.poi.ExcelExporter.java

protected CellStyle createHeaderCellStyle() {
    CellStyle style = workbook.createCellStyle();

    Font font = workbook.createFont();

    font.setFontName(fontFamily);//from  ww  w .  java 2  s .c o  m
    font.setFontHeightInPoints((short) fontSize);
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);

    style.setFont(font);
    style.setAlignment(CellStyle.ALIGN_LEFT);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

    switch (format) {
    case XSSF:
    case SXSSF:
        ((XSSFCellStyle) style).setFillForegroundColor(new XSSFColor(Color.lightGray));
        break;
    case HSSF:
        style.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
        break;
    default:
        assert false;
    }

    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    style.setBorderTop(CellStyle.BORDER_THIN);
    style.setBorderLeft(CellStyle.BORDER_THIN);
    style.setBorderRight(CellStyle.BORDER_THIN);
    style.setBorderBottom(CellStyle.BORDER_THIN);

    return style;
}

From source file:it.cnr.istc.iloc.gui.StateVariableVisualizer.java

@Override
public Collection<XYPlot> getPlots(Type type) {
    Collection<IItem> instances = type.getInstances();
    Collection<XYPlot> plots = new ArrayList<>(instances.size());
    Map<IItem, Collection<Atom>> sv_atoms = new IdentityHashMap<>(instances.size());
    for (IItem i : type.getInstances()) {
        sv_atoms.put(i, new ArrayList<>());
    }//from  w w w.j av a2s . c  o  m
    for (Atom atom : ((StateVariable) type).getDefinedPredicates().stream()
            .flatMap(p -> p.getInstances().stream()).map(a -> (Atom) a)
            .filter(a -> a.state.evaluate().isSingleton() && a.state.evaluate().contains(AtomState.Active))
            .collect(Collectors.toList())) {
        for (IItem i : ((IEnumItem) atom.get(SCOPE)).getEnumVar().evaluate().getAllowedValues()) {
            if (sv_atoms.containsKey(i)) {
                sv_atoms.get(i).add(atom);
            }
        }
    }

    for (IItem sv : instances) {
        Collection<Atom> atoms = sv_atoms.get(sv);
        // For each pulse the atoms starting at that pulse
        Map<Double, Collection<Atom>> starting_atoms = new HashMap<>(atoms.size());
        // For each pulse the atoms ending at that pulse
        Map<Double, Collection<Atom>> ending_atoms = new HashMap<>(atoms.size());

        // The pulses of the timeline
        Set<Double> c_pulses = new HashSet<>(atoms.size() * 2);

        for (Atom atom : atoms) {
            double start = sv.getCore().evaluate(((IArithItem) atom.get("start")).getArithVar());
            double end = sv.getCore().evaluate(((IArithItem) atom.get("end")).getArithVar());

            if (!starting_atoms.containsKey(start)) {
                starting_atoms.put(start, new ArrayList<>());
            }
            starting_atoms.get(start).add(atom);

            if (!ending_atoms.containsKey(end)) {
                ending_atoms.put(end, new ArrayList<>());
            }
            ending_atoms.get(end).add(atom);

            c_pulses.add(start);
            c_pulses.add(end);
        }

        // we sort current pulses..
        Double[] c_pulses_array = c_pulses.toArray(new Double[c_pulses.size()]);
        Arrays.sort(c_pulses_array);

        XYIntervalSeriesCollection collection = new XYIntervalSeriesCollection();

        ValueXYIntervalSeries undefined = new ValueXYIntervalSeries("Undefined");
        ValueXYIntervalSeries sv_values = new ValueXYIntervalSeries("Values");
        ValueXYIntervalSeries conflicts = new ValueXYIntervalSeries("Conflicts");

        List<Atom> overlapping_atoms = new ArrayList<>();
        for (int i = 0; i < c_pulses_array.length - 1; i++) {
            if (starting_atoms.containsKey(c_pulses_array[i])) {
                overlapping_atoms.addAll(starting_atoms.get(c_pulses_array[i]));
            }
            if (ending_atoms.containsKey(c_pulses_array[i])) {
                overlapping_atoms.removeAll(ending_atoms.get(c_pulses_array[i]));
            }
            switch (overlapping_atoms.size()) {
            case 0:
                undefined.add(c_pulses_array[i], c_pulses_array[i], c_pulses_array[i + 1], 0, 0, 1,
                        new Atom[0]);
                break;
            case 1:
                sv_values.add(c_pulses_array[i], c_pulses_array[i], c_pulses_array[i + 1], 0, 0, 1,
                        overlapping_atoms.toArray(new Atom[overlapping_atoms.size()]));
                break;
            default:
                conflicts.add(c_pulses_array[i], c_pulses_array[i], c_pulses_array[i + 1], 0, 0, 1,
                        overlapping_atoms.toArray(new Atom[overlapping_atoms.size()]));
                break;
            }
        }

        collection.addSeries(undefined);
        collection.addSeries(sv_values);
        collection.addSeries(conflicts);

        XYBarRenderer renderer = new XYBarRenderer();
        renderer.setSeriesPaint(0, Color.lightGray);
        renderer.setSeriesPaint(1, new Color(100, 250, 100));
        renderer.setSeriesPaint(2, Color.pink);
        renderer.setBarPainter(new ReverseGradientXYBarPainter());
        renderer.setDrawBarOutline(true);
        renderer.setShadowXOffset(2);
        renderer.setShadowYOffset(2);
        renderer.setUseYInterval(true);

        renderer.setBaseItemLabelsVisible(true);
        renderer.setBaseItemLabelPaint(Color.black);
        Font font = new Font("SansSerif", Font.PLAIN, 9);
        renderer.setBaseItemLabelFont(font);
        XYItemLabelGenerator generator = (XYDataset dataset, int series,
                int item) -> toString(((ValueXYIntervalDataItem) ((XYIntervalSeriesCollection) dataset)
                        .getSeries(series).getDataItem(item)).atoms);
        ItemLabelPosition itLabPos = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER);
        renderer.setBasePositiveItemLabelPosition(itLabPos);
        for (int i = 0; i < collection.getSeriesCount(); i++) {
            renderer.setSeriesItemLabelGenerator(i, generator);
            renderer.setSeriesItemLabelsVisible(i, true);
            renderer.setSeriesItemLabelPaint(i, Color.black);
            renderer.setSeriesItemLabelFont(i, font);
            renderer.setSeriesPositiveItemLabelPosition(i, itLabPos);
            renderer.setSeriesToolTipGenerator(i,
                    (XYDataset dataset, int series, int item) -> toString(
                            ((ValueXYIntervalDataItem) ((XYIntervalSeriesCollection) dataset).getSeries(series)
                                    .getDataItem(item)).atoms));
        }

        XYPlot plot = new XYPlot(collection, null, new NumberAxis(""), renderer);
        plot.getRangeAxis().setVisible(false);
        plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

        plots.add(plot);
    }

    return plots;
}

From source file:edu.ucla.stat.SOCR.chart.demo.LineChartDemo5.java

/**
 * Creates a sample chart./* ww w. j  av  a2  s  . co  m*/
 * 
 * @param dataset  the dataset.
 * 
 * @return a chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

    JFreeChart chart = ChartFactory.createLineChart(chartTitle, // chart title
            domainLabel, // domain axis label
            rangeLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            !legendPanelOn, // include legend
            true, // tooltips
            false // urls
    );

    chart.setBackgroundPaint(Color.white);

    Shape[] shapes = new Shape[3];
    int[] xpoints;
    int[] ypoints;

    // right-pointing triangle
    xpoints = new int[] { -3, 3, -3 };
    ypoints = new int[] { -3, 0, 3 };
    shapes[0] = new Polygon(xpoints, ypoints, 3);

    // vertical rectangle
    shapes[1] = new Rectangle2D.Double(-2, -3, 3, 6);

    // left-pointing triangle
    xpoints = new int[] { -3, 3, 3 };
    ypoints = new int[] { 0, -3, 3 };
    shapes[2] = new Polygon(xpoints, ypoints, 3);

    DrawingSupplier supplier = new DefaultDrawingSupplier(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, shapes);
    CategoryPlot plot = chart.getCategoryPlot();
    plot.setOrientation(PlotOrientation.HORIZONTAL);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setDrawingSupplier(supplier);

    // set the stroke for each series...
    plot.getRenderer().setSeriesStroke(0, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
            1.0f, new float[] { 10.0f, 6.0f }, 0.0f));
    plot.getRenderer().setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
            1.0f, new float[] { 6.0f, 6.0f }, 0.0f));
    plot.getRenderer().setSeriesStroke(2, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
            1.0f, new float[] { 2.0f, 6.0f }, 0.0f));

    // customise the renderer...
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

    // customise the range axis...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setAutoRangeIncludesZero(false);
    rangeAxis.setUpperMargin(0.12);

    setCategorySummary(dataset);
    return chart;

}

From source file:model.LineChart.java

/**
 * Creates a chart.//from w ww.  j a  v a  2s.c  o m
 *
 * @param dataset the data for the chart.
 *
 * @return a chart.
 */
private JFreeChart createChart(final XYDataset dataset, final int variableOption, final String machine) {

    String title = "";
    switch (variableOption) {
    case 0:
        title = "Quantity";
        break;
    case 1:
        title = "Size";
        break;
    default:
        title = "Type";
        break;
    }

    // create the chart...
    final JFreeChart chart = ChartFactory.createXYLineChart(title + " Line Chart: " + machine, // chart title
            title, // x axis label
            "Time", // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);

    //        final StandardLegend legend = (StandardLegend) chart.getLegend();
    //      legend.setDisplaySeriesShapes(true);
    // get a reference to the plot for further customisation...
    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.lightGray);
    //    plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesLinesVisible(0, false);
    renderer.setSeriesShapesVisible(1, false);
    plot.setRenderer(renderer);

    // change the auto tick unit selection to integer units only...
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}