javafx.geometry.Orientation Java Examples

The following examples show how to use javafx.geometry.Orientation. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IncDecSlider.java    From phoebus with Eclipse Public License 1.0 6 votes vote down vote up
private void handleTrackClick(final Node track, final MouseEvent event)
{
    // Where, in units of 0..1, was the track clicked?
    final double click;
    if (getOrientation() == Orientation.HORIZONTAL)
        click = event.getX() / track.getBoundsInLocal().getWidth();
    else
    {
        final double height = track.getBoundsInLocal().getHeight();
        click = (height - event.getY()) / height;
    }
    event.consume();

    // Is that below or above the current value in units of 0..1?
    final double val = (getValue() - getMin()) / (getMax() - getMin());
    if (click > val)
        increment();
    else
        decrement();
}
 
Example #2
Source File: ContentZoomPane.java    From JavaFXSmartGraph with MIT License 6 votes vote down vote up
private Node createSlider() {

        Slider slider = new Slider(MIN_SCALE, MAX_SCALE, MIN_SCALE);
        slider.setOrientation(Orientation.VERTICAL);
        slider.setShowTickMarks(true);
        slider.setShowTickLabels(true);
        slider.setMajorTickUnit(SCROLL_DELTA);
        slider.setMinorTickCount(1);
        slider.setBlockIncrement(0.125f);
        slider.setSnapToTicks(true);

        Text label = new Text("Zoom");

        VBox paneSlider = new VBox(slider, label);

        paneSlider.setPadding(new Insets(10, 10, 10, 10));
        paneSlider.setSpacing(10);

        slider.valueProperty().bind(this.scaleFactorProperty());

        return paneSlider;
    }
 
Example #3
Source File: AbstractDataSetManagement.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
public Axis getFirstAxis(final Orientation orientation) {
    for (final Axis axis : getAxes()) {
        if (axis.getSide() == null) {
            continue;
        }
        switch (orientation) {
        case VERTICAL:
            if (axis.getSide().isVertical()) {
                return axis;
            }
            break;
        case HORIZONTAL:
        default:
            if (axis.getSide().isHorizontal()) {
                return axis;
            }
            break;
        }
    }
    return null;
}
 
Example #4
Source File: XValueIndicator.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
@Override
public void layoutChildren() {
    if (getChart() == null) {
        return;
    }

    final Bounds plotAreaBounds = getChart().getCanvas().getBoundsInLocal();
    final double minX = plotAreaBounds.getMinX();
    final double maxX = plotAreaBounds.getMaxX();
    final double minY = plotAreaBounds.getMinY();
    final double maxY = plotAreaBounds.getMaxY();
    final double xPos = minX + getChart().getFirstAxis(Orientation.HORIZONTAL).getDisplayPosition(getValue());

    if (xPos < minX || xPos > maxX) {
        getChartChildren().clear();
    } else {
        layoutLine(xPos, minY, xPos, maxY);
        layoutMarker(xPos, minY + 1.5 * AbstractSingleValueIndicator.triangleHalfWidth, xPos, maxY);
        layoutLabel(new BoundingBox(xPos, minY, 0, maxY - minY), AbstractSingleValueIndicator.MIDDLE_POSITION,
                getLabelPosition());
    }
}
 
Example #5
Source File: DataPointTooltip.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
private DataPoint findNearestDataPointWithinPickingDistance(final Chart chart, final Point2D mouseLocation) {
    DataPoint nearestDataPoint = null;
    if (!(chart instanceof XYChart)) {
        return null;
    }
    final XYChart xyChart = (XYChart) chart;
    // final double xValue = toDataPoint(xyChart.getYAxis(),
    // mouseLocation).getXValue().doubleValue();
    // TODO: iterate through all axes, renderer and datasets
    final double xValue = xyChart.getXAxis().getValueForDisplay(mouseLocation.getX());

    for (final DataPoint dataPoint : findNeighborPoints(xyChart, xValue)) {
        // Point2D displayPoint = toDisplayPoint(chart.getYAxis(),
        // (X)dataPoint.x , dataPoint.y);
        if (getChart().getFirstAxis(Orientation.HORIZONTAL) instanceof Axis) {
            final double x = xyChart.getXAxis().getDisplayPosition(dataPoint.x);
            final double y = xyChart.getYAxis().getDisplayPosition(dataPoint.y);
            final Point2D displayPoint = new Point2D(x, y);
            dataPoint.distanceFromMouse = displayPoint.distance(mouseLocation);
            if (displayPoint.distance(mouseLocation) <= getPickingDistance() && (nearestDataPoint == null || dataPoint.distanceFromMouse < nearestDataPoint.distanceFromMouse)) {
                nearestDataPoint = dataPoint;
            }
        }
    }
    return nearestDataPoint;
}
 
Example #6
Source File: EditDataSet.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
protected DataPoint findNearestDataPoint(final Chart chart, final Point2D mouseLocation) {
    if (!(chart instanceof XYChart)) {
        return null;
    }
    final XYChart xyChart = (XYChart) chart;
    // TODO: iterate through all axes, renderer and datasets
    final double xValue = xyChart.getXAxis().getValueForDisplay(mouseLocation.getX());

    DataPoint nearestDataPoint = null;
    for (final DataPoint dataPoint : findNeighborPoints(xyChart, xValue)) {
        if (getChart().getFirstAxis(Orientation.HORIZONTAL) != null) {
            final double x = xyChart.getXAxis().getDisplayPosition(dataPoint.getX());
            final double y = xyChart.getYAxis().getDisplayPosition(dataPoint.getY());
            final Point2D displayPoint = new Point2D(x, y);
            dataPoint.setDistanceFromMouse(displayPoint.distance(mouseLocation));
            if ((nearestDataPoint == null
                        || dataPoint.getDistanceFromMouse() < nearestDataPoint.getDistanceFromMouse())) {
                nearestDataPoint = dataPoint;
            }
        }
    }
    return nearestDataPoint;
}
 
Example #7
Source File: ValueIndicatorSelectorTests.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
@TestFx
public void testSetterGetter() throws InterruptedException, ExecutionException {
    assertNotNull(field.getValueIndicators());
    assertNotNull(field.getValueIndicatorsUser());
    assertNotNull(field.getReuseIndicators());
    field.getReuseIndicators().setSelected(false);
    assertEquals(field.getReuseIndicators().isSelected(), field.isReuseIndicators());
    field.getReuseIndicators().setSelected(true);
    assertEquals(field.getReuseIndicators().isSelected(), field.isReuseIndicators());

    assertEquals(0, field.getValueIndicators().size());
    chart.getPlugins().add(new XValueIndicator(chart.getFirstAxis(Orientation.HORIZONTAL), 0.0, "xmin"));
    chart.getPlugins().add(new XValueIndicator(chart.getFirstAxis(Orientation.HORIZONTAL), 1.0, "xmax"));
    assertEquals(2, field.getValueIndicators().size());

    chart.getPlugins().remove(plugin);
    chart.getPlugins().add(plugin);

    assertDoesNotThrow(() -> field2 = new ValueIndicatorSelector(plugin, AxisMode.X, 2));
    root.getChildren().add(field2);
}
 
Example #8
Source File: EditDataSet.java    From chart-fx with Apache License 2.0 6 votes vote down vote up
private static Axis getFirstAxis(final List<Axis> axes, final Orientation orientation) {
    for (final Axis axis : axes) {
        if (axis.getSide() == null) {
            continue;
        }
        switch (orientation) {
        case VERTICAL:
            if (axis.getSide().isVertical()) {
                return axis;
            }
            break;
        case HORIZONTAL:
        default:
            if (axis.getSide().isHorizontal()) {
                return axis;
            }
            break;
        }
    }
    return null;
}
 
Example #9
Source File: LineChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createLeftYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE, final double AXIS_WIDTH) {
    Axis axis = new Axis(Orientation.VERTICAL, Position.LEFT);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefWidth(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setTopAnchor(axis, 0d);
    AnchorPane.setBottomAnchor(axis, AXIS_WIDTH);
    AnchorPane.setLeftAnchor(axis, 0d);

    return axis;
}
 
Example #10
Source File: MainPanel.java    From Quelea with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Create the new main panel.
 */
public MainPanel() {
    LOGGER.log(Level.INFO, "Creating schedule panel");
    schedulePanel = new SchedulePanel();
    LOGGER.log(Level.INFO, "Creating library panel");
    libraryPanel = new LibraryPanel();
    LOGGER.log(Level.INFO, "Creating preview panel");
    previewPanel = new PreviewPanel();
    LOGGER.log(Level.INFO, "Creating live panel");
    livePanel = new LivePanel();

    LOGGER.log(Level.INFO, "Creating split panels");
    scheduleAndLibrary = new SplitPane();
    scheduleAndLibrary.setMinWidth(160);
    scheduleAndLibrary.setOrientation(Orientation.VERTICAL);
    scheduleAndLibrary.getItems().add(schedulePanel);
    scheduleAndLibrary.getItems().add(libraryPanel);

    previewPanel.getLyricsPanel().getSplitPane().getDividers().get(0).positionProperty().
            bindBidirectional(livePanel.getLyricsPanel().getSplitPane().getDividers().get(0).positionProperty());
    previewPanel.getLyricsPanel().getSplitPane().setDividerPositions(0.58);
    livePanel.getLyricsPanel().getSplitPane().setDividerPositions(0.58);

    mainSplit = new SplitPane();
    mainSplit.setOrientation(Orientation.HORIZONTAL);
    mainSplit.getItems().add(scheduleAndLibrary);
    mainSplit.getItems().add(previewPanel);
    mainSplit.getItems().add(livePanel);
    setCenter(mainSplit);
    statusPanelGroup = new StatusPanelGroup();
    setBottom(statusPanelGroup);
    LOGGER.log(Level.INFO, "Created main panel");
}
 
Example #11
Source File: Axis.java    From charts with Apache License 2.0 5 votes vote down vote up
public void setOrientation(final Orientation ORIENTATION) {
    if (null == orientation) {
        _orientation = ORIENTATION;
        redraw();
    } else {
        orientation.set(ORIENTATION);
    }
}
 
Example #12
Source File: HorizontalListViewSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public HorizontalListViewSample() {
    ListView horizontalListView = new ListView();
    horizontalListView.setOrientation(Orientation.HORIZONTAL);
    horizontalListView.setItems(FXCollections.observableArrayList(
            "Row 1", "Row 2", "Long Row 3", "Row 4", "Row 5", "Row 6",
            "Row 7", "Row 8", "Row 9", "Row 10", "Row 11", "Row 12", "Row 13",
            "Row 14", "Row 15", "Row 16", "Row 17", "Row 18", "Row 19", "Row 20"
    ));
    getChildren().add(horizontalListView);
}
 
Example #13
Source File: LogChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createRightYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(MIN, MAX, Orientation.VERTICAL, AxisType.LOGARITHMIC, Position.RIGHT);
    axis.setPrefWidth(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setRightAnchor(axis, 0d);
    AnchorPane.setTopAnchor(axis, 0d);
    AnchorPane.setBottomAnchor(axis, 25d);

    return axis;
}
 
Example #14
Source File: FileUpItem.java    From oim-fx with MIT License 5 votes vote down vote up
private void initComponent() {
	Separator separator = new Separator();
	separator.setOrientation(Orientation.HORIZONTAL);

	// vBox.getChildren().add(buttonBox);

	bottomBox.getChildren().add(vBox);
	bottomBox.getChildren().add(separator);
	this.setBottom(bottomBox);
}
 
Example #15
Source File: Chart.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
public Axis getFirstAxis(final Orientation orientation) {
    for (final Axis axis : getAxes()) {
        if (axis.getSide() == null) {
            continue;
        }
        switch (orientation) {
        case VERTICAL:
            if (axis.getSide().isVertical()) {
                return axis;
            }
            break;
        case HORIZONTAL:
        default:
            if (axis.getSide().isHorizontal()) {
                return axis;
            }
            break;
        }
    }
    // Add default axis if no suitable axis is available
    switch (orientation) {
    case HORIZONTAL:
        Axis newXAxis = new DefaultNumericAxis("x-Axis");
        newXAxis.setSide(Side.BOTTOM);
        getAxes().add(newXAxis);
        return newXAxis;
    case VERTICAL:
    default:
        Axis newYAxis = new DefaultNumericAxis("y-Axis");
        newYAxis.setSide(Side.LEFT);
        getAxes().add(newYAxis);
        return newYAxis;
    }
}
 
Example #16
Source File: ChartController.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Update the ToolBar
 * Called every time an ChartIndicator has been added or removed to the
 * {@link BaseIndicatorBox chartIndicatorBox} colorOf the underlying {@link TaChart org.sjwimmer.tacharting.chart}
 *
 * @param change Change<? extends String, ? extends ChartIndicator>
 */
@Override
public void onChanged(Change<? extends String, ? extends ChartIndicator> change) {
    String key = change.getKey();

    if(change.wasRemoved()){
        toolBarIndicators.getItems().remove(keyButton.get(key));
        toolBarIndicators.getItems().remove(keySeperator.get(key));
        if(!change.wasAdded()) {
            CheckMenuItem item = itemMap.get(key);
            if(item!=null){
                item.setSelected(false);
            }
        }
    }
    // it is possible that wasRemoved = wasAdded = true, e.g ObservableMap.put(existingKey, indicator)
    if(change.wasAdded()) {
        ChartIndicator indicator = change.getValueAdded();
        Button btnSetup = new Button(indicator.getGeneralName());
        btnSetup.setOnAction((event)->{
            IndicatorPopUpWindow in = IndicatorPopUpWindow.getPopUpWindow(key, chart.getChartIndicatorBox());
            in.show(btnSetup, MouseInfo.getPointerInfo().getLocation().x, MouseInfo.getPointerInfo().getLocation().y);
        });

        keyButton.put(key,btnSetup);
        Separator sep1 = new Separator(Orientation.VERTICAL);
        keySeperator.put(key, sep1);
        toolBarIndicators.getItems().add(btnSetup);
        toolBarIndicators.getItems().add(sep1);
    }
}
 
Example #17
Source File: EditDataSet.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
protected void performSelection() {
    if (!(getChart() instanceof XYChart)) {
        return;
    }
    final XYChart xyChart = (XYChart) getChart();

    if (!isShiftDown()) {
        markedPoints.clear();
    }

    findDataPoint(xyChart.getFirstAxis(Orientation.HORIZONTAL), xyChart.getFirstAxis(Orientation.VERTICAL),
            xyChart.getDatasets());

    for (final Renderer rend : xyChart.getRenderers()) {
        final ObservableList<Axis> axes = rend.getAxes();
        findDataPoint(getFirstAxis(axes, Orientation.HORIZONTAL), getFirstAxis(axes, Orientation.VERTICAL),
                rend.getDatasets());
    }

    if (markedPoints.isEmpty()) {
        editEnable.set(false);
    } else {
        editEnable.set(true);
    }

    updateMarker();
}
 
Example #18
Source File: FunctionStage.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private void initComponents() {
    mainSplitPane.setDividerPositions(0.35);
    mainSplitPane.getItems().addAll(createTree(), functionSplitPane);

    expandAllBtn.setOnAction((e) -> expandAll());
    collapseAllBtn.setOnAction((e) -> collapseAll());
    refreshButton.setOnAction((e) -> refresh());
    topButtonBar.setId("topButtonBar");
    topButtonBar.setButtonMinWidth(Region.USE_PREF_SIZE);
    topButtonBar.getButtons().addAll(expandAllBtn, collapseAllBtn, refreshButton);

    functionSplitPane.setDividerPositions(0.4);
    functionSplitPane.setOrientation(Orientation.VERTICAL);
    documentArea = functionInfo.getEditorProvider().get(false, 0, IEditorProvider.EditorType.OTHER, false);
    Platform.runLater(() -> {
        documentArea.setEditable(false);
        documentArea.setMode("ruby");
    });

    argumentPane = new VBox();
    ScrollPane scrollPane = new ScrollPane(argumentPane);
    scrollPane.setHbarPolicy(ScrollBarPolicy.AS_NEEDED);
    scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    functionSplitPane.getItems().addAll(documentArea.getNode(), scrollPane);

    okButton.setOnAction(new OkHandler());
    okButton.setDisable(true);
    cancelButton.setOnAction((e) -> dispose());
    buttonBar.getButtons().addAll(okButton, cancelButton);
    buttonBar.setButtonMinWidth(Region.USE_PREF_SIZE);
}
 
Example #19
Source File: EditDataSet.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
protected void addPoint(final double x, final double y) {
    if (!(getChart() instanceof XYChart)) {
        return;
    }
    final XYChart xyChart = (XYChart) getChart();

    // TODO: tidy up code and make it compatible with multiple renderer

    // find data set closes to screen coordinate x & y
    final Pane pane = getChart().getCanvasForeground();
    final Bounds bounds = pane.getBoundsInLocal();
    final Bounds screenBounds = pane.localToScreen(bounds);
    final int x0 = (int) screenBounds.getMinX();
    final int y0 = (int) screenBounds.getMinY();
    final DataPoint dataPoint = findNearestDataPoint(getChart(), new Point2D(x - x0, y - y0));

    if (dataPoint != null && (dataPoint.getDataSet() instanceof EditableDataSet)) {
        final Axis xAxis = xyChart.getFirstAxis(Orientation.HORIZONTAL);
        final Axis yAxis = xyChart.getFirstAxis(Orientation.VERTICAL);
        final int index = dataPoint.getIndex();
        final double newValX = xAxis.getValueForDisplay(x - x0);
        final double newValY = yAxis.getValueForDisplay(y - y0);
        final EditableDataSet ds = (EditableDataSet) (dataPoint.getDataSet());
        final double oldValX = ds.get(DataSet.DIM_X, index);
        if (oldValX <= newValX) {
            ds.add(index, newValX, newValY);
        } else {
            ds.add(index - 1, newValX, newValY);
        }
    }

    updateMarker();
}
 
Example #20
Source File: FxmlControl.java    From MyBox with Apache License 2.0 5 votes vote down vote up
public static ScrollBar getVScrollBar(WebView webView) {
    try {
        Set<Node> scrolls = webView.lookupAll(".scroll-bar");
        for (Node scrollNode : scrolls) {
            if (ScrollBar.class.isInstance(scrollNode)) {
                ScrollBar scroll = (ScrollBar) scrollNode;
                if (scroll.getOrientation() == Orientation.VERTICAL) {
                    return scroll;
                }
            }
        }
    } catch (Exception e) {
    }
    return null;
}
 
Example #21
Source File: LogAxisTest.java    From charts with Apache License 2.0 5 votes vote down vote up
@Override public void init() {
    xAxisBottom = new Axis(0, 1000, Orientation.HORIZONTAL, AxisType.LOGARITHMIC, Position.BOTTOM);
    xAxisBottom.setPrefHeight(20);
    AnchorPane.setLeftAnchor(xAxisBottom, 20d);
    AnchorPane.setRightAnchor(xAxisBottom, 20d);
    AnchorPane.setBottomAnchor(xAxisBottom, 0d);

    yAxisLeft = new Axis(0, 1000, Orientation.VERTICAL, AxisType.LOGARITHMIC, Position.LEFT);
    yAxisLeft.setPrefWidth(20);
    AnchorPane.setLeftAnchor(yAxisLeft, 0d);
    AnchorPane.setTopAnchor(yAxisLeft, 20d);
    AnchorPane.setBottomAnchor(yAxisLeft, 20d);
}
 
Example #22
Source File: PlayfairTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createRightYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.VERTICAL, Position.RIGHT);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefWidth(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setRightAnchor(axis, 0d);
    AnchorPane.setTopAnchor(axis, 0d);
    AnchorPane.setBottomAnchor(axis, 25d);

    return axis;
}
 
Example #23
Source File: LineChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createCenterXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE, final double AXIS_WIDTH) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.CENTER);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setBottomAnchor(axis, axis.getZeroPosition());
    AnchorPane.setLeftAnchor(axis, AXIS_WIDTH);
    AnchorPane.setRightAnchor(axis, AXIS_WIDTH);

    return axis;
}
 
Example #24
Source File: TableViewer.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
/**
 * Helper function to initialize the UI elements for the Interactor toolbar.
 * 
 * @return HBox node with the toolbar elements
 */
protected HBox getInteractorBar() {
    final Separator separator = new Separator();
    separator.setOrientation(Orientation.VERTICAL);
    final HBox buttonBar = new HBox();
    buttonBar.setPadding(new Insets(1, 1, 1, 1));
    final Button switchTableView = new Button(null, tableView);
    switchTableView.setPadding(new Insets(3, 3, 3, 3));
    switchTableView.setTooltip(new Tooltip("switches between graph and table view"));

    final Button copyToClipBoard = new Button(null, clipBoardIcon);
    copyToClipBoard.setPadding(new Insets(3, 3, 3, 3));
    copyToClipBoard.setTooltip(new Tooltip("copy selected content top system clipboard"));
    copyToClipBoard.setOnAction(e -> this.copySelectedToClipboard());

    final Button saveTableView = new Button(null, saveIcon);
    saveTableView.setPadding(new Insets(3, 3, 3, 3));
    saveTableView.setTooltip(new Tooltip("store actively shown content as .csv file"));
    saveTableView.setOnAction(e -> this.exportGridToCSV());

    switchTableView.setOnAction(evt -> {
        switchTableView.setGraphic(table.isVisible() ? tableView : graphView);
        table.setVisible(!table.isVisible());
        getChart().getPlotForeground().setMouseTransparent(!table.isVisible());
        table.setMouseTransparent(!table.isVisible());
        dsModel.datasetsChanged(null);
    });

    buttonBar.getChildren().addAll(separator, switchTableView, copyToClipBoard, saveTableView);
    return buttonBar;
}
 
Example #25
Source File: PlayfairTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createCenterYAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.VERTICAL, Position.CENTER);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefWidth(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setTopAnchor(axis, 0d);
    AnchorPane.setBottomAnchor(axis, 25d);
    AnchorPane.setLeftAnchor(axis, axis.getZeroPosition());

    return axis;
}
 
Example #26
Source File: Zoomer.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
protected void resetSlider(Boolean n) {
    if (getChart() == null) {
        return;
    }
    final Axis axis = getChart().getFirstAxis(Orientation.HORIZONTAL);
    if (Boolean.TRUE.equals(n)) {
        setMin(axis.getMin());
        setMax(axis.getMax());
    }
}
 
Example #27
Source File: SingleChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createTopXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.TOP);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setTopAnchor(axis, 25d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example #28
Source File: LegendTest.java    From charts with Apache License 2.0 5 votes vote down vote up
@Override public void init() {
    LegendItem item1 = new LegendItem(Symbol.CIRCLE, "Item 1", Color.RED, Color.BLACK);
    LegendItem item2 = new LegendItem(Symbol.SQUARE, "Item 2", Color.GREEN, Color.BLACK);
    LegendItem item3 = new LegendItem(Symbol.TRIANGLE, "Item 3", Color.BLUE, Color.BLACK);

    legend = new Legend(item1, item2, item3);
    legend.setOrientation(Orientation.VERTICAL);
}
 
Example #29
Source File: SingleChartTest.java    From charts with Apache License 2.0 5 votes vote down vote up
private Axis createBottomXAxis(final double MIN, final double MAX, final boolean AUTO_SCALE) {
    Axis axis = new Axis(Orientation.HORIZONTAL, Position.BOTTOM);
    axis.setMinValue(MIN);
    axis.setMaxValue(MAX);
    axis.setPrefHeight(AXIS_WIDTH);
    axis.setAutoScale(AUTO_SCALE);

    AnchorPane.setBottomAnchor(axis, 0d);
    AnchorPane.setLeftAnchor(axis, 25d);
    AnchorPane.setRightAnchor(axis, 25d);

    return axis;
}
 
Example #30
Source File: TracesTab.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
TracesTab(final Model model, final UndoableActionManager undo)
{
    super(Messages.TracesTab);
    this.model = model;
    this.undo = undo;

    // Top: Traces
    createTraceTable();

    // Bottom: Archives for selected trace
    createArchivesTable();
    createDetailSection();

    archives_table.setVisible(false);
    formula_pane.setVisible(false);

    final StackPane details = new StackPane(lower_placeholder, archives_table, formula_pane);

    trace_table.setPlaceholder(new Label(Messages.TraceTableEmpty));
    final SplitPane top_bottom = new SplitPane(trace_table, details);
    top_bottom.setOrientation(Orientation.VERTICAL);
    Platform.runLater(() -> top_bottom.setDividerPositions(0.7));

    setContent(top_bottom);

    createContextMenu();

    model.addListener(model_listener);
    updateFromModel();

    trace_table.getSelectionModel().getSelectedItems().addListener(selection_changed);
}