Package org.swtchart

Examples of org.swtchart.IAxis


    ISeries series = seriesSet.createSeries(SeriesType.LINE, "Particle Size Curve");
    series.setXSeries(xSeries);
    series.setYSeries(ySeries);
   
    IAxisSet axisSet = chart.getAxisSet();
    IAxis xAxis = axisSet.getXAxis(0);
//    xAxis.adjustRange();
    xAxis.setRange(new Range(0.001, 10));
    xAxis.getTitle().setText("Grain Size ( mm )");
    xAxis.enableLogScale(true);
    IAxis yAxis = axisSet.getYAxis(0);
    yAxis.getTitle().setText("Percent Finer");
//    yAxis.setPosition(Position.Secondary);
    yAxis.setRange(new Range(0, 100));
//    axisSet.adjustRange();
   
    chart.update();
  }
View Full Code Here


    // Layout der Achsen
    Color gray = getColor(new RGB(234,234,234));
   
    // X-Achse
    {
      IAxis axis = this.chart.getAxisSet().getXAxis(0);
      axis.getTitle().setFont(Font.SMALL.getSWTFont());
      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);

      IAxisTick tick = axis.getTick();
      tick.setFormat(HBCI.DATEFORMAT);
      tick.setForeground(GUI.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
    }
   
    // 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_DARK_GRAY));
    }
    //
    ////////////////////////////////////////////////////////////////////////////
View Full Code Here

        for (ISeries series : getSeries()) {
            int xAxisId = series.getXAxisId();
            int yAxisId = series.getYAxisId();

            IAxis xAxis = chart.getAxisSet().getXAxis(xAxisId);
            IAxis yAxis = chart.getAxisSet().getYAxis(yAxisId);
            if (xAxis == null || yAxis == null) {
                continue;
            }
            Range xRange = xAxis.getRange();
            Range yRange = yAxis.getRange();

            if (xRange == null || yRange == null) {
                continue;
            }

            double xMin = xRange.lower;
            double xMax = xRange.upper;
            double yMin = yRange.lower;
            double yMax = yRange.upper;

            config.setXLogScale(xAxis.isLogScaleEnabled());
            config.setYLogScale(yAxis.isLogScaleEnabled());

            double lower = xMin - (xMax - xMin) * 0.015;
            double upper = xMax + (xMax - xMin) * 0.015;
            if (xAxis.isLogScaleEnabled()) {
                lower = ((Series) series).getXRange().lower;
            }
            config.setXRange(lower, upper);
            lower = yMin - (yMax - yMin) * 0.015;
            upper = yMax + (yMax - yMin) * 0.015;
            if (yAxis.isLogScaleEnabled()) {
                lower = ((Series) series).getYRange().lower;
            }
            config.setYRange(lower, upper);

            ICompress compressor = ((Series) series).getCompressor();
View Full Code Here

    // 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

        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

        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

    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

     * @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

        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

        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

TOP

Related Classes of org.swtchart.IAxis

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.