我有一个包含许多系列的折线图.这些系列分为一个或多个超级系列.每个超级系列可能在行中有许多"中断",以便准确地描述监视器进程何时没有主动收集数据.每个数据中断实际上都是开始一个新系列.
我已经成功克服了几个技术问题,例如图表为每个新系列分配了一种新颜色,图表线符号颜色与系列颜色不匹配等等.现在一切都很好,除了每次我在图表中添加一个新系列,它会在图例中添加一个项目.
有没有办法从图例中删除项目,还是我必须隐藏默认图例并添加我自己的自定义图例窗格?
我正在尝试实现一个场景,ScrollPane用户可以在其中拖动节点并动态缩放它.我使用鼠标滚轮进行拖动和缩放以及重置缩放,但是我在计算上遇到问题以使节点适合父节点的宽度.
这是我的代码作为sscce.
如果我放大或缩小或更改窗口大小,适合宽度不起作用.
如果有人可以帮助我进行计算以使节点符合父节点的宽度,我将非常感激.
编辑:
fitWidth(),通过鼠标右键双击调用.希望现在更清楚了.
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.application.Application;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.event.EventHandler;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.ScrollPane.ScrollBarPolicy;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.ScrollEvent;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.StrokeType;
import javafx.stage.Stage;
import javafx.util.Duration;
public class ZoomAndPanExample extends Application {
private ScrollPane scrollPane = new ScrollPane();
private final DoubleProperty zoomProperty = new SimpleDoubleProperty(1.0d);
private …Run Code Online (Sandbox Code Playgroud) 我一直在尝试使用此示例来了解缩放和缩放.它在演示缩放方面做得很好.
我一直试图找出如何改变它,以便不是简单地放大视图的当前中心,而是zoom in on the position of the mouse pointer.我失败了.我不确定使用哪些值来进行数学运算.我在其他语言中找到了一些例子,但JavaFX没有.
我正在寻找在Swing上下文中使用FXML的JavaFX 2的一点帮助.我使用Scene Builder构建了一个场景(版本:2.0-b10,变更集:48fc80a12d33),我试图在Java 1.7下将其加载到Swing中的JFrame上的JFXPanel中.当我这样做时,我在第16行得到一个无效属性错误.这是第16行:<Label style="-fx-font-weight: bold;" text="Storage Overview Home" VBox.vgrow="NEVER">
这是整个场景:
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.chart.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<AnchorPane maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" minHeight="600.0" minWidth="800.0" prefHeight="768.0" prefWidth="1024.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<children>
<BorderPane layoutX="54.0" layoutY="45.0" prefHeight="400.0" prefWidth="600.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<left>
<VBox fx:id="" prefHeight="726.0" prefWidth="210.0" style="-fx-background-color: #dee8f6;">
<children>
<Label style="-fx-font-weight: bold;" text="Storage Overview Home" VBox.vgrow="NEVER">
<padding>
<Insets bottom="18.0" left="6.0" top="6.0" />
</padding>
</Label>
<ComboBox fx:id="ASPCombo" prefWidth="150.0" VBox.vgrow="NEVER" xmlns:fx="http://javafx.com/fxml">
<VBox.margin>
<Insets bottom="12.0" left="6.0" />
</VBox.margin> …Run Code Online (Sandbox Code Playgroud)