Examples of IAxis


Examples of org.swtchart.IAxis

    // Layout der Achsen
    Color gray = getColor(new RGB(230,230,230));
   
    // X-Achse
    {
      IAxis axis = this.chart.getAxisSet().getXAxis(0);
      axis.getTitle().setForeground(GUI.getDisplay().getSystemColor(SWT.COLOR_WHITE)); // wenn wir den auch ausblenden, geht die initiale Skalierung kaputt. Scheint ein Bug zu sein

      IGrid grid = axis.getGrid();
      grid.setStyle(LineStyle.DOT);
      grid.setForeground(gray);

      axis.getTick().setForeground(GUI.getDisplay().getSystemColor(SWT.COLOR_BLACK));
    }
   
    // Y-Achse
    {
      IAxis axis = this.chart.getAxisSet().getYAxis(0);
      axis.getTitle().setVisible(false);

      IGrid grid = axis.getGrid();
      grid.setStyle(LineStyle.DOT);
      grid.setForeground(gray);
     
      IAxisTick tick = axis.getTick();
      tick.setFormat(HBCI.DECIMALFORMAT);
      tick.setForeground(GUI.getDisplay().getSystemColor(SWT.COLOR_BLACK));
    }
    //
    ////////////////////////////////////////////////////////////////////////////

   
    ////////////////////////////////////////////////////////////////////////////
    // Neu zeichnen
    List<ChartData> data = getData();
    for (int i=0;i<data.size();++i)
    {
      final List<String> labelLine = new LinkedList<String>();
      final List<Number> dataLine  = new LinkedList<Number>();
     
      ChartData cd          = (ChartData) data.get(i);
      List list             = cd.getData();
      String dataAttribute  = cd.getDataAttribute();
      String labelAttribute = cd.getLabelAttribute();

      if (list == null || list.size() == 0 || dataAttribute == null || labelAttribute == null)
      {
        Logger.debug("skipping data line, contains no data");
        dataLine.add(new Double(0));
        labelLine.add("");
      }
      else
      {
        for (Object o:list)
        {
          Object value = BeanUtil.get(o,dataAttribute);
          Object label = BeanUtil.get(o,labelAttribute);
         
          if (label == null || value == null || !(value instanceof Number))
            continue;

          Number n = (Number) value;
          if (Math.abs(n.doubleValue()) < 0.01d)
            continue; // ueberspringen, nix drin
          dataLine.add(n);
          labelLine.add(label.toString());
        }
      }
      if (dataLine.size() == 0)
        continue; // wir haben gar keine Werte

      IAxis axis = this.chart.getAxisSet().getXAxis(0);
      axis.setCategorySeries(labelLine.toArray(new String[labelLine.size()]));
      axis.enableCategory(true);

      IBarSeries barSeries = (IBarSeries) this.chart.getSeriesSet().createSeries(SeriesType.BAR,Integer.toString(i));
      barSeries.setYSeries(toArray(dataLine));
     
      //////////////////////////////////////////////////////////////////////////
View Full Code Here

Examples of org.swtchart.IAxis

        if (ySeries != null) {
            compressor.setYSeries(ySeries);
        }

        if (minX <= 0) {
            IAxis axis = chart.getAxisSet().getXAxis(xAxisId);
            if (axis != null) {
                axis.enableLogScale(false);
            }
        }
    }
View Full Code Here

Examples of org.swtchart.IAxis

        compressor.setXSeries(xSeries);
        compressor.setYSeries(ySeries);

        if (minX <= 0) {
            IAxis axis = chart.getAxisSet().getXAxis(xAxisId);
            if (axis != null) {
                axis.enableLogScale(false);
            }
        }
        if (minY <= 0) {
            IAxis axis = chart.getAxisSet().getYAxis(yAxisId);
            if (axis != null) {
                axis.enableLogScale(false);
            }
            stackEnabled = false;
        }
    }
View Full Code Here

Examples of org.swtchart.IAxis

    public void setXAxisId(int id) {
        if (xAxisId == id) {
            return;
        }

        IAxis axis = chart.getAxisSet().getXAxis(xAxisId);

        if (minX <= 0 && axis != null && axis.isLogScaleEnabled()) {
            chart.getAxisSet().getXAxis(xAxisId).enableLogScale(false);
        }

        xAxisId = id;
View Full Code Here

Examples of org.swtchart.IAxis

     * @see ISeries#getPixelCoordinates(int)
     */
    public Point getPixelCoordinates(int index) {

        // get the horizontal and vertical axes
        IAxis hAxis;
        IAxis vAxis;
        if (chart.getOrientation() == SWT.HORIZONTAL) {
            hAxis = chart.getAxisSet().getXAxis(xAxisId);
            vAxis = chart.getAxisSet().getYAxis(yAxisId);
        } else if (chart.getOrientation() == SWT.VERTICAL) {
            hAxis = chart.getAxisSet().getYAxis(yAxisId);
View Full Code Here

Examples of org.swtchart.IAxis

        return categoryEnabled ? getFocusCategoryAt(event) : getFocusDateAt(event);
    }

    private Integer getFocusCategoryAt(Event event)
    {
        IAxis xAxis = chart.getAxisSet().getXAxes()[0];
        int coordinate = (int) xAxis.getDataCoordinate(event.x);

        String[] categories = xAxis.getCategorySeries();

        if (coordinate < 0)
            coordinate = 0;
        else if (coordinate > categories.length - 1)
            coordinate = categories.length - 1;
View Full Code Here

Examples of org.swtchart.IAxis

        return coordinate;
    }

    private Date getFocusDateAt(Event event)
    {
        IAxis xAxis = chart.getAxisSet().getXAxes()[0];

        long time = (long) xAxis.getDataCoordinate(event.x);

        Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(time);
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
View Full Code Here

Examples of org.swtchart.IAxis

        setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
        getTitle().setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
        getLegend().setVisible(false);

        // x axis
        IAxis xAxis = getAxisSet().getXAxis(0);
        xAxis.getTitle().setVisible(false);
        xAxis.getTick().setVisible(false);
        xAxis.getGrid().setStyle(LineStyle.NONE);

        String[] categories = new String[dates.size()];
        for (int ii = 0; ii < categories.length; ii++)
            categories[ii] = dates.get(ii).toString(ISODateTimeFormat.date());
        xAxis.setCategorySeries(categories);
        xAxis.enableCategory(true);

        // y axis
        IAxis yAxis = getAxisSet().getYAxis(0);
        yAxis.getTitle().setVisible(false);
        yAxis.getTick().setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
        yAxis.setPosition(Position.Secondary);

        ((IPlotArea) getPlotArea()).addCustomPaintListener(new ICustomPaintListener()
        {
            @Override
            public void paintControl(PaintEvent e)
View Full Code Here

Examples of org.swtchart.IAxis

        return toolTip;
    }

    private void paintTimeGrid(PaintEvent e)
    {
        IAxis xAxis = getAxisSet().getXAxis(0);
        Range range = xAxis.getRange();

        final DateMidnight start = dates.get(0);
        final DateMidnight end = dates.get(dates.size() - 1);

        int totalDays = Days.daysBetween(start, end).getDays() + 1;

        DateMidnight current = start.plusYears(1).withMonthOfYear(1).withDayOfMonth(1);
        while (current.isBefore(end))
        {
            int days = Days.daysBetween(start, current).getDays();
            int y = xAxis.getPixelCoordinate((double) days * range.upper / (double) totalDays);
            e.gc.drawLine(y, 0, y, e.height);
            e.gc.drawText(String.valueOf(current.getYear()), y + 5, 5);

            current = current.plusYears(1);
        }
View Full Code Here

Examples of org.swtchart.IAxis

        setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
        getTitle().setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
        getLegend().setVisible(false);

        // x axis
        IAxis xAxis = getAxisSet().getXAxis(0);
        xAxis.getTitle().setVisible(false);
        xAxis.getTick().setVisible(false);
        xAxis.getGrid().setStyle(LineStyle.NONE);

        // y axis
        IAxis yAxis = getAxisSet().getYAxis(0);
        yAxis.getTitle().setVisible(false);
        yAxis.getTick().setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
        yAxis.setPosition(Position.Secondary);

        ((IPlotArea) getPlotArea()).addCustomPaintListener(new ICustomPaintListener()
        {
            @Override
            public void paintControl(PaintEvent e)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.