本文整理匯總了Java中javafx.scene.chart.PieChart.Data方法的典型用法代碼示例。如果您正苦於以下問題:Java PieChart.Data方法的具體用法?Java PieChart.Data怎麽用?Java PieChart.Data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.chart.PieChart
的用法示例。
在下文中一共展示了PieChart.Data方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: start
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
@Override
public void start(Stage stage) {
Scene scene = new Scene(new Group());
stage.setTitle("Europian Country Population");
stage.setWidth(500);
stage.setHeight(500);
ObservableList<PieChart.Data> pieChartData =
FXCollections.observableArrayList(
new PieChart.Data("Belgium", 3),
new PieChart.Data("France", 26),
new PieChart.Data("Germany", 35),
new PieChart.Data("Netherlands", 7),
new PieChart.Data("Sweden", 4),
new PieChart.Data("United Kingdom", 25));
final PieChart pieChart = new PieChart(pieChartData);
pieChart.setTitle("Country Population");
((Group) scene.getRoot()).getChildren().add(pieChart);
stage.setScene(scene);
stage.show();
}
示例2: populationsScreen
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
private PieChart populationsScreen(Scene scene) {
ObservableList<PieChart.Data> pieChartData =
FXCollections.observableArrayList(
new PieChart.Data("Alive",
timeLine.getCurrentTimeInstant().getPopulation()),
new PieChart.Data("Dead",
fieldHeight * fieldWidth - timeLine.getCurrentTimeInstant().getPopulation()));
final PieChart chart = new PieChart(pieChartData);
final Timer timer = new java.util.Timer();
timer.schedule(new TimerTask() {
public void run() {
Platform.runLater(() -> {
pieChartData.get(0).setPieValue(timeLine.getCurrentTimeInstant().getPopulation());
pieChartData.get(1).setPieValue(fieldHeight * fieldWidth
- timeLine.getCurrentTimeInstant().getPopulation());
});
}
}, 0, INTERVAL);
return chart;
}
示例3: initialize
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
@FXML
public void initialize() {
StringConverter<PieChart.Data> labelConverter = new StringConverter<PieChart.Data>() {
@Override
public String toString(Data d) {
String formatedValue = String.format("%s\n%.2f %%", d.getName(), d.getPieValue());
return formatedValue;
}
@Override
public Data fromString(String string) {
return null;
}
};
picChart.setLabelConverter(labelConverter);
picChart.setTooltipConverter(labelConverter);
tbFileProperties.getItems().addAll(apply(this.file));
tbFileProperties.getSelectionModel().setCellSelectionEnabled(true);
tbFileProperties.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
FxUtil.installClipboardKeyEvent(tbFileProperties);
FxClipboardUtil.installCopyPasteHandler(tbFileProperties);
}
示例4: getChartInfos
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
public String getChartInfos(PieChart chart,char Phase) {
actualPhase = Phase;
stopTime(Phase);
elapsedTimed=System.currentTimeMillis()-(StartTime+trackerTime);
RedTimeInPreCent = Math.round(((double) RedTime/elapsedTimed)*100);
GreenTimeInPreCent = Math.round(((double) GreenTime/elapsedTimed)*100);
RefactorTimeInPreCent = Math.round(((double) RefactorTime/elapsedTimed)*100);
ExtraInfo=setExtraInfo();
ObservableList<PieChart.Data> pieChartData =
FXCollections.observableArrayList(
new PieChart.Data("RED-Time", RedTimeInPreCent),
new PieChart.Data("GREEN-Time", GreenTimeInPreCent),
new PieChart.Data("REFACTOR-Time", RefactorTimeInPreCent));
chart.setData(pieChartData);
chart.setTitle("Phase Duration");
return getTrackingStats();
}
開發者ID:ProPra16,項目名稱:programmierpraktikum-abschlussprojekt-halt-doch-einfach-mal-dein-maul,代碼行數:18,代碼來源:TrackingUnit.java
示例5: initChart
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
/**
* Generate pipe chart
*/
private void initChart() {
PieChart.Data available = new PieChart.Data("Available", 13);
PieChart.Data used = new PieChart.Data("Used", 25);
PieChart.Data empty = new PieChart.Data("Empty", 10);
ObservableList<PieChart.Data> pieChartData =
FXCollections.observableArrayList(available, used, empty);
final PieChart chart = new PieChart(pieChartData);
chart.setTitle("");
chart.setPrefSize(350, 350);
chart.setLegendVisible(false);
chart.setStyle("-fx-background-color: none");
pieChartPane.getChildren().add(chart);
available.getNode().setStyle("-fx-background-color: #55c4fe");
used.getNode().setStyle("-fx-background-color: #008287");
empty.getNode().setStyle("-fx-background-color: #219297");
}
示例6: getSystemPanel
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
private HBox getSystemPanel() {
ObservableList<PieChart.Data> pieChartData =
FXCollections.observableArrayList();
CONNECTIONS.forEach((string, clientObject) -> {
if (clientObject.getSYSTEM_OS() != null) {
if (operatingSystems.containsKey(clientObject.getSYSTEM_OS())) {
operatingSystems.put(clientObject.getSYSTEM_OS(), operatingSystems.get(clientObject.getSYSTEM_OS()) + 1);
} else {
operatingSystems.put(clientObject.getSYSTEM_OS(), 1);
}
}
});
operatingSystems.forEach((string, integer) -> {
pieChartData.add(new PieChart.Data(string, CONNECTIONS.size() / integer));
});
final PieChart chart = new PieChart(pieChartData);
chart.setLegendVisible(false);
chart.setTitle("Operating Systems");
chart.setMaxSize(300, 300);
return Styler.hContainer(Styler.vContainer(10, chart));
}
示例7: getData
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
/**
* Be careful, it returns the copy of the data array, and it is not
* synchronized with he original data array.
*/
final public ObservableList<PieChart.Data> getData() {
final ObservableList<PieChart.Data> data = FXCollections.observableArrayList();
new GetAction() {
@Override
public void run(Object... os) throws Exception {
PieChart chart = (PieChart) piechart.getControl();
for (PieChart.Data dataItem : chart.getData()) {
data.add(dataItem);
}
}
}.dispatch(Root.ROOT.getEnvironment());
return data;
}
示例8: updateInnerCircleLayout
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
private void updateInnerCircleLayout() {
double minX = Double.MAX_VALUE, minY = Double.MAX_VALUE;
double maxX = Double.MIN_VALUE, maxY = Double.MIN_VALUE;
for (PieChart.Data data: getData()) {
Node node = data.getNode();
Bounds bounds = node.getBoundsInParent();
if (bounds.getMinX() < minX) {
minX = bounds.getMinX();
}
if (bounds.getMinY() < minY) {
minY = bounds.getMinY();
}
if (bounds.getMaxX() > maxX) {
maxX = bounds.getMaxX();
}
if (bounds.getMaxY() > maxY) {
maxY = bounds.getMaxY();
}
}
innerCircle.setCenterX(minX + (maxX - minX) / 2);
innerCircle.setCenterY(minY + (maxY - minY) / 2);
innerCircle.setRadius((maxX - minX) / 4);
}
示例9: updatePieChart
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
/**
* Updates the given {@link PieChart} with new data.
*
* @param pPieChart the {@link PieChart} to update.
*/
private void updatePieChart(PieChart pPieChart)
{
pPieChart.setAnimated(chartAnimation);
List<PieChart.Data> data = pPieChart.getData();
for (String yColumnName : yColumnNames)
{
try
{
dataBook.fetchAll();
for (int index = 0; index < dataBook.getRowCount(); index++)
{
IDataRow dataRow = dataBook.getDataRow(index);
data.add(new PieChart.Data(dataRow.getValueAsString(xColumnName), ((BigDecimal) dataRow.getValue(yColumnName)).doubleValue()));
}
}
catch (ModelException e)
{
e.printStackTrace();
}
}
}
示例10: updateInnerCircleLayout
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
private void updateInnerCircleLayout() {
double minX = Double.MAX_VALUE, minY = Double.MAX_VALUE;
double maxX = Double.MIN_VALUE, maxY = Double.MIN_VALUE;
for (PieChart.Data data : getData()) {
Node node = data.getNode();
Bounds bounds = node.getBoundsInParent();
if (bounds.getMinX() < minX) {
minX = bounds.getMinX();
}
if (bounds.getMinY() < minY) {
minY = bounds.getMinY();
}
if (bounds.getMaxX() > maxX) {
maxX = bounds.getMaxX();
}
if (bounds.getMaxY() > maxY) {
maxY = bounds.getMaxY();
}
}
innerCircle.setCenterX(minX + (maxX - minX) / 2);
innerCircle.setCenterY(minY + (maxY - minY) / 2);
innerCircle.setRadius((maxX - minX) / 4);
}
示例11: makeGenotypePie
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
private PieChart makeGenotypePie(final VariantContext ctx) {
final Counter<GenotypeType> countTypes= new Counter<>();
if(ctx!=null) {
for(final Genotype g:ctx.getGenotypes())
{
// ignore genotype if not displayed
final SampleDef sampleDef= this.name2sampledef.get(g.getSampleName());
if(sampleDef==null || !sampleDef.isDisplayed()) continue;
countTypes.incr(g.getType());
}
}
final ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList();
for(final GenotypeType t:GenotypeType.values())
{
int c= (int)countTypes.count(t);
if(c==0) continue;
pieChartData.add(new PieChart.Data(
t.name()+" = "+c,
c));
}
final PieChart chart = new PieChart(pieChartData);
chart.setLegendVisible(false);
return chart;
}
示例12: pieChartData
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
ObservableList<PieChart.Data> pieChartData() {
ObservableList<PieChart.Data> data = FXCollections.observableArrayList();
List<Location> locations = locationMapper.readAll();
Integer timesWorkedAtLocation;
for (Location location : locations) {
timesWorkedAtLocation = getNumberOfLogEntriesContainingSpecifiedDatabaseItem(location.getLocationName());
data.add(new PieChart.Data(location.getLocationName(), timesWorkedAtLocation));
}
return data;
}
示例13: pieChartData
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
ObservableList<PieChart.Data> pieChartData() {
ObservableList<PieChart.Data> data = FXCollections.observableArrayList();
List<Company> companies = companyMapper.readAll();
Integer timesWorkedForCompany;
for (Company company : companies) {
timesWorkedForCompany = getNumberOfLogEntriesContainingSpecifiedDatabaseItem(company.getCompanyName());
data.add(new PieChart.Data(company.getCompanyName(), timesWorkedForCompany));
}
return data;
}
示例14: pieChartData
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
@Override
ObservableList<PieChart.Data> pieChartData() {
ObservableList<PieChart.Data> data = FXCollections.observableArrayList();
List<Supervisor> supervisors = supervisorMapper.readAll();
Integer timesWorkedUnderSupervisor;
for (Supervisor supervisor : supervisors) {
timesWorkedUnderSupervisor =
getNumberOfLogEntriesContainingSpecifiedDatabaseItem(supervisor.getSupervisorDisplayName());
data.add(new PieChart.Data(supervisor.getSupervisorDisplayName(), timesWorkedUnderSupervisor));
}
return data;
}
示例15: setDrilldownData
import javafx.scene.chart.PieChart; //導入方法依賴的package包/類
private void setDrilldownData(final PieChart pie, PieChart.Data data, final String labelPrefix) {
data.getNode().setOnMouseClicked(new EventHandler<MouseEvent>() {
public void handle(MouseEvent t) {
pie.setData(FXCollections.observableArrayList(
new PieChart.Data(labelPrefix + "-1", 7),
new PieChart.Data(labelPrefix + "-2", 2),
new PieChart.Data(labelPrefix + "-3", 5),
new PieChart.Data(labelPrefix + "-4", 3),
new PieChart.Data(labelPrefix + "-5", 2)));
}
});
}