使用Scene Builder进行图例对齐

问题描述

最近,我使用场景构建器绘制了条形图;但是,图例未正确对齐。当我使用

struct nodo * delete3(struct nodo * top,int k) {
struct nodo * curr = top;
while(curr) {
    if(curr->d == k) {
        struct nodo * tmp = curr->next;
        free(curr);
        curr = tmp;
    }
    else curr = curr->next;
}
return top;
}

图例是垂直显示的,如下图,而我希望水平显示。

User clicks somewhere in yellow row upper window,yellow cell down gets focused

尽管如此,如果我不使用场景生成器,则图表也没有问题。请告诉我解决此问题的方法。

主文件

barchart.setLegendSide(Side.BOTTOM);

FXML文件

package LinkedIn;

import java.io.IOException;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class App extends Application{

@Override
public void start(Stage primaryStage) throws IOException{
    
    Parent root = FXMLLoader.load(getClass().getResource("/LinkedIn/barchart.fxml"));
    
    Scene scene = new Scene(root);
    primaryStage.setScene(scene);
    primaryStage.setTitle("LinkedIn");
    primaryStage.show();
}

public static void main(String[] args) {
    launch(args);
    }
}

控制器文件

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.chart.BarChart?>
<?import javafx.scene.chart.CategoryAxis?>
<?import javafx.scene.chart.NumberAxis?>

<BarChart fx:id="barchart" animated="false" barGap="10.0" categoryGap="20.0" title="Car Sales by Brands" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="LinkedIn.Controller">
   <xAxis>
      <CategoryAxis side="BOTTOM" fx:id="xAxis" />
   </xAxis>
   <yAxis>
      <NumberAxis fx:id="yAxis" side="LEFT" />
   </yAxis>
   <padding>
      <Insets bottom="25.0" left="5.0" right="5.0" top="5.0" />
   </padding>
</BarChart>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)