Package it.marcoberri.mbmeteo.helper

Examples of it.marcoberri.mbmeteo.helper.ChartEnumMinMaxHelper


                    continue;
                }

                final Millisecond t = new Millisecond(tmpDate);

                ChartEnumMinMaxHelper chartEnum = ChartEnumMinMaxHelper.getByFieldAndType(field, "min");
                Method method = m.getClass().getMethod(chartEnum.getMethod());
                Number n = (Number) method.invoke(m);
                serieMin.add(t, n);


                chartEnum = ChartEnumMinMaxHelper.getByFieldAndType(field, "max");
                method = m.getClass().getMethod(chartEnum.getMethod());
                n = (Number) method.invoke(m);
                serieMax.add(t, n);


            } catch (IllegalAccessException ex) {
                log.error(ex);
            } catch (IllegalArgumentException ex) {
                log.error(ex);
            } catch (InvocationTargetException ex) {
                log.error(ex);
            } catch (NoSuchMethodException ex) {
                log.error(ex);
            } catch (SecurityException ex) {
                log.error(ex);
            }
        }


        final ChartEnumMinMaxHelper chartData = ChartEnumMinMaxHelper.getByFieldAndType(field, "min");


        final TimeSeriesCollection dataset = new TimeSeriesCollection();
        dataset.addSeries(serieMin);
        dataset.addSeries(serieMax);

        final JFreeChart chart = ChartFactory.createTimeSeriesChart("Max/Min", "", chartData.getUm(), dataset, true, false, false);
        final XYPlot plot = (XYPlot) chart.getPlot();
        final DateAxis axis = (DateAxis) plot.getDomainAxis();
        axis.setDateFormatOverride(new SimpleDateFormat(formatOut));

        axis.setVerticalTickLabels(true);
View Full Code Here


        q.order("_id");

        final List<MapReduceMinMax> mapReduceResult = q.asList();

        final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        ChartEnumMinMaxHelper chartEnum = ChartEnumMinMaxHelper.getByFieldAndType(field, type);

        for (MapReduceMinMax m : mapReduceResult) {
            try {
                final Date tmpDate = DateTimeUtil.getDate(formatIn, m.getId().toString());

                if (tmpDate == null) {
                    continue;
                }

                final Method method = m.getClass().getMethod(chartEnum.getMethod());
                final Number n = (Number) method.invoke(m);
                dataset.addValue(n, chartEnum.getType(), DateTimeUtil.dateFormat(formatOut, tmpDate));


            } catch (IllegalAccessException ex) {
                log.error(ex);
            } catch (IllegalArgumentException ex) {
                log.error(ex);
            } catch (InvocationTargetException ex) {
                log.error(ex);
            } catch (NoSuchMethodException ex) {
                log.error(ex);
            } catch (SecurityException ex) {
                log.error(ex);
            }
        }

        final JFreeChart chart = ChartFactory.createBarChart(
                chartEnum.getTitle(), // chart title
                "", // domain axis label
                chartEnum.getUm(), // range axis label
                dataset, // data
                PlotOrientation.VERTICAL, // orientation
                false, // include legend
                true, // tooltips?
                false // URLs?
View Full Code Here

TOP

Related Classes of it.marcoberri.mbmeteo.helper.ChartEnumMinMaxHelper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.