Esempio n. 1
0
  /** Draws the regression equation into the regression equation JLabel icon */
  public void setRegressionEquationLabel() {

    // get the LaTeX string for the regression equation

    String eqn;
    // GeoElement geoRegression = statDialog.getRegressionModel();

    try {
      // prepare number format
      StringTemplate highPrecision;
      if (daModel.getPrintDecimals() >= 0)
        highPrecision =
            StringTemplate.printDecimals(StringType.LATEX, daModel.getPrintDecimals(), false);
      else
        highPrecision =
            StringTemplate.printFigures(StringType.LATEX, daModel.getPrintFigures(), false);

      // no regression
      if (daModel.getRegressionMode().equals(Regression.NONE)
          || statDialog.getRegressionModel() == null) {
        eqn = "";
      }

      // nonlinear
      else {
        eqn = "y = " + statDialog.getRegressionModel().getFormulaString(highPrecision, true);
      }

    } catch (Exception e) {
      e.printStackTrace();
      eqn = "\\text{" + loc.getPlain("NotAvailable") + "}";
    }

    // create an icon with the LaTeX string
    ImageIcon icon =
        GeoGebraIconD.createLatexIcon(app, eqn, this.getFont(), false, Color.RED, null);

    // set the label icon with our equation string
    lblRegEquation.setIcon(icon);
    lblRegEquation.revalidate();

    updateGUI();
  }
Esempio n. 2
0
  private void updateGUI() {

    cbPolyOrder.setVisible(daModel.getRegressionMode().equals(Regression.POLY));
    predictionPanel.setVisible(!(daModel.getRegressionMode().equals(Regression.NONE)));
    repaint();
  }