Example #1
0
 public void redrawGraph() {
   // get the new graph
   vv.validate();
   vv.repaint();
   splitPanelLeft.repaint();
   getContentPane().repaint();
   validate();
   repaint();
 }
  public void makeGraph() {
    nbColToGraph = getNbColumns();
    Dimension size = graphPanel.getSize();
    String lstr = maxLengthXAxisLabel.getText();
    // canvas size
    int width = (int) size.getWidth();
    int height = (int) size.getHeight();
    if (!dynamicGraphSize.isSelected()) {
      String wstr = graphWidth.getText();
      String hstr = graphHeight.getText();
      if (wstr.length() != 0) {
        width = Integer.parseInt(wstr);
      }
      if (hstr.length() != 0) {
        height = Integer.parseInt(hstr);
      }
    }

    if (lstr.length() == 0) {
      lstr = "20"; // $NON-NLS-1$
    }
    int maxLength = Integer.parseInt(lstr);
    String yAxisStr = maxValueYAxisLabel.getText();
    int maxYAxisScale = yAxisStr.length() == 0 ? 0 : Integer.parseInt(yAxisStr);

    graphPanel.setData(this.getData());
    graphPanel.setTitle(graphTitle.getText());
    graphPanel.setMaxLength(maxLength);
    graphPanel.setMaxYAxisScale(maxYAxisScale);
    graphPanel.setXAxisLabels(getAxisLabels());
    graphPanel.setXAxisTitle((String) columnsList.getSelectedItem());
    graphPanel.setYAxisLabels(this.yAxisLabel);
    graphPanel.setYAxisTitle(this.yAxisTitle);
    graphPanel.setLegendLabels(getLegendLabels());
    graphPanel.setColor(getBackColors());
    graphPanel.setForeColor(colorForeGraph);
    graphPanel.setOutlinesBarFlag(drawOutlinesBar.isSelected());
    graphPanel.setShowGrouping(numberShowGrouping.isSelected());
    graphPanel.setValueOrientation(valueLabelsVertical.isSelected());
    graphPanel.setLegendPlacement(
        StatGraphProperties.getPlacementNameMap()
            .get(legendPlacementList.getSelectedItem())
            .intValue());

    graphPanel.setTitleFont(
        new Font(
            StatGraphProperties.getFontNameMap().get(titleFontNameList.getSelectedItem()),
            StatGraphProperties.getFontStyleMap()
                .get(titleFontStyleList.getSelectedItem())
                .intValue(),
            Integer.parseInt((String) titleFontSizeList.getSelectedItem())));
    graphPanel.setLegendFont(
        new Font(
            StatGraphProperties.getFontNameMap().get(fontNameList.getSelectedItem()),
            StatGraphProperties.getFontStyleMap().get(fontStyleList.getSelectedItem()).intValue(),
            Integer.parseInt((String) fontSizeList.getSelectedItem())));
    graphPanel.setValueFont(
        new Font(
            StatGraphProperties.getFontNameMap().get(valueFontNameList.getSelectedItem()),
            StatGraphProperties.getFontStyleMap()
                .get(valueFontStyleList.getSelectedItem())
                .intValue(),
            Integer.parseInt((String) valueFontSizeList.getSelectedItem())));

    graphPanel.setHeight(height);
    graphPanel.setWidth(width);
    spane.repaint();
  }