public void updateXYTitles(boolean isPointList, boolean isLeftToRight) { if (isPointList) { fldTitleX.setText(daModel.getDataTitles()[0]); fldTitleY.setText(daModel.getDataTitles()[0]); } else { if (isLeftToRight) { fldTitleX.setText(daModel.getDataTitles()[0]); fldTitleY.setText(daModel.getDataTitles()[1]); } else { fldTitleX.setText(daModel.getDataTitles()[1]); fldTitleY.setText(daModel.getDataTitles()[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(); }
public void actionPerformed(ActionEvent e) { Object source = e.getSource(); if (source instanceof JTextField) { doTextFieldActionPerformed((JTextField) source); } else if (source == cbRegression) { cbRegression.removeActionListener(this); daModel.setRegressionMode(cbRegression.getSelectedIndex()); updateRegressionPanel(); cbRegression.addActionListener(this); } else if (source == cbPolyOrder) { daModel.setRegressionOrder(cbPolyOrder.getSelectedIndex() + 2); statDialog.getController().setRegressionGeo(); statDialog.getController().updateRegressionPanel(); setRegressionEquationLabel(); // force update daModel.setRegressionMode(Regression.POLY.ordinal()); } }
public void updateScatterPlot() { if (!daModel.isRegressionMode()) { return; } metaPlotPanel.clear(); plotPanelNorth.clear(); plotPanelSouth.clear(); plotPanelSouth.add(LayoutUtil.panelRow(lblTitleX, fldTitleX)); plotPanelNorth.add(LayoutUtil.panelRow(lblTitleY, fldTitleY)); metaPlotPanel.add(plotPanelNorth); metaPlotPanel.add(plotPanel.getComponent()); metaPlotPanel.add(plotPanelSouth); }
/** Sets the labels to the current language */ public void setLabels() { createDisplayTypeComboBox(); lblStart.setText(loc.getMenu("Start") + " "); lblWidth.setText(loc.getMenu("Width") + " "); if (daModel.isRegressionMode()) { lblTitleX.setText(loc.getMenu("Column.X") + ": "); lblTitleY.setText(loc.getMenu("Column.Y") + ": "); } lblAdjust.setText(loc.getMenu("Adjustment") + ": "); optionsPanel.setLabels(); btnOptions.setToolTipText(loc.getMenu("Options")); }
public void resize(int offsetWidth, int offsetHeight, boolean update) { int w = offsetWidth; int h = offsetHeight; int width = optionsPanel.isVisible() ? w - optionsPanel.getOffsetWidth() - PLOTPANEL_MARGIN : w; int height = (frequencyTable.isVisible() ? h - spFrequencyTable.getOffsetHeight() : h) - lbDisplayType.getOffsetHeight() - PLOTPANEL_MARGIN; if (daModel.isRegressionMode()) { height -= 2 * lblTitleX.getOffsetHeight(); height -= lblTitleY.getOffsetHeight(); } if (width < PLOTPANEL_MIN_WIDTH) { width = PLOTPANEL_MIN_WIDTH; } if (height < PLOTPANEL_MIN_HEIGHT) { height = PLOTPANEL_MIN_HEIGHT; } if (oldWidth == width && oldHeight == height) { return; } oldWidth = width; oldHeight = height; plotPanel.setPreferredSize(new GDimensionW(width, height)); if (optionsPanel.isVisible()) { optionsPanel.resize(height); } plotPanel.updateSize(); plotPanel.repaintView(); plotPanel.getEuclidianController().calculateEnvironment(); if (update) { getModel().updatePlot(false); } if (app.has(Feature.JLM_IN_WEB)) { imagePanel.setPixelSize(width, height); } else { imageContainer.setPixelSize(width, height); } }
private void updateGUI() { // set updating flag so we don't have to add/remove action listeners isUpdating = true; // histogram/barchart ckManual.setSelected(settings.isUseManualClasses()); rbFreq.setSelected(settings.getFrequencyType() == StatPanelSettings.TYPE_COUNT); rbRelative.setSelected(settings.getFrequencyType() == StatPanelSettings.TYPE_RELATIVE); rbNormalized.setSelected(settings.getFrequencyType() == StatPanelSettings.TYPE_NORMALIZED); rbLeftRule.setSelected(settings.isLeftRule()); ckCumulative.setSelected(settings.isCumulative()); ckOverlayNormal.setSelected(settings.isHasOverlayNormal()); ckOverlayPolygon.setSelected(settings.isHasOverlayPolygon()); ckShowGrid.setSelected(settings.showGrid); ckAutoWindow.setSelected(settings.isAutomaticWindow()); ckShowFrequencyTable.setSelected(settings.isShowFrequencyTable()); ckShowHistogram.setSelected(settings.isShowHistogram()); if (settings.dataSource != null) { ckManual.setVisible(settings.getDataSource().getGroupType() != GroupType.CLASS); freqPanel.setVisible(settings.getDataSource().getGroupType() == GroupType.RAWDATA); } // normal overlay ckOverlayNormal.setEnabled(settings.getFrequencyType() == StatPanelSettings.TYPE_NORMALIZED); // bar chart width ckAutoBarWidth.setSelected(settings.isAutomaticBarWidth()); fldBarWidth.setText("" + settings.getBarWidth()); fldBarWidth.setEnabled(!ckAutoBarWidth.isSelected()); // window dimension lblYMin.setVisible(showYAxisSettings); fldYMin.setVisible(showYAxisSettings); lblYMax.setVisible(showYAxisSettings); fldYMax.setVisible(showYAxisSettings); lblYInterval.setVisible(showYAxisSettings); fldYInterval.setVisible(showYAxisSettings); dimPanel.setEnabled(!ckAutoWindow.isSelected()); fldXMin.setEnabled(!ckAutoWindow.isSelected()); fldXMax.setEnabled(!ckAutoWindow.isSelected()); fldXInterval.setEnabled(!ckAutoWindow.isSelected()); fldYMin.setEnabled(!ckAutoWindow.isSelected()); fldYMax.setEnabled(!ckAutoWindow.isSelected()); fldYInterval.setEnabled(!ckAutoWindow.isSelected()); lblXMin.setEnabled(!ckAutoWindow.isSelected()); lblXMax.setEnabled(!ckAutoWindow.isSelected()); lblXInterval.setEnabled(!ckAutoWindow.isSelected()); lblYMin.setEnabled(!ckAutoWindow.isSelected()); lblYMax.setEnabled(!ckAutoWindow.isSelected()); lblYInterval.setEnabled(!ckAutoWindow.isSelected()); // coordinate mode rbStandToStand.setSelected(settings.getCoordMode() == StatPanelSettings.CoordMode.STANDTOSTAND); rbLogToStand.setSelected(settings.getCoordMode() == StatPanelSettings.CoordMode.LOGTOSTAND); rbStandToLog.setSelected(settings.getCoordMode() == StatPanelSettings.CoordMode.STANDTOLOG); rbLogToLog.setSelected(settings.getCoordMode() == StatPanelSettings.CoordMode.LOGTOLOG); // update automatic dimensions fldXMin.setText("" + daModel.format(settings.xMin)); fldXMax.setText("" + daModel.format(settings.xMax)); fldXInterval.setText("" + daModel.format(settings.xAxesInterval)); fldYMin.setText("" + daModel.format(settings.yMin)); fldYMax.setText("" + daModel.format(settings.yMax)); fldYInterval.setText("" + daModel.format(settings.yAxesInterval)); // show outliers ckShowOutliers.setSelected(settings.isShowOutliers()); isUpdating = false; repaint(); }
private void updateGUI() { cbPolyOrder.setVisible(daModel.getRegressionMode().equals(Regression.POLY)); predictionPanel.setVisible(!(daModel.getRegressionMode().equals(Regression.NONE))); repaint(); }