Example usage for org.jfree.chart.axis DateTickUnitType DAY

List of usage examples for org.jfree.chart.axis DateTickUnitType DAY

Introduction

In this page you can find the example usage for org.jfree.chart.axis DateTickUnitType DAY.

Prototype

DateTickUnitType DAY

To view the source code for org.jfree.chart.axis DateTickUnitType DAY.

Click Source Link

Document

Day.

Usage

From source file:org.sunzoft.sunstock.StockMain.java

protected JFreeChart createChart() {
    // 2Chart[??]
    XYDataset dataset = initChartData();
    JFreeChart chart = ChartFactory.createTimeSeriesChart("", "", "", dataset);

    XYPlot xyplot = (XYPlot) chart.getPlot();

    //addIndexChart(xyplot);        

    ChartUtils.setAntiAlias(chart);// 
    ChartUtils.setTimeSeriesStyle(xyplot, false, true);
    ChartUtils.setLegendEmptyBorder(chart);

    // X??//  w w  w  .ja  va2  s  . c  om
    DateAxis domainAxis = (DateAxis) xyplot.getDomainAxis();
    domainAxis.setAutoTickUnitSelection(false);
    domainAxis.setTimeline(SegmentedTimeline.newMondayThroughFridayTimeline());

    DateTickUnit dateTickUnit;
    if (dataset.getItemCount(0) < 30)
        dateTickUnit = new DateTickUnit(DateTickUnitType.DAY, 5, new SimpleDateFormat("yyyy-MM-dd")); // ??
    else if (dataset.getItemCount(0) < 100)
        dateTickUnit = new DateTickUnit(DateTickUnitType.DAY, 10, new SimpleDateFormat("yyyy-MM-dd")); // ??
    else if (dataset.getItemCount(0) < 200)
        dateTickUnit = new DateTickUnit(DateTickUnitType.MONTH, 1, new SimpleDateFormat("yyyy/MM")); // ??
    else if (dataset.getItemCount(0) < 500)
        dateTickUnit = new DateTickUnit(DateTickUnitType.MONTH, 3, new SimpleDateFormat("yyyy/MM")); // ??
    else if (dataset.getItemCount(0) < 1000)
        dateTickUnit = new DateTickUnit(DateTickUnitType.MONTH, 6, new SimpleDateFormat("yyyy/MM")); // ??
    else
        dateTickUnit = new DateTickUnit(DateTickUnitType.YEAR, 1, new SimpleDateFormat("yyyy")); // ??
    // ??
    domainAxis.setTickUnit(dateTickUnit);
    return chart;
}

From source file:uk.ac.ed.epcc.webapp.charts.jfreechart.JFreeTimeChartData.java

private TickUnits getUnits(CalendarFieldSplitPeriod period) {
    int field = period.getField();
    boolean good_match = false;
    for (DateTickUnitType unit : new DateTickUnitType[] { DateTickUnitType.SECOND, DateTickUnitType.MINUTE,
            DateTickUnitType.HOUR, DateTickUnitType.DAY, DateTickUnitType.MONTH, DateTickUnitType.YEAR }) {
        if (field == unit.getCalendarField()) {
            TickUnits units = new TickUnits();
            int count = period.getCount();
            int nsplit = period.getNsplit();
            if (count == 1 && nsplit == 1) {
                return null; // let jfree work it out.
            }//from w w  w.  j av a2 s . co  m
            if (nsplit > 50) {
                return null; // period unit is too small
            }
            // include all multiples that are exact factors of count
            for (int i = 1; i <= count; i++) {
                if (count % i == 0) {
                    units.add(new DateTickUnit(unit, i));
                    if (i > 1 && (count / i) < 8) {
                        good_match = true;
                    }
                }
            }

            // now larger multiples of count that factor nsplit
            for (int i = 2; i < nsplit && i < 50; i++) {
                if (nsplit % i == 0) {
                    units.add(new DateTickUnit(unit, i * count));
                    if (i > 1 && (nsplit / i) < 8) {
                        good_match = true;
                    }
                }
            }

            if (good_match) {
                return units;
            }
            return null;
        }
    }
    return null;
}

From source file:MWC.GUI.JFreeChart.DateAxisEditor.java

public static TickUnits createStandardDateTickUnitsAsTickUnits() {
    final TickUnits units = new TickUnits();

    // milliseconds
    units.add(new OptimisedDateTickUnit(DateTickUnitType.MILLISECOND, 500, new RNFormatter("HH:mm:ss.SSS")));

    // seconds/*from  w  ww . jav  a 2s .  c o m*/
    units.add(new OptimisedDateTickUnit(DateTickUnitType.SECOND, 1, new RNFormatter("HH:mm:ss")));
    units.add(new OptimisedDateTickUnit(DateTickUnitType.SECOND, 5, new RNFormatter("HH:mm:ss")));
    units.add(new OptimisedDateTickUnit(DateTickUnitType.SECOND, 10, new RNFormatter("HH:mm:ss")));
    units.add(new OptimisedDateTickUnit(DateTickUnitType.SECOND, 30, new RNFormatter("HH:mm:ss")));

    // minutes
    units.add(new OptimisedDateTickUnit(DateTickUnitType.MINUTE, 1, new RNFormatter("HH:mm")));
    units.add(new OptimisedDateTickUnit(DateTickUnitType.MINUTE, 2, new RNFormatter("HH:mm")));
    units.add(new OptimisedDateTickUnit(DateTickUnitType.MINUTE, 5, new RNFormatter("HH:mm")));
    units.add(new OptimisedDateTickUnit(DateTickUnitType.MINUTE, 10, new RNFormatter("HH:mm")));
    units.add(new OptimisedDateTickUnit(DateTickUnitType.MINUTE, 15, new RNFormatter("HH:mm")));
    units.add(new OptimisedDateTickUnit(DateTickUnitType.MINUTE, 20, new RNFormatter("HH:mm")));
    units.add(new OptimisedDateTickUnit(DateTickUnitType.MINUTE, 30, new RNFormatter("HH:mm")));

    // hours
    units.add(new OptimisedDateTickUnit(DateTickUnitType.HOUR, 1, new RNFormatter("HH:mm")));
    units.add(new OptimisedDateTickUnit(DateTickUnitType.HOUR, 2, new RNFormatter("HH:mm")));
    units.add(new OptimisedDateTickUnit(DateTickUnitType.HOUR, 4, new RNFormatter("HH:mm")));
    units.add(new OptimisedDateTickUnit(DateTickUnitType.HOUR, 6, new RNFormatter("ddHHmm")));
    units.add(new OptimisedDateTickUnit(DateTickUnitType.HOUR, 12, new RNFormatter("ddHHmm")));

    // days
    units.add(new OptimisedDateTickUnit(DateTickUnitType.DAY, 1, new RNFormatter("d-MMM")));

    return units;
}

From source file:eu.cassandra.platform.gui.GUI.java

public JFreeChart createChart(String title, final XYDataset dataset) {
    final JFreeChart chart = ChartFactory.createTimeSeriesChart(title, "Time", "Consumption (W)", dataset,
            false, true, true);/*from www  .  j  ava2  s .com*/

    DateAxis axis = (DateAxis) chart.getXYPlot().getDomainAxis();
    axis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 1));
    axis.setTickMarkPosition(DateTickMarkPosition.START);
    axis.setDateFormatOverride(new SimpleDateFormat("dd"));

    //      XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    //      BasicStroke basicStroke = new BasicStroke(1f);
    //      renderer.setSeriesStroke(0, basicStroke);
    //      chart.getXYPlot().setRenderer(renderer);

    chart.setAntiAlias(true);
    chart.setTextAntiAlias(true);

    return chart;
}

From source file:uk.ac.ed.epcc.webapp.charts.jfreechart.JFreeTimeChartData.java

private TickUnits getUnits() {
    TickUnits units = new TickUnits();
    units.add(new DateTickUnit(DateTickUnitType.SECOND, 1));
    units.add(new DateTickUnit(DateTickUnitType.MINUTE, 1));
    units.add(new DateTickUnit(DateTickUnitType.MINUTE, 10));
    units.add(new DateTickUnit(DateTickUnitType.MINUTE, 15));
    units.add(new DateTickUnit(DateTickUnitType.HOUR, 1));
    units.add(new DateTickUnit(DateTickUnitType.HOUR, 12));
    units.add(new DateTickUnit(DateTickUnitType.DAY, 1));
    units.add(new DateTickUnit(DateTickUnitType.DAY, 7));
    units.add(new DateTickUnit(DateTickUnitType.MONTH, 1));
    units.add(new DateTickUnit(DateTickUnitType.MONTH, 3));
    units.add(new DateTickUnit(DateTickUnitType.MONTH, 6));
    units.add(new DateTickUnit(DateTickUnitType.YEAR, 1));
    units.add(new DateTickUnit(DateTickUnitType.YEAR, 10));
    return units;
}

From source file:msec.org.Tools.java

public static String generateDaysChart(String filename, ArrayList<OneDayValue> data, OneAttrDaysChart chart,
        String title, int duration) {
    if (data.size() == 0) {
        return "data size invalid";
    }/*w w  w. j a va2s.  co  m*/

    int date = Integer.parseInt(data.get(0).getDate());
    GregorianCalendar startgc = new GregorianCalendar(date / 10000, date % 10000 / 100 - 1, date % 100);

    XYDataset xydataset = createDaysDataset(data, startgc, chart);
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart(title, "time", "", xydataset, true, true, true);

    try {
        XYPlot xyplot = (XYPlot) jfreechart.getPlot();

        //
        DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
        dateaxis.setDateFormatOverride(new SimpleDateFormat("MM/dd"));
        dateaxis.setLabelFont(new Font("", Font.PLAIN, 16)); //
        dateaxis.setLabelPaint(ChartColor.gray);
        dateaxis.setTickLabelFont(new Font("", Font.PLAIN, 16));
        dateaxis.setTickLabelPaint(ChartColor.GRAY);

        dateaxis.setMinimumDate(startgc.getTime());
        GregorianCalendar endgc = (GregorianCalendar) startgc.clone();
        endgc.add(GregorianCalendar.DATE, duration);
        dateaxis.setMaximumDate(endgc.getTime());

        dateaxis.setTickMarksVisible(true);
        dateaxis.setTickMarkInsideLength(5);
        dateaxis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 1));
        dateaxis.setVerticalTickLabels(true);
        dateaxis.setLabel("");

        //
        ValueAxis rangeAxis = xyplot.getRangeAxis();//?
        rangeAxis.setLabelFont(new Font("", Font.PLAIN, 16));
        rangeAxis.setLabelPaint(ChartColor.gray);
        rangeAxis.setTickLabelFont(new Font("", Font.PLAIN, 16));
        rangeAxis.setTickLabelPaint(ChartColor.gray);
        rangeAxis.setLowerBound(0);

        //
        jfreechart.getLegend().setItemFont(new Font("", Font.PLAIN, 12));
        jfreechart.getLegend().setItemPaint(ChartColor.gray);
        jfreechart.getLegend().setBorder(0, 0, 0, 0);//

        //
        jfreechart.getTitle().setFont(new Font("", Font.PLAIN, 18));//
        jfreechart.getTitle().setPaint(ChartColor.gray);

        //?
        xyplot.setRangeGridlinePaint(ChartColor.GRAY);
        xyplot.setBackgroundPaint(ChartColor.WHITE);
        xyplot.setOutlinePaint(null);//

        int w = 500;
        int h = 300;

        // ChartUtilities.saveChartAsPNG(new File(filename), jfreechart, w, h);
        ChartUtilities.saveChartAsJPEG(new File(filename), 0.8f, jfreechart, w, h);

        return "success";

    } catch (Exception e) {
        e.printStackTrace();
        return e.getMessage();
    }
}

From source file:MWC.GUI.JFreeChart.DateAxisEditor.java

/**
 * Returns a collection of standard date tick units. This collection will be
 * used by default, but you are free to create your own collection if you want
 * to (see the setStandardTickUnits(...) method inherited from the ValueAxis
 * class)./* w  w  w .  j  a v a  2 s  .  co m*/
 * 
 * @return a collection of standard date tick units.
 */
public static ArrayList<MWCDateTickUnitWrapper> createStandardDateTickUnitsAsArrayList() {

    final ArrayList<MWCDateTickUnitWrapper> units = new ArrayList<MWCDateTickUnitWrapper>();

    units.add(MWCDateTickUnitWrapper.getAutoScale());

    // //////////////////////////////////////////////////////

    // milliseconds
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MILLISECOND, 500, "HH:mm:ss.SSS"));

    // seconds
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.SECOND, 1, "HH:mm:ss"));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.SECOND, 5, "HH:mm:ss"));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.SECOND, 10, "HH:mm:ss"));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.SECOND, 30, "HH:mm:ss"));

    // minutes
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 1, "HH:mm"));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 2, "HH:mm"));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 5, "HH:mm"));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 10, "HH:mm"));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 15, "HH:mm"));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 20, "HH:mm"));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 30, "HH:mm"));

    // hours
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.HOUR, 1, "HH:mm"));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.HOUR, 2, "HH:mm"));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.HOUR, 4, "HH:mm"));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.HOUR, 6, "ddHHmm"));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.HOUR, 12, "ddHHmm"));

    // days
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.DAY, 1, "d-MMM"));

    // /////////////////////////////////////////////////////

    // // milliseconds
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MILLISECOND,
    // 500, "HH:mm:ss.SSS"));
    //
    // // seconds
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.SECOND, 1,
    // "HH:mm:ss"));
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.SECOND, 5,
    // "HH:mm:ss"));
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.SECOND, 10,
    // "HH:mm:ss"));
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.SECOND, 30,
    // "HH:mm:ss"));
    //
    // // minutes
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 1,
    // "HH:mm"));
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 2,
    // "HH:mm"));
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 5,
    // "HH:mm"));
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 10,
    // "HH:mm"));
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 15,
    // "HH:mm"));
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 20,
    // "HH:mm"));
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.MINUTE, 30,
    // "HH:mm"));
    //
    // // hours
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.HOUR, 1,
    // "HH:mm"));
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.HOUR, 2,
    // "HH:mm"));
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.HOUR, 4,
    // "HH:mm"));
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.HOUR, 6,
    // "HH:mm"));
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.HOUR, 12,
    // "d-MMM, HH:mm"));
    //
    // // days
    // units.add(new MWCDateTickUnitWrapper(DateTickUnitType.DAY, 1,
    // "d-MMM"));

    // absolute seconds
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.SECOND, 1, RELATIVE_DTG_FORMAT));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.SECOND, 5, RELATIVE_DTG_FORMAT));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.SECOND, 10, RELATIVE_DTG_FORMAT));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.SECOND, 30, RELATIVE_DTG_FORMAT));
    units.add(new MWCDateTickUnitWrapper(DateTickUnitType.SECOND, 60, RELATIVE_DTG_FORMAT));

    return units;

}

From source file:de.fhbingen.wbs.wpOverview.tabs.AvailabilityGraph.java

/**
 * Creates a chart of the actual view with a title.
 * @param title/*ww  w  .j  a v a  2s  . c  om*/
 *            The title of the chart.
 */
protected final void makeChart(final String title) {
    DateTickUnit tick = null;
    switch (actualView) {
    case DAY:
        tick = new DateTickUnit(DateTickUnitType.HOUR, 1, new SimpleDateFormat("HH"));
        break;
    case WEEK:
        tick = new DateTickUnit(DateTickUnitType.DAY, 1, new SimpleDateFormat("E, dd.MM."));
        break;
    case MONTH:
        tick = new DateTickUnit(DateTickUnitType.DAY, 1, new SimpleDateFormat("d."));
        break;
    case YEAR:
        tick = new DateTickUnit(DateTickUnitType.MONTH, 1, new SimpleDateFormat("M"));
        break;
    default:
        break;
    }
    gui.pnlGraph.setChart(ChartFactory.createGanttChart(title, "", "", createDataset(), true, true, false));
    gui.pnlGraph.getChart().getTitle().setHorizontalAlignment(HorizontalAlignment.LEFT);
    gui.pnlGraph.getChart().getTitle().setMargin(5, 10, 5, 5);
    gui.pnlGraph.getChart().getCategoryPlot().getDomainAxis().setCategoryMargin(0.4);
    gui.pnlGraph.getChart().getCategoryPlot().getDomainAxis().setLowerMargin(0);
    gui.pnlGraph.getChart().getCategoryPlot().getDomainAxis().setUpperMargin(0);

    // chart.getCategoryPlot().getDomainAxis().getL

    gui.pnlGraph.getChart().getCategoryPlot().getDomainAxis()
            .setTickLabelFont(new Font(Font.SANS_SERIF, Font.PLAIN, 10));

    CategoryPlot plot = gui.pnlGraph.getChart().getCategoryPlot();
    DateAxis axis = (DateAxis) plot.getRangeAxis();
    axis.setMinimumDate(actualStart.getTime());
    axis.setMaximumDate(actualEnd.getTime());
    axis.setTickUnit(tick);

    CategoryItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    renderer.setSeriesPaint(1, Color.green);
    renderer.setSeriesPaint(2, Color.red);
}

From source file:OAT.ui.util.UiUtil.java

public static TickUnits createSimpleTimeTickUnits() {
    TickUnits tickUnits = new TickUnits();
    SimpleDateFormat timeFormatter = new SimpleDateFormat("HH:mm");
    SimpleDateFormat weekDayFormatter = new SimpleDateFormat("EEE");
    SimpleDateFormat dayFormatter = new SimpleDateFormat("dd-mm");
    SimpleDateFormat monthFormatter = new SimpleDateFormat("MMM-yy");
    SimpleDateFormat yearFormatter = new SimpleDateFormat("yyyy");

    //tickUnits.add(new DateTickUnit(DateTickUnitType.MINUTE, 30, DateTickUnitType.SECOND, 1, timeFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.HOUR, 1, DateTickUnitType.SECOND, 1, timeFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.HOUR, 2, timeFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.HOUR, 4, timeFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.HOUR, 6, timeFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.HOUR, 12, timeFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.DAY, 1, DateTickUnitType.HOUR, 1, weekDayFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.DAY, 2, weekDayFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.DAY, 7, dayFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.DAY, 15, dayFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.MONTH, 1, DateTickUnitType.DAY, 1, monthFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.MONTH, 3, monthFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.MONTH, 6, monthFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.YEAR, 1, DateTickUnitType.MONTH, 1, yearFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.YEAR, 2, yearFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.YEAR, 5, yearFormatter));
    tickUnits.add(new DateTickUnit(DateTickUnitType.YEAR, 10, yearFormatter));

    return tickUnits;
}

From source file:edu.jhuapl.graphs.jfreechart.JFreeChartTimeSeriesGraphSource.java

/**
 * Initializes the graph.  This method generates the backing {@link JFreeChart} from the time series and graph
 * parameter data./*  w w  w . j  ava  2s.co m*/
 *
 * @throws GraphException if the initialization fails
 */
public void initialize() throws GraphException {
    String title = getParam(GraphSource.GRAPH_TITLE, String.class, DEFAULT_TITLE);
    String xLabel = getParam(GraphSource.GRAPH_X_LABEL, String.class, DEFAULT_DOMAIN_LABEL);
    String yLabel = getParam(GraphSource.GRAPH_Y_LABEL, String.class, DEFAULT_RANGE_LABEL);
    Shape graphShape = getParam(GraphSource.GRAPH_SHAPE, Shape.class, DEFAULT_GRAPH_SHAPE);
    Paint graphColor = getParam(GraphSource.GRAPH_COLOR, Paint.class, DEFAULT_GRAPH_COLOR);
    boolean legend = getParam(GraphSource.GRAPH_LEGEND, Boolean.class, DEFAULT_GRAPH_LEGEND);
    boolean graphToolTip = getParam(GraphSource.GRAPH_TOOL_TIP, Boolean.class, DEFAULT_GRAPH_TOOL_TIP);
    Stroke graphStroke = getParam(GraphSource.GRAPH_STROKE, Stroke.class, DEFAULT_GRAPH_STROKE);
    Font titleFont = getParam(GraphSource.GRAPH_FONT, Font.class, DEFAULT_GRAPH_TITLE_FONT);
    boolean graphBorder = getParam(GraphSource.GRAPH_BORDER, Boolean.class, DEFAULT_GRAPH_BORDER);
    boolean legendBorder = getParam(GraphSource.LEGEND_BORDER, Boolean.class, DEFAULT_LEGEND_BORDER);
    Double offset = getParam(GraphSource.AXIS_OFFSET, Double.class, DEFAULT_AXIS_OFFSET);

    checkSeriesType(data);
    @SuppressWarnings("unchecked")
    List<? extends TimeSeriesInterface> timeData = (List<? extends TimeSeriesInterface>) data;

    TimeSeriesCollection dataset = new TimeSeriesCollection();
    int seriesCount = 1;
    for (TimeSeriesInterface series : timeData) {
        dataset.addSeries(buildTimeSeries(series, seriesCount));
        seriesCount += 1;
    }

    // actually create the chart
    this.chart = ChartFactory.createTimeSeriesChart(title, xLabel, yLabel, dataset, false, graphToolTip, false);

    // start customizing it
    Paint backgroundColor = getParam(GraphSource.BACKGROUND_COLOR, Paint.class, DEFAULT_BACKGROUND_COLOR);
    Paint plotColor = getParam(JFreeChartTimeSeriesGraphSource.PLOT_COLOR, Paint.class, backgroundColor);
    Paint graphDomainGridlinePaint = getParam(GraphSource.GRAPH_DOMAIN_GRIDLINE_PAINT, Paint.class,
            backgroundColor);
    Paint graphRangeGridlinePaint = getParam(GraphSource.GRAPH_RANGE_GRIDLINE_PAINT, Paint.class,
            backgroundColor);

    this.chart.setBackgroundPaint(backgroundColor);
    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(plotColor);
    plot.setAxisOffset(new RectangleInsets(offset, offset, offset, offset));
    plot.setDomainGridlinePaint(graphDomainGridlinePaint);
    plot.setRangeGridlinePaint(graphRangeGridlinePaint);

    if (graphBorder) {

    } else {
        plot.setOutlinePaint(null);
    }

    //Use a TextTitle to change the font of the graph title
    TextTitle title1 = new TextTitle();
    title1.setText(title);
    title1.setFont(titleFont);
    chart.setTitle(title1);

    //Makes a wrapper for the legend to remove the border around it
    if (legend) {
        LegendTitle legend1 = new LegendTitle(chart.getPlot());
        BlockContainer wrapper = new BlockContainer(new BorderArrangement());
        if (legendBorder) {
            wrapper.setFrame(new BlockBorder(1, 1, 1, 1));
        } else {
            wrapper.setFrame(new BlockBorder(0, 0, 0, 0));
        }
        BlockContainer items = legend1.getItemContainer();
        items.setPadding(2, 10, 5, 2);
        wrapper.add(items);
        legend1.setWrapper(wrapper);
        legend1.setPosition(RectangleEdge.BOTTOM);
        legend1.setHorizontalAlignment(HorizontalAlignment.CENTER);

        if (params.get(GraphSource.LEGEND_FONT) instanceof Font) {
            legend1.setItemFont(((Font) params.get(GraphSource.LEGEND_FONT)));
        }

        chart.addSubtitle(legend1);
    }

    boolean include0 = getParam(GraphSource.GRAPH_RANGE_INCLUDE_0, Boolean.class, true);
    NumberAxis numAxis = (NumberAxis) plot.getRangeAxis();
    double rangeLower = getParam(GraphSource.GRAPH_RANGE_LOWER_BOUND, Double.class, numAxis.getLowerBound());
    double rangeUpper = getParam(GraphSource.GRAPH_RANGE_UPPER_BOUND, Double.class, numAxis.getUpperBound());
    boolean graphRangeIntegerTick = getParam(GraphSource.GRAPH_RANGE_INTEGER_TICK, Boolean.class, false);
    boolean graphRangeMinorTickVisible = getParam(GraphSource.GRAPH_RANGE_MINOR_TICK_VISIBLE, Boolean.class,
            true);

    if (include0) {
        rangeLower = 0;
    }

    numAxis.setRange(rangeLower, rangeUpper);

    if (graphRangeIntegerTick) {
        numAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    }

    numAxis.setMinorTickMarksVisible(graphRangeMinorTickVisible);
    setupFont(numAxis, GraphSource.GRAPH_Y_AXIS_FONT);

    if (params.get(GraphSource.GRAPH_Y_AXIS_LABEL_FONT) instanceof Font) {
        numAxis.setLabelFont(((Font) params.get(GraphSource.GRAPH_Y_AXIS_LABEL_FONT)));
    }

    TimeResolution minimumResolution = getMinimumResolution(timeData);
    DateFormat dateFormat = getParam(GraphSource.GRAPH_DATE_FORMATTER, DateFormat.class,
            new DefaultDateFormatFactory().getFormat(minimumResolution));

    if (params.get(DATE_AXIS) instanceof DateAxis) {
        DateAxis dateAxis = (DateAxis) params.get(DATE_AXIS);
        dateAxis.setLabel(xLabel);
        plot.setDomainAxis(dateAxis);
    }
    DateAxis dateAxis = ((DateAxis) plot.getDomainAxis());
    dateAxis.setDateFormatOverride(dateFormat);

    if (params.get(GraphSource.GRAPH_X_AXIS_LABEL_FONT) instanceof Font) {
        dateAxis.setLabelFont(((Font) params.get(GraphSource.GRAPH_X_AXIS_LABEL_FONT)));
    }

    int minTick = getParam(GraphSource.GRAPH_MIN_DOMAIN_TICK, Integer.class, 1);
    if (minTick <= 0) {
        minTick = 1;
    }

    dateAxis.setTickUnit(getDateTickUnit(minimumResolution, minTick), false, false);
    //dateAxis.setMinorTickMarksVisible(true);
    //dateAxis.setMinorTickCount(7);
    dateAxis.setMinorTickMarkOutsideLength(2);

    Integer minorTick = getParam(GraphSource.GRAPH_MINOR_TICKS, Integer.class, null);
    if (minorTick != null) {
        int minorVal = minorTick;
        if (minorVal > 0) {
            dateAxis.setMinorTickCount(minorVal);
        }
    }

    setupFont(dateAxis, GraphSource.GRAPH_X_AXIS_FONT);

    //double lowerMargin = getParam(DOMAIN_AXIS_LOWER_MARGIN, Double.class, DEFAULT_DOMAIN_AXIS_LOWER_MARGIN);
    double lowerMargin = getParam(DOMAIN_AXIS_LOWER_MARGIN, Double.class, DEFAULT_DOMAIN_AXIS_LOWER_MARGIN);
    dateAxis.setLowerMargin(lowerMargin);

    //double upperMargin = getParam(DOMAIN_AXIS_UPPER_MARGIN, Double.class, DEFAULT_DOMAIN_AXIS_UPPER_MARGIN);
    double upperMargin = getParam(DOMAIN_AXIS_UPPER_MARGIN, Double.class, DEFAULT_DOMAIN_AXIS_UPPER_MARGIN);
    dateAxis.setUpperMargin(upperMargin);

    Date domainLower = getParam(GraphSource.GRAPH_DOMAIN_LOWER_BOUND, Date.class, dateAxis.getMinimumDate());
    Date domainUpper = getParam(GraphSource.GRAPH_DOMAIN_UPPER_BOUND, Date.class, dateAxis.getMaximumDate());

    dateAxis.setRange(domainLower, domainUpper);

    // depending on the domain axis range, display either 1 tick per day, week, month or year
    TickUnits standardUnits = new TickUnits();
    standardUnits.add(new DateTickUnit(DateTickUnitType.DAY, 1));
    standardUnits.add(new DateTickUnit(DateTickUnitType.DAY, 7));
    standardUnits.add(new DateTickUnit(DateTickUnitType.MONTH, 1));
    standardUnits.add(new DateTickUnit(DateTickUnitType.YEAR, 1));
    dateAxis.setStandardTickUnits(standardUnits);

    TimeSeriesRenderer renderer = new TimeSeriesRenderer(dataset);
    setupRenderer(renderer, graphColor, graphShape, graphStroke);
    renderer.setBaseFillPaint(Color.BLACK);
    renderer.setSeriesOutlinePaint(0, Color.WHITE);

    //renderer.setUseOutlinePaint(true);

    plot.setRenderer(renderer);
    this.initialized = true;
}