stats.fxml 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <?import javafx.geometry.*?>
  3. <?import javafx.scene.chart.*?>
  4. <?import javafx.scene.control.*?>
  5. <?import javafx.scene.layout.*?>
  6. <ScrollPane fx:id="statsPane" xmlns="http://javafx.com/javafx/23" xmlns:fx="http://javafx.com/fxml/1" visible="false" managed="false" fitToWidth="true">
  7. <VBox spacing="16">
  8. <padding><Insets top="16" right="16" bottom="16" left="16"/></padding>
  9. <HBox spacing="10" alignment="CENTER_LEFT">
  10. <Label text="数据洞察" style="-fx-font-size: 18px; -fx-font-weight: bold;" HBox.hgrow="ALWAYS"/>
  11. <Button text="刷新数据" onAction="#handleLoadStatistics" styleClass="btn,btn-secondary"/>
  12. </HBox>
  13. <HBox spacing="16">
  14. <VBox styleClass="kpi-card" HBox.hgrow="ALWAYS">
  15. <Label text="交易总金额" styleClass="kpi-label"/>
  16. <Label fx:id="statTotalAmount" text="-" styleClass="kpi-value" style="-fx-text-fill: -fx-success;"/>
  17. </VBox>
  18. <VBox styleClass="kpi-card" HBox.hgrow="ALWAYS">
  19. <Label text="交易总笔数" styleClass="kpi-label"/>
  20. <Label fx:id="statTotalCount" text="-" styleClass="kpi-value"/>
  21. </VBox>
  22. </HBox>
  23. <VBox styleClass="well" spacing="12">
  24. <Label text="🔥 热门院系 TOP 3" style="-fx-font-size: 16px; -fx-font-weight: bold;"/>
  25. <SplitPane dividerPositions="0.65" prefHeight="220">
  26. <TableView fx:id="deptTable" minWidth="200">
  27. <columns>
  28. <TableColumn fx:id="deptRankCol" text="排名" prefWidth="60"/>
  29. <TableColumn fx:id="deptNameCol" text="院系" prefWidth="200"/>
  30. <TableColumn fx:id="deptSalesCol" text="销售额" prefWidth="150"/>
  31. </columns>
  32. </TableView>
  33. <PieChart fx:id="deptPieChart" minWidth="200" labelsVisible="true" legendVisible="false"/>
  34. </SplitPane>
  35. </VBox>
  36. <VBox styleClass="well" spacing="12">
  37. <Label text="📚 畅销书籍 TOP 5" style="-fx-font-size: 16px; -fx-font-weight: bold;"/>
  38. <SplitPane dividerPositions="0.65" prefHeight="220">
  39. <TableView fx:id="hotBookTable" minWidth="250">
  40. <columns>
  41. <TableColumn fx:id="hotBookRankCol" text="排名" prefWidth="60"/>
  42. <TableColumn fx:id="hotBookIdCol" text="编号" prefWidth="50"/>
  43. <TableColumn fx:id="hotBookTitleCol" text="书名" prefWidth="200"/>
  44. <TableColumn fx:id="hotBookAuthorCol" text="作者" prefWidth="120"/>
  45. <TableColumn fx:id="hotBookSoldCol" text="销量" prefWidth="80"/>
  46. </columns>
  47. </TableView>
  48. <BarChart fx:id="hotBookChart" minWidth="200" animated="false" legendVisible="false">
  49. <xAxis>
  50. <CategoryAxis side="BOTTOM" tickLabelRotation="-30"/>
  51. </xAxis>
  52. <yAxis>
  53. <NumberAxis side="LEFT" label="销量"/>
  54. </yAxis>
  55. </BarChart>
  56. </SplitPane>
  57. </VBox>
  58. <VBox styleClass="well" spacing="12">
  59. <Label text="📊 各院系平均折扣率" style="-fx-font-size: 16px; -fx-font-weight: bold;"/>
  60. <SplitPane dividerPositions="0.65" prefHeight="220">
  61. <TableView fx:id="discountTable" minWidth="250">
  62. <columns>
  63. <TableColumn fx:id="discountDeptCol" text="院系" prefWidth="200"/>
  64. <TableColumn fx:id="discountRateCol" text="平均折扣率" prefWidth="150"/>
  65. </columns>
  66. </TableView>
  67. <LineChart fx:id="discountChart" minWidth="200" animated="false" legendVisible="false" createSymbols="true">
  68. <xAxis>
  69. <CategoryAxis side="BOTTOM"/>
  70. </xAxis>
  71. <yAxis>
  72. <NumberAxis side="LEFT" label="折扣率(%)"/>
  73. </yAxis>
  74. </LineChart>
  75. </SplitPane>
  76. </VBox>
  77. </VBox>
  78. </ScrollPane>