Package org.jfree.chart.axis

Examples of org.jfree.chart.axis.DateAxis


            { 1304892000000L, 1304632800000L, 1304546400000L, 1304460000000L,
              1304373600000L, 1304287200000L, 1320015600000L, 1309384800000L,
              1319752800000L, 1319666400000L, 1319580000000L, 1319493600000L };
        Arrays.sort(dates);

        DateAxis axis = new DateAxis("Date");
        // set start and end date
        Date start = new Date(dates[0]);
        Date end = new Date(dates[dates.length-1]);
        axis.setMinimumDate(start);
        axis.setMaximumDate(end);

        SegmentedTimeline timeline =
            SegmentedTimeline.newMondayThroughFridayTimeline();
        timeline.setStartTime(start.getTime());
        axis.setTimeline(timeline);

        BufferedImage image = new BufferedImage(200, 100,
                BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2 = image.createGraphics();
        Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, 500, 200);

        // if the bug is still present, this leads to an endless loop
        axis.refreshTicks(g2, new AxisState(), area, RectangleEdge.BOTTOM);
    }
View Full Code Here


        if (_legendItems == null) {
            _setDefaultLegendItems();
        }

        XYPlot xyPlot = _chart.getXYPlot();
        DateAxis axis = (DateAxis) xyPlot.getDomainAxis();
        axis.setRange(_model.getStartDate(), _model.getEndDate());
        axis.setLabel(_getXAxisLabel());

        // mark the ranges of twilight and darkness
        xyPlot.clearDomainMarkers();
        _addDarknessMarker(xyPlot, _model.getNauticalTwilightStart(),
                _model.getNauticalTwilightEnd(), TWILIGHT_ALPHA, Color.gray);
View Full Code Here

                _model.getAstronomicalTwilightEnd(), DARKNESS_ALPHA, Color.black);
    }

    // Make the X axis displaying the dates
    private DateAxis _makeDateAxis() {
        DateAxis timeAxis = new DateAxis(_getXAxisLabel(), _model.getTimeZone(), Locale.getDefault());
        timeAxis.setLowerMargin(0.02)// reduce the default margins on the time axis
        timeAxis.setUpperMargin(0.02);

        // Override date format to handle LST dates
        SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm") {
            public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition pos) {
                if (_model.getTimeZoneId().equals(ElevationPlotModel.LST)) {
                    date = _model.getLst(date);
                }
                return super.format(date, toAppendTo, pos);
            }
        };
        dateFormat.setTimeZone(_model.getTimeZone());
        timeAxis.setDateFormatOverride(dateFormat);

        return timeAxis;
    }
View Full Code Here

    /**
     * @param plot
     */
    private void setXAxisFormat(XYPlot plot) {
        DateAxis xAxis = (DateAxis) plot.getHorizontalValueAxis();
        xAxis.setDateFormatOverride(new SimpleDateFormat("dd/MM"));
    }
View Full Code Here

      case COMBINED_XY :
        final int layoutConst = getLayoutConstant(layout);
        Plot plot = null;
        switch (layoutConst) {
          case DOMAIN :
            ValueAxis domainAxis = new DateAxis(xAxisLabel);
            plot = new CombinedDomainXYPlot(domainAxis);
            for (int i = 0; i < plotDefinitions.size(); i++) {
              PlotDefinition pd = (PlotDefinition) plotDefinitions.get(i);
              check((Dataset) pd.getDataset(), XYDataset.class, chartType);
              XYPlot temp = (XYPlot) pd.getPlot(chartTypeConst);
              temp.setRangeAxis(new NumberAxis(pd.getYaxislabel()));
              ((CombinedDomainXYPlot) plot).add(temp);
            }
            return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
          case RANGE :
            ValueAxis rangeAxis = new NumberAxis(yAxisLabel);
            plot = new CombinedRangeXYPlot(rangeAxis);
            for (int i = 0; i < plotDefinitions.size(); i++) {
              PlotDefinition pd = (PlotDefinition) plotDefinitions.get(i);
              check((Dataset) pd.getDataset(), XYDataset.class, chartType);
              XYPlot temp = (XYPlot) pd.getPlot(chartTypeConst);
              temp.setDomainAxis(new DateAxis(pd.getXaxislabel()));
              ((CombinedRangeXYPlot) plot).add(temp);
            }
            return new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
          default :
            throw new AttributeValidationException(layout, " any value");
View Full Code Here

    }
   
  public Axis createAxis(int orientation, int type, String label) {
    switch (type) {
      case AXIS_TYPE_DATE :
        return new DateAxis(label);
      case AXIS_TYPE_NUMBER :
        return new NumberAxis(label);
      case AXIS_TYPE_CATEGORY://added by lrh 2005-07-11
              return new CategoryAxis(label);
      default:
View Full Code Here

      StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer;
      //rr.setPlotShapes(true);
      rr.setShapesFilled(true);
    }
   
    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setAutoRange(false);
    axis.setVerticalTickLabels(true);
   
    axis.setTickUnit(new DateTickUnit(DateTickUnit.MONTH, 1));
    axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));
   
      response.setContentType("image/jpeg");         
      ChartUtilities.writeChartAsPNG(response.getOutputStream(), grafico, i * 35, 470);
      response.getOutputStream().flush();
      response.getOutputStream().close();
View Full Code Here

    // -----------------------------------------------------------

    String title = chartDefinition.getTitle();
    boolean legend = chartDefinition.isLegendIncluded();

    DateAxis domainAxis = new DateAxis( domainAxisLabel, TimeZone.getDefault() );
    ValueAxis rangeAxis = new NumberAxis( rangeAxisLabel );

    XYItemRenderer renderer = null;
    switch ( chartDefinition.getChartType() ) {
      case LINE_CHART_TYPE:
View Full Code Here

    // -----------------------------------------------------------

    String title = chartDefinition.getTitle();
    boolean legend = chartDefinition.isLegendIncluded();

    DateAxis domainAxis = new DateAxis( domainAxisLabel, TimeZone.getDefault() );
    ValueAxis rangeAxis = new NumberAxis( rangeAxisLabel );

    XYItemRenderer renderer = null;
    switch ( chartDefinition.getChartType() ) {
      case AREA_CHART_TYPE:
View Full Code Here

        if ( domainAxis != null ) {
          domainAxis.setLabel( timeSeriesCollectionChartDefintion.getDomainTitle() );
          domainAxis.setLabelFont( timeSeriesCollectionChartDefintion.getDomainTitleFont() );
          domainAxis.setVerticalTickLabels( timeSeriesCollectionChartDefintion.isDomainVerticalTickLabels() );
          if ( domainAxis instanceof DateAxis ) {
            DateAxis da = (DateAxis) domainAxis;
            if ( timeSeriesCollectionChartDefintion.getDateMinimum() != null ) {
              da.setMinimumDate( timeSeriesCollectionChartDefintion.getDateMinimum() );
            }
            if ( timeSeriesCollectionChartDefintion.getDateMaximum() != null ) {
              da.setMaximumDate( timeSeriesCollectionChartDefintion.getDateMaximum() );
            }
          }
        }

        ValueAxis rangeAxis = xyPlot.getRangeAxis();
View Full Code Here

TOP

Related Classes of org.jfree.chart.axis.DateAxis

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.