Example usage for org.jfree.chart.axis NumberTickUnit NumberTickUnit

List of usage examples for org.jfree.chart.axis NumberTickUnit NumberTickUnit

Introduction

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

Prototype

public NumberTickUnit(double size) 

Source Link

Document

Creates a new number tick unit.

Usage

From source file:no.met.jtimeseries.chart.ChartPlotter.java

/**
 * Add a line chart in the plot//from w ww.  ja  va 2 s .  co  m
 * 
 * @param timeBase
 *            The base time of the data: second, minute, hour, year or auto
 * @param phenomenon
 *            Phenomenon to plot.
 * @param plotStyle
 *            The style preference for the plot
 * 
 */
public void addLineChart(TimeBase timeBase, NumberPhenomenon ph, PlotStyle plotStyle) {
    NumberPhenomenon phenomenon = ph.clone();
    if (phenomenon.getItems().size() > 0) {
        XYItemRenderer renderer = RendererFactory.createRenderer(SplineStyle.STANDARD);
        // if using hybrid spline
        if (plotStyle.getSplineStyle().equalsIgnoreCase(SplineStyle.HYBRID)) {
            phenomenon.doHybridSpline(0.5d, 4);
            renderer = RendererFactory.createRenderer(SplineStyle.NONE);
        }

        if (plotStyle.getNonNegative()) {
            phenomenon.removeNegativeValues();
        }

        XYDataset dataset = phenomenon.getTimeSeries(plotStyle.getTitle(), timeBase);

        renderer.setSeriesPaint(0, plotStyle.getSeriesColor());
        renderer.setSeriesStroke(0, plotStyle.getStroke());

        // hidden the legend by default
        renderer.setSeriesVisibleInLegend(0, false);

        plot.setDataset(plotIndex, dataset);
        plot.setRenderer(plotIndex, renderer);

        // render the range axis
        NumberAxis numberAxis;
        // null check for number axis
        if (plotStyle.getNumberAxis() == null) {
            numberAxis = new NumberAxis(plotStyle.getTitle());
            numberAxis.setAutoRangeIncludesZero(false);
            numberAxis.setLabelPaint(plotStyle.getLabelColor());
            numberAxis.setTickLabelPaint(plotStyle.getLabelColor());

            // ugly calculation
            double max = phenomenon.getMaxValue();
            double min = phenomenon.getMinValue();
            // increase and decrease max, min respectiivly to get the
            // difference pf atleast 50
            while ((max - min) <= plotStyle.getDifference()) {
                max++;
                min--;
            }
            int tUnit = (int) ((max - min) / plotStyle.getTotalTicks());
            if (tUnit <= 1) {
                tUnit = 2;
            }
            int[] range = calculateAxisMaxMin(phenomenon, tUnit, plotStyle.getTotalTicks());

            NumberTickUnit ntu = new NumberTickUnit(tUnit);
            numberAxis.setTickUnit(ntu);
            numberAxis.setRangeWithMargins(range[1], range[0]);
        } else {
            numberAxis = plotStyle.getNumberAxis();
        }
        plot.setRangeAxis(rangeAxisIndex, numberAxis);

        Date minDate = phenomenon.getStartTime();
        Date maxDate = phenomenon.getEndTime();

        DateAxis domainAxis = (DateAxis) plot.getDomainAxis();
        domainAxis.setRange(minDate, maxDate);

        plot.mapDatasetToRangeAxis(plotIndex, rangeAxisIndex);

        plotIndex++;
        rangeAxisIndex++;
    }
}

From source file:eu.cassandra.training.utils.ChartUtils.java

/**
 * This function is used for the visualization of a Gaussian Mixture
 * Distribution./*from w ww .ja  va2  s.  c  om*/
 * 
 * @param title
 *          The title of the chart.
 * @param x
 *          The unit on the X axis of the chart.
 * @param y
 *          The unit on the Y axis of the chart.
 * @param data
 *          The array of values.
 * @return a chart panel with the graphical representation.
 */
public static ChartPanel createMixtureDistribution(String title, String x, String y, double[] data) {
    XYSeries series1 = new XYSeries("First");

    for (int i = 0; i < data.length; i++) {
        series1.add(i, data[i]);
    }

    final XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series1);

    PlotOrientation orientation = PlotOrientation.VERTICAL;
    boolean show = false;
    boolean toolTips = false;
    boolean urls = false;

    JFreeChart chart = ChartFactory.createXYLineChart(title, x, y, dataset, orientation, show, toolTips, urls);

    XYPlot xyplot = (XYPlot) chart.getPlot();
    xyplot.setDomainPannable(true);
    xyplot.setRangePannable(true);
    xyplot.setForegroundAlpha(0.85F);
    NumberAxis domainAxis = (NumberAxis) xyplot.getDomainAxis();
    if (data.length != 1440)
        domainAxis.setTickUnit(new NumberTickUnit(data.length / 10));
    else
        domainAxis.setTickUnit(new NumberTickUnit(100));
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    return new ChartPanel(chart);

}

From source file:tools.descartes.bungee.chart.ChartGenerator.java

public static JFreeChart mappingChart(final IntensityDemandMapping mapping) {
    final XYSeriesCollection dataset = new XYSeriesCollection();
    final XYSeries mappingSeries = new XYSeries("mapping function");
    double lastIntentsity = 0;
    for (IntensityResourcePair pair : mapping.getMappingList()) {
        mappingSeries.add(lastIntentsity, pair.resourceAmount);
        mappingSeries.add(pair.maxIntensity, pair.resourceAmount);
        lastIntentsity = pair.maxIntensity;
    }//from  www .  jav  a  2  s.  c o m
    dataset.addSeries(mappingSeries);

    final JFreeChart chart = ChartFactory.createXYLineChart("", "Load Intensity", "Resource Amount", dataset);

    chartCustomization(chart);
    chart.getXYPlot().getRenderer().setSeriesPaint(0, Color.BLUE);
    chart.getXYPlot().getRenderer().setSeriesStroke(0, new BasicStroke(STROKE_WIDTH));
    NumberAxis rangeAxis = (NumberAxis) chart.getXYPlot().getRangeAxis();
    rangeAxis.setTickUnit(new NumberTickUnit(1));
    return chart;
}

From source file:asl.util.PlotMaker.java

public void plotCoherence(double per[], double[] gamma, String plotString) {

    final String plotTitle = String.format("%04d%03d.%s.%s-%s", date.get(Calendar.YEAR),
            date.get(Calendar.DAY_OF_YEAR), station, channelX, channelY);
    final String pngName = String.format("%s/%04d%03d.%s.%s-%s.%s.png", outputDir, date.get(Calendar.YEAR),
            date.get(Calendar.DAY_OF_YEAR), station, channelX, channelY, plotString);

    File outputFile = new File(pngName);

    // Check that we will be able to output the file without problems and if not --> return
    if (!checkFileOut(outputFile)) {
        System.out.format("== plotCoherence: request to output plot=[%s] but we are unable to create it "
                + " --> skip plot\n", pngName);
        return;//  w w  w.j  a v a2  s  .c o  m
    }

    final String legend = String.format("%s--%s", channelX, channelY);
    final XYSeries series1 = new XYSeries(legend);

    for (int k = 0; k < gamma.length; k++) {
        series1.add(per[k], gamma[k]);
    }

    //final XYItemRenderer renderer1 = new StandardXYItemRenderer();
    final XYLineAndShapeRenderer renderer1 = new XYLineAndShapeRenderer();
    Rectangle rectangle = new Rectangle(3, 3);
    renderer1.setSeriesShape(0, rectangle);
    renderer1.setSeriesShapesVisible(0, true);
    renderer1.setSeriesLinesVisible(0, false);

    Paint[] paints = new Paint[] { Color.red, Color.black };
    renderer1.setSeriesPaint(0, paints[0]);

    final NumberAxis rangeAxis1 = new NumberAxis("Coherence, Gamma");
    rangeAxis1.setRange(new Range(0, 1.2));
    rangeAxis1.setTickUnit(new NumberTickUnit(0.1));

    final LogarithmicAxis horizontalAxis = new LogarithmicAxis("Period (sec)");
    horizontalAxis.setRange(new Range(0.05, 10000));

    final XYSeriesCollection seriesCollection = new XYSeriesCollection();
    seriesCollection.addSeries(series1);

    final XYPlot xyplot = new XYPlot((XYDataset) seriesCollection, horizontalAxis, rangeAxis1, renderer1);

    xyplot.setDomainGridlinesVisible(true);
    xyplot.setRangeGridlinesVisible(true);
    xyplot.setRangeGridlinePaint(Color.black);
    xyplot.setDomainGridlinePaint(Color.black);

    final JFreeChart chart = new JFreeChart(xyplot);
    chart.setTitle(new TextTitle(plotTitle));

    try {
        ChartUtilities.saveChartAsPNG(outputFile, chart, 500, 300);
    } catch (IOException e) {
        System.err.println("Problem occurred creating chart.");

    }
}

From source file:eu.cassandra.training.utils.ChartUtils.java

/**
 * This function is used for parsing and presenting the basic and the new
 * pricing schema.//from  ww  w . j  a v a 2  s  .  co  m
 * 
 * @param basic
 *          The basic pricing schema
 * @param after
 *          The new pricing schema
 * 
 * @return a chart panel with the
 *         graphical representation.
 */
public static ChartPanel parsePricingScheme(String basic, String after) {

    double[] data = Utils.parseScheme(basic);

    double[] data2 = Utils.parseScheme(after);

    XYSeries series1 = new XYSeries("Basic Pricing Scheme");
    for (int i = 0; i < data.length; i++) {
        series1.add(i, data[i]);
    }

    XYSeries series2 = new XYSeries("New Pricing Scheme");
    for (int i = 0; i < data2.length; i++) {
        series2.add(i, data2[i]);
    }

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series1);
    dataset.addSeries(series2);

    PlotOrientation orientation = PlotOrientation.VERTICAL;
    boolean show = true;
    boolean toolTips = false;
    boolean urls = false;

    JFreeChart chart = ChartFactory.createXYLineChart("Pricing Schemes", "Minute of Day", "Euros/kWh", dataset,
            orientation, show, toolTips, urls);

    XYPlot xyplot = (XYPlot) chart.getPlot();
    xyplot.setDomainPannable(true);
    xyplot.setRangePannable(true);
    xyplot.setForegroundAlpha(0.85F);
    NumberAxis domainAxis = (NumberAxis) xyplot.getDomainAxis();

    domainAxis.setTickUnit(new NumberTickUnit(100));
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    return new ChartPanel(chart);
}

From source file:msi.gama.outputs.layers.charts.ChartJFreeChartOutputHistogram.java

@Override
public void resetAxes(final IScope scope) {
    final CategoryPlot pp = (CategoryPlot) this.chart.getPlot();
    NumberAxis rangeAxis = (NumberAxis) ((CategoryPlot) this.chart.getPlot()).getRangeAxis();
    if (getY_LogScale(scope)) {
        final LogarithmicAxis logAxis = new LogarithmicAxis(rangeAxis.getLabel());
        logAxis.setAllowNegativesFlag(true);
        ((CategoryPlot) this.chart.getPlot()).setRangeAxis(logAxis);
        rangeAxis = logAxis;// ww w.  j  a va  2 s. c  o  m
    }

    if (!useyrangeinterval && !useyrangeminmax) {
        rangeAxis.setAutoRange(true);
    }

    if (this.useyrangeinterval) {
        rangeAxis.setFixedAutoRange(yrangeinterval);
        rangeAxis.setAutoRangeMinimumSize(yrangeinterval);
        rangeAxis.setAutoRange(true);

    }
    if (this.useyrangeminmax) {
        rangeAxis.setRange(yrangemin, yrangemax);

    }

    resetDomainAxis(scope);

    final CategoryAxis domainAxis = ((CategoryPlot) this.chart.getPlot()).getDomainAxis();

    pp.setDomainGridlinePaint(axesColor);
    pp.setRangeGridlinePaint(axesColor);
    pp.setRangeCrosshairVisible(true);

    pp.getRangeAxis().setAxisLinePaint(axesColor);
    pp.getRangeAxis().setLabelFont(getLabelFont());
    pp.getRangeAxis().setTickLabelFont(getTickFont());
    if (textColor != null) {
        pp.getRangeAxis().setLabelPaint(textColor);
        pp.getRangeAxis().setTickLabelPaint(textColor);
    }
    if (getYTickUnit(scope) > 0) {
        ((NumberAxis) pp.getRangeAxis()).setTickUnit(new NumberTickUnit(getYTickUnit(scope)));
    }

    if (getYLabel(scope) != null && !getYLabel(scope).isEmpty()) {
        pp.getRangeAxis().setLabel(getYLabel(scope));
    }
    if (this.series_label_position.equals("yaxis")) {
        pp.getRangeAxis().setLabel(this.getChartdataset().getDataSeriesIds(scope).iterator().next());
        chart.getLegend().setVisible(false);
    }

    if (getXLabel(scope) != null && !getXLabel(scope).isEmpty()) {
        pp.getDomainAxis().setLabel(getXLabel(scope));
    }

    if (this.useSubAxis) {
        for (final String serieid : chartdataset.getDataSeriesIds(scope)) {
            ((SubCategoryAxis) domainAxis).addSubCategory(serieid);
        }

    }
    if (!this.getYTickLineVisible(scope)) {
        pp.setDomainGridlinesVisible(false);
    }

    if (!this.getYTickLineVisible(scope)) {
        pp.setRangeCrosshairVisible(false);

    }

    if (!this.getYTickValueVisible(scope)) {
        pp.getRangeAxis().setTickMarksVisible(false);
        pp.getRangeAxis().setTickLabelsVisible(false);

    }

}

From source file:edu.msu.cme.rdp.classifier.train.validation.distance.TaxaSimilarityMain.java

public void createPlot(String plotTitle, File outdir) throws IOException {
    XYSeriesCollection dataset = new XYSeriesCollection();
    DefaultBoxAndWhiskerCategoryDataset scatterDataset = new DefaultBoxAndWhiskerCategoryDataset();

    PrintStream boxchart_dataStream = new PrintStream(new File(outdir, plotTitle + ".boxchart.txt"));

    boxchart_dataStream.println(//from  ww  w.  j  av a2  s . co  m
            "#\tkmer" + "\trank" + "\t" + "max" + "\t" + "avg" + "\t" + "min" + "\t" + "Q1" + "\t" + "median"
                    + "\t" + "Q3" + "\t" + "98Pct" + "\t" + "2Pct" + "\t" + "comparisons" + "\t" + "sum");
    for (int i = 0; i < ranks.size(); i++) {
        long[] countArray = sabCoutMap.get(ranks.get(i));
        if (countArray == null)
            continue;

        double sum = 0.0;
        int max = 0;
        int min = 100;
        double mean = 0;
        int Q1 = -1;
        int median = -1;
        int Q3 = -1;
        int pct_98 = -1;
        int pct_2 = -1;
        long comparisons = 0;
        int minOutlier = 0; // we don't care about the outliers
        int maxOutlier = 0; //

        XYSeries series = new XYSeries(ranks.get(i));

        for (int c = 0; c < countArray.length; c++) {
            if (countArray[c] == 0)
                continue;
            comparisons += countArray[c];
            sum += countArray[c] * c;
            if (c < min) {
                min = c;
            }
            if (c > max) {
                max = c;
            }
        }

        // create series
        double cum = 0;
        for (int c = 0; c < countArray.length; c++) {
            if (countArray[c] == 0)
                continue;
            cum += countArray[c];
            int pct = (int) Math.floor(100 * cum / comparisons);
            series.add(c, pct);

            if (pct_2 == -1 && pct >= 5) {
                pct_2 = c;
            }
            if (Q3 == -1 && pct >= 25) {
                Q3 = c;
            }
            if (median == -1 && pct >= 50) {
                median = c;
            }
            if (Q1 == -1 && pct >= 75) {
                Q1 = c;
            }
            if (pct_98 == -1 && pct >= 98) {
                pct_98 = c;
            }
        }
        if (!series.isEmpty()) {
            dataset.addSeries(series);

            BoxAndWhiskerItem item = new BoxAndWhiskerItem(sum / comparisons, median, Q1, Q3, pct_2, pct_98,
                    minOutlier, maxOutlier, new ArrayList());
            scatterDataset.add(item, ranks.get(i), "");

            boxchart_dataStream.println("#\t" + GoodWordIterator.getWordsize() + "\t" + ranks.get(i) + "\t"
                    + max + "\t" + format.format(sum / comparisons) + "\t" + min + "\t" + Q1 + "\t" + median
                    + "\t" + Q3 + "\t" + pct_98 + "\t" + pct_2 + "\t" + comparisons + "\t" + sum);
        }
    }
    boxchart_dataStream.close();
    Font lableFont = new Font("Helvetica", Font.BOLD, 28);

    JFreeChart chart = ChartFactory.createXYLineChart(plotTitle, "Similarity%", "Percent Comparisions", dataset,
            PlotOrientation.VERTICAL, true, true, false);
    ((XYPlot) chart.getPlot()).getRenderer().setStroke(new BasicStroke(2.0f));
    chart.getLegend().setItemFont(new Font("Helvetica", Font.BOLD, 24));
    chart.getTitle().setFont(lableFont);
    ((XYPlot) chart.getPlot()).getDomainAxis().setLabelFont(lableFont);
    ((XYPlot) chart.getPlot()).getDomainAxis().setTickLabelFont(lableFont);
    ValueAxis rangeAxis = ((XYPlot) chart.getPlot()).getRangeAxis();
    rangeAxis.setRange(0, 100);
    rangeAxis.setTickLabelFont(lableFont);
    rangeAxis.setLabelFont(lableFont);
    ((NumberAxis) rangeAxis).setTickUnit(new NumberTickUnit(5));
    ChartUtilities.writeScaledChartAsPNG(new PrintStream(new File(outdir, plotTitle + ".linechart.png")), chart,
            800, 1000, 3, 3);

    BoxPlotUtils.createBoxplot(scatterDataset, new PrintStream(new File(outdir, plotTitle + ".boxchart.png")),
            plotTitle, "Rank", "Similarity%", lableFont);

}

From source file:no.met.jtimeseries.chart.ChartPlotter.java

public void addThresholdLineChart(TimeBase timeBase, NumberPhenomenon ph, PlotStyle plotStyle) {
    NumberPhenomenon phenomenon = ph.clone();
    if (phenomenon.getItems().size() > 0) {
        XYItemRenderer renderer = RendererFactory.createRenderer(SplineStyle.STANDARD);
        // if using hybrid
        if (plotStyle.getSplineStyle().equalsIgnoreCase(SplineStyle.HYBRID)) {
            phenomenon.doHybridSpline(0.5d, 4);
            renderer = RendererFactory.createRenderer(SplineStyle.NONE);
        }/*from w w w . ja  v a2  s.  c o  m*/

        if (plotStyle.getNonNegative()) {
            phenomenon.removeNegativeValues();
        }

        // add threshold point into the dataset
        phenomenon.addThresholdPoints(plotStyle.getThreshold());
        // create threshold data set with specified threshold value
        XYDataset dataset = phenomenon.getTimeSeriesWithThreshold(plotStyle.getTitle(), timeBase,
                plotStyle.getThreshold());

        // render even series lines with color1 and odd series lines with
        // color2
        for (int i = 0; i < dataset.getSeriesCount(); i++) {
            if (i % 2 == 0)
                renderer.setSeriesPaint(i, plotStyle.getPlusDegreeColor());
            else
                renderer.setSeriesPaint(i, plotStyle.getMinusDegreeColor());
            renderer.setSeriesStroke(i, plotStyle.getStroke());
            // hidden legend
            renderer.setSeriesVisibleInLegend(i, false);
        }

        plot.setDataset(plotIndex, dataset);
        plot.setRenderer(plotIndex, renderer);

        NumberAxis numberAxis;
        // null check for number axis
        if (plotStyle.getNumberAxis() == null) {
            numberAxis = new NumberAxis(plotStyle.getTitle());
            numberAxis.setAutoRangeIncludesZero(false);
            numberAxis.setLabelPaint(plotStyle.getLabelColor());
            numberAxis.setTickLabelPaint(plotStyle.getLabelColor());

            // ugly calculation
            double max = phenomenon.getMaxValue();
            double min = phenomenon.getMinValue();
            int tUnit = getTemperatureTicksUnit(max, min);
            int[] range = calculateAxisMaxMin(phenomenon, tUnit, plotStyle.getTotalTicks());

            NumberTickUnit ntu = new NumberTickUnit(tUnit);
            numberAxis.setTickUnit(ntu);
            numberAxis.setLowerMargin(LOWER_PLOT_MARGIN);
            numberAxis.setRangeWithMargins(range[1], range[0]);
        } else {
            numberAxis = plotStyle.getNumberAxis();
        }

        plot.setRangeAxis(rangeAxisIndex, numberAxis);

        Date minDate = phenomenon.getStartTime();
        Date maxDate = phenomenon.getEndTime();

        DateAxis domainAxis = (DateAxis) plot.getDomainAxis();
        domainAxis.setRange(minDate, maxDate);

        plot.mapDatasetToRangeAxis(plotIndex, rangeAxisIndex);

        plotIndex++;
        rangeAxisIndex++;
    }
}

From source file:ro.nextreports.engine.chart.JFreeChartExporter.java

private JFreeChart createLineChart() throws QueryException {
    XYSeriesCollection dataset = new XYSeriesCollection();
    String chartTitle = replaceParameters(chart.getTitle().getTitle());
    chartTitle = StringUtil.getI18nString(chartTitle, I18nUtil.getLanguageByName(chart, language));
    Object[] charts = new Object[chart.getYColumns().size()];
    List<String> legends = chart.getYColumnsLegends();
    boolean hasLegend = false;
    for (int i = 0; i < charts.length; i++) {
        String legend = "";
        try {/*  w  w  w.  j a  v  a  2  s  . c om*/
            legend = replaceParameters(legends.get(i));
            legend = StringUtil.getI18nString(legend, I18nUtil.getLanguageByName(chart, language));
        } catch (IndexOutOfBoundsException ex) {
            // no legend set
        }
        if ((legend != null) && !"".equals(legend.trim())) {
            hasLegend = true;
        }
        XYSeries lineChart = new XYSeries(legend);
        charts[i] = lineChart;
        dataset.addSeries(lineChart);
    }

    String xLegend = StringUtil.getI18nString(replaceParameters(chart.getXLegend().getTitle()),
            I18nUtil.getLanguageByName(chart, language));
    String yLegend = StringUtil.getI18nString(replaceParameters(chart.getYLegend().getTitle()),
            I18nUtil.getLanguageByName(chart, language));

    JFreeChart jfreechart = ChartFactory.createXYLineChart(chartTitle, // Title
            replaceParameters(xLegend), // x-axis Label
            replaceParameters(yLegend), // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            true, // Show Legend
            true, // Use tooltips
            false // Configure chart to generate URLs?
    );

    // hide legend if necessary
    if (!hasLegend) {
        jfreechart.removeLegend();
    }

    // hide border
    jfreechart.setBorderVisible(false);

    // title
    setTitle(jfreechart);

    // charts colors & values 
    boolean showValues = (chart.getShowYValuesOnChart() == null) ? false : chart.getShowYValuesOnChart();
    DecimalFormat decimalFormat;
    DecimalFormat percentageFormat;
    if (chart.getYTooltipPattern() == null) {
        decimalFormat = new DecimalFormat("#");
        percentageFormat = new DecimalFormat("0.00%");
    } else {
        decimalFormat = new DecimalFormat(chart.getYTooltipPattern());
        percentageFormat = decimalFormat;
    }
    XYPlot plot = (XYPlot) jfreechart.getPlot();
    for (int i = 0; i < charts.length; i++) {
        plot.getRenderer().setSeriesPaint(i, chart.getForegrounds().get(i));
        if (showValues) {
            plot.getRenderer().setSeriesItemLabelsVisible(i, true);
            plot.getRenderer().setSeriesItemLabelGenerator(i,
                    new StandardXYItemLabelGenerator("{2}", decimalFormat, percentageFormat));
        }
    }

    if (showValues) {
        // increase a little bit the range axis to view all item label values over points
        plot.getRangeAxis().setUpperMargin(0.2);
    }

    // grid axis visibility & colors 
    if ((chart.getXShowGrid() != null) && !chart.getXShowGrid()) {
        plot.setDomainGridlinesVisible(false);
    } else {
        if (chart.getXGridColor() != null) {
            plot.setDomainGridlinePaint(chart.getXGridColor());
        } else {
            plot.setDomainGridlinePaint(Color.BLACK);
        }
    }
    if ((chart.getYShowGrid() != null) && !chart.getYShowGrid()) {
        plot.setRangeGridlinesVisible(false);
    } else {
        if (chart.getYGridColor() != null) {
            plot.setRangeGridlinePaint(chart.getYGridColor());
        } else {
            plot.setRangeGridlinePaint(Color.BLACK);
        }
    }

    // chart background
    plot.setBackgroundPaint(chart.getBackground());

    // labels color
    plot.getDomainAxis().setTickLabelPaint(chart.getXColor());
    plot.getRangeAxis().setTickLabelPaint(chart.getYColor());

    //legend color
    plot.getDomainAxis().setLabelPaint(chart.getXLegend().getColor());
    plot.getRangeAxis().setLabelPaint(chart.getYLegend().getColor());

    // legend font
    plot.getDomainAxis().setLabelFont(chart.getXLegend().getFont());
    plot.getRangeAxis().setLabelFont(chart.getYLegend().getFont());

    // hide labels
    if ((chart.getXShowLabel() != null) && !chart.getXShowLabel()) {
        plot.getDomainAxis().setTickLabelsVisible(false);
        plot.getDomainAxis().setTickMarksVisible(false);
    }
    if ((chart.getYShowLabel() != null) && !chart.getYShowLabel()) {
        plot.getRangeAxis().setTickLabelsVisible(false);
        plot.getRangeAxis().setTickMarksVisible(false);
    }

    // label orientation 
    if (chart.getXorientation() == Chart.VERTICAL) {
        plot.getDomainAxis().setVerticalTickLabels(true);
    }

    // labels fonts
    plot.getDomainAxis().setTickLabelFont(chart.getXLabelFont());
    plot.getRangeAxis().setTickLabelFont(chart.getYLabelFont());

    // point style
    Shape pointShape = null;
    byte style = chart.getType().getStyle();
    switch (style) {
    case ChartType.STYLE_LINE_DOT_SOLID:
    case ChartType.STYLE_LINE_DOT_HOLLOW:
        pointShape = new Ellipse2D.Float(-3.0f, -3.0f, 6.0f, 6.0f);
        break;
    case ChartType.STYLE_LINE_DOT_ANCHOR: // triangle
        GeneralPath s5 = new GeneralPath();
        s5.moveTo(0.0f, -3.0f);
        s5.lineTo(3.0f, 3.0f);
        s5.lineTo(-3.0f, 3.0f);
        s5.closePath();
        pointShape = s5;
        break;
    case ChartType.STYLE_LINE_DOT_BOW:
        GeneralPath s4 = new GeneralPath();
        s4.moveTo(-3.0f, -3.0f);
        s4.lineTo(3.0f, -3.0f);
        s4.lineTo(-3.0f, 3.0f);
        s4.lineTo(3.0f, 3.0f);
        s4.closePath();
        pointShape = s4;
        break;
    case ChartType.STYLE_LINE_DOT_STAR:
        pointShape = new Star(-3.0f, 0f).getShape();
        break;
    default:
        // no shape
        break;
    }

    if (pointShape != null) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
        renderer.setUseFillPaint(true);
        for (int i = 0; i < charts.length; i++) {
            renderer.setSeriesShapesVisible(i, true);
            if (style != ChartType.STYLE_LINE_DOT_SOLID) {
                renderer.setSeriesFillPaint(i, chart.getBackground());
            } else {
                renderer.setSeriesFillPaint(i, chart.getForegrounds().get(i));
            }
            renderer.setSeriesShape(i, pointShape);
        }
    }

    final HashMap<String, String> formatValues = createChart(plot.getRangeAxis(), charts);

    // in x axis does not contain number values , values are strings representing one unit 
    if (!integerXValue) {
        ((NumberAxis) plot.getDomainAxis()).setTickUnit(new NumberTickUnit(1));
        ((NumberAxis) plot.getDomainAxis()).setNumberFormatOverride(new DecimalFormat() {
            @Override
            public StringBuffer format(double number, StringBuffer result, FieldPosition fieldPosition) {
                String s = formatValues.get(String.valueOf(Math.round(number)));
                if (s == null) {
                    s = "";
                }
                return result.append(s);
            }
        });
    }

    return jfreechart;

}