Package org.swtchart

Examples of org.swtchart.ITitle


 
  private void renderChart(Composite composite) {
    compositeChart.setLayout(new FillLayout(SWT.HORIZONTAL));
    chart = new Chart(composite, SWT.NONE);
    chart.setVisible(true);
    ITitle title = chart.getTitle();
    title.setText("Sieve Test Chart");
  }
View Full Code Here


    ////////////////////////////////////////////////////////////////////////////
   
    ////////////////////////////////////////////////////////////////////////////
    // Titel des Charts
    {
      ITitle title = this.chart.getTitle();
      title.setText(this.getTitle());
      title.setForeground(GUI.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
      title.setFont(Font.BOLD.getSWTFont());
    }
    //
    ////////////////////////////////////////////////////////////////////////////
   
    ////////////////////////////////////////////////////////////////////////////
View Full Code Here

        backgroundInPlotAreaButton.setColorValue(chart
                .getBackgroundInPlotArea().getRGB());
        backgroundButton.setColorValue(chart.getBackground().getRGB());
        orientationButton.setSelection(chart.getOrientation() == SWT.VERTICAL);

        ITitle title = chart.getTitle();
        showTitleButton.setSelection(title.isVisible());
        setTitleControlsEnable(title.isVisible());
        titleText.setText(title.getText());
        fontSizeSpinner.setSelection(title.getFont().getFontData()[0]
                .getHeight());
        titleColorButton.setColorValue(title.getForeground().getRGB());
    }
View Full Code Here

        resources.put(CHART_BACKGROUND, color);

        chart.setOrientation(orientationButton.getSelection() ? SWT.VERTICAL
                : SWT.HORIZONTAL);

        ITitle title = chart.getTitle();
        title.setVisible(showTitleButton.getSelection());
        title.setText(titleText.getText());

        FontData fontData = title.getFont().getFontData()[0];
        fontData.setHeight(fontSizeSpinner.getSelection());
        Font font = new Font(Display.getDefault(), fontData);
        title.setFont(font);
        resources.put(TITLE_FONT, font);

        color = new Color(Display.getDefault(), titleColorButton
                .getColorValue());
        title.setForeground(color);
        resources.put(TITLE_FOREGROUND, color);
    }
View Full Code Here

    ////////////////////////////////////////////////////////////////////////////
   
    ////////////////////////////////////////////////////////////////////////////
    // Titel des Charts
    {
      ITitle title = this.chart.getTitle();
      title.setText(this.getTitle());
      title.setForeground(GUI.getDisplay().getSystemColor(SWT.COLOR_BLACK));
      title.setFont(Font.BOLD.getSWTFont());
    }
    //
    ////////////////////////////////////////////////////////////////////////////
   
    ////////////////////////////////////////////////////////////////////////////
    // 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));
     
      //////////////////////////////////////////////////////////////////////////
      // Layout
      int[] cValues = ColorGenerator.create(ColorGenerator.PALETTE_OFFICE + i);
      barSeries.setBarColor(getColor(new RGB(cValues[0],cValues[1],cValues[2])));
     
      ISeriesLabel label = barSeries.getLabel();
      label.setFont(Font.SMALL.getSWTFont());
      label.setFormat(HBCI.DECIMALFORMAT.toPattern()); // BUGZILLA 1123
      label.setForeground(GUI.getDisplay().getSystemColor(SWT.COLOR_WHITE));
      label.setVisible(true);
      //
      //////////////////////////////////////////////////////////////////////////
    }

    // Titel aktualisieren
    ITitle title = this.chart.getTitle();
    title.setText(this.getTitle());

    this.comp.layout();
    this.chart.getAxisSet().adjustRange();
  }
View Full Code Here

TOP

Related Classes of org.swtchart.ITitle

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.